MPI_Bcast
ランクルートを有するプロセスからグループの 他の全プロセスにメッセージをブロードキャストする.
呼び出し手順
res = MPI_Bcast(value,rootID) res = MPI_Bcast(value, rootID, comm=mpi_comm)
引数
- value
全ノードに送信する値.
- rootID
メッセージのソース
- comm = mpi_comm
If the optional argument "comm" is given, this function will use the MPI communicator created by MPI_Create_comm. If not, the default MPI_COMM_WORLD is used.
- res
ブロードキャストされた値
説明
全ノードに変数を送信します. この値は関数MPI_Recvにより ノードで取得されます.
内部的な技術面では,2つのブロードキャストが透過的に 使用されます. 初回はデータの大きさ,2回目はデータ自体を送信します.
例
MPI_Init(); rnk = MPI_Comm_rank(); sizeNodes = MPI_Comm_size(); SLV = rnk; // 手軽なショートカット, マスターはランク0です Master = ~ SLV; // その他は全てスレーブ a = -1; if Master // aを宣言 a = 42 end b = MPI_Bcast(a, 0); b == 42 MPI_Finalize();
参照
- MPI_Recv — ノードからデータを受信する
Report an issue | ||
<< MPI | Scilab MPI | MPI_Comm_rank >> |