Я пытаюсь использовать MPI_Comm_spawn для запуска второго процесса. Просто для демонстрации. Программа довольно проста:
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
У меня процесс 0, а мы 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, ошибки = 0x0000000000000000) не удалось
MPID_Comm_spawn_multiple (314): функция не реализована
Что я делаю не так .... кажись так просто .... MSMPI не реализует MPI_Comm_spawn?