Message Passing Interface (MPI) 統合スレ
at TECH
286:281
09/01/16 09:59:35
>>285
どっちか一冊買ってみます。
>>284
こんな感じにしたのですが、順番に出力されません。書き方、まずいでしょうか?
#include <stdio.h>
#include <stdlib.h>
#include "mpi.h"
int main(int argc, char **argv){
int nprocs;
int mype;
int dummy;
int i;
int tag=0;
MPI_Status status;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &mype);
for(i=0; i<nprocs-1; i++) {
if(mype==i) {
printf("My proc is : %d\n", mype);
MPI_Send(&mype, 1, MPI_INT, i+1, tag, MPI_COMM_WORLD);}
if(mype==i+1) {
MPI_Recv(&dummy, 1, MPI_INT, i, tag, MPI_COMM_WORLD, &status);}
}
if(mype==(nprocs-1)) {
printf("My proc is : %d\n", mype);}
MPI_Finalize();}
<実行>
mpirun -np 5 -machinefile mpd.hosts ./a.out
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5159日前に更新/124 KB
担当:undef