Intel® MPI Library
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.
2166 Discussions

MPI_Comm_spawn fails with Intel MPI version 4.0.1.007

mark_m
Beginner
986 Views
I'm trying to test a simple example code which spawns 2 children ranks. The code is:

#include "mpi.h"
#include
#include

#define NUM_SPAWNS 2

int main( int argc, char *argv[] )
{
int np = NUM_SPAWNS;
int errcodes[NUM_SPAWNS];
MPI_Comm parentcomm, intercomm;

MPI_Init( &argc, &argv );
MPI_Comm_get_parent( &parentcomm );
if (parentcomm == MPI_COMM_NULL)
{
/* Create 2 more processes - this example must be called spawn_example.exe for this to work. */
MPI_Comm_spawn( "spawn_example", MPI_ARGV_NULL, np, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &intercomm, errcodes );
printf("I'm the parent.\\n");
}
else
{
printf("I'm the spawned.\\n");
}
fflush(stdout);
MPI_Finalize();
return 0;
}

I run it with:

mpiexec -n 1 -wdir /raid/dodds/mmessne2/temp/ -env I_MPI_FABRICS shm:tcp ./spawn_example

or just:

mpirun -np 1 ./spawn_example

and on two machines I get:

Fatal error in MPI_Comm_spawn: Other MPI error, error stack:
MPI_Comm_spawn(157)...........: MPI_Comm_spawn(cmd="spawn_example", argv=(nil), maxprocs=2, MPI_INFO_NULL, root=0, MPI_COMM_WORLD, intercomm=0x7fffe0125788, errors=0x7fffe0125780) failed
MPIDI_Comm_spawn_multiple(249): PMI_Spawn_multiple failed
rank 0 in job 2 ********_53410 caused collective abort of all ranks
exit status of rank 0: return code 1


I would think it's something wrong with the code, but this is just an example provided by the MPI documentation. Is it a problem with how I'm running the program (for now, I just want the children to spawn on the local machine)?

Edit:

The same code works with OpenMPI so I'm guessing it's an issue with the installation/configuration of my Intel MPI installs. Does this help?

Edit (2):

Well I solved my own problem, sorry. Needed to set the path explicity with -gpath.
0 Kudos
1 Reply
Dmitry_K_Intel2
Employee
986 Views
Hi Mark,

Have you tried using of MPI_Init_thread() instead of MPI_init()?
Also you need to compile your application with '-mt_mpi' option.

Regards!
Dmitry
0 Kudos
Reply