LoginSignup
1
2

More than 5 years have passed since last update.

シェルスクリプトを並列実行 (mpiexecを利用)

Posted at

というタイトルだが,やりたいことはシリアルプロセスのシェルスクリプトをたくさん並列したいときに,MPIを使うだけ.

nodefile1.txt
node1.hoge.jp
nodefile2.txt
node2.hoge.jp

のように異なるノード名が一つだけ記述されているノードファイルを用意する.

batch.sh
#/bin/bash

hostname

のようなシェルスクリプトを並列に実行する.

$ for i in `seq 1 2`
>do
>  mpiexec -recvtimeout 100 -machinefile nodefile$i.txt -np 1 ./batch.sh &
>done
[1] 20904
[2] 20905
$ node1.hoge.jp
node2.hoge.jp

のように,並列できる.-recvtimeout 100 はこれをしないとmpiexecに文句言われたから,記述しているが,不要かもしれない.

まぁ,rshなんかと組み合わせればMPIなんて使わなくてもいいんだけど...

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2