MPI_Comm_spawn を使用して 2 番目のプロセスを開始しようとしています。デモンストレーション目的のためだけに。プログラムは非常に単純です。
int main(int argc, char* argv[])
{ int my_id, numprocs;
MPI_Comm All;
MPI_Init(&argc, &argv) ;
MPI_Comm_rank(MPI_COMM_WORLD, &my_id) ;
MPI_Comm_size(MPI_COMM_WORLD, &numprocs) ;
cout << "I'm process "<< my_id << " and we are " << numprocs <<endl;
MPI_Comm_spawn("child.exe",MPI_ARGV_NULL,2,MPI_INFO_NULL,my_id,MPI_COMM_WORLD, &All,MPI_ERRCODES_IGNORE);
MPI_Comm_size(All, &numprocs) ;
cout << "I'm process "<< my_id << " and we are " << numprocs <<endl;
{
int i;
cin >> i;
}
MPI_Finalize();
return 0;
}
child.exe は、コンパイルされたプログラムと同じディレクトリにあり、非常に単純です。
int main(int argc, char* argv[])
{
int my_id, numprocs,length;
MPI_Comm Parent;
MPI_Win pwin,gwin;
MPI_Init(&argc, &argv) ;
MPI_Comm_rank(MPI_COMM_WORLD, &my_id) ;
MPI_Comm_size(MPI_COMM_WORLD, &numprocs) ;
MPI_Comm_get_parent(&Parent);
cout << "I'm child process "<< my_id << " and we are " << numprocs <<endl;
MPI_Comm_size(Parent, &numprocs) ;
cout << "My parent communicator size is: "<< numprocs <<endl;
MPI_Finalize();
return 0;
}
親プロセスが重大なエラーで失敗します: C:\Users.....\Documents\Visual Studio 2010\Projects\mpi\x64\Release>mpi.exe I'm process 0 and we are 1
ジョブが中止されました: [ranks] メッセージ
[0] 致命的なエラー MPI_Comm_spawn の致命的なエラー: その他の MPI エラー、エラー スタック: MPI_Comm_spawn(106)..........: MPI_Comm_spawn(cmd="child.exe", argv=0x0000000000 000000, maxprocs=2 , MPI_INFO_NULL, root=0, MPI_COMM_WORLD, intercomm=0x000000000 026FC20, errors=0x0000000000000000) 失敗 MPID_Comm_spawn_multiple(314): 関数が実装されていません
私が間違っていること....とても単純に思えます....MSMPIはMPI_Comm_spawnを実装していませんか?