Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] noob warning - problems testing MPI_Comm_spawn
From: Damien Hocking (damien_at_[hidden])
Date: 2010-03-03 00:37:12


Hi all,

I'm playing around with MPI_Comm_spawn, trying to do something simple
with a master-slave example. I get a LOCAL DAEMON SPAWN IS CURRENTLY
UNSUPPORTED error when it tries to spawn the slave. This is on Windows,
OpenMPI version 1.4.1, r22421.

Here's the master code:

int main(int argc, char* argv[])
{
   int myid, ierr;
   MPI_Comm maincomm;
   ierr = MPI_Init(&argc, &argv);
   ierr = MPI_Comm_rank(MPI_COMM_WORLD, &myid);
  
   if (myid == 0)
   {
      std::cout << "\n Hello from the boss " << myid;
      std::cout.flush();
   }
  
   MPI_Info* spawninfo;
   MPI_Info_create(spawninfo);
   MPI_Info_set(*spawninfo, "add-host", "127.0.0.1");
  
   if (myid == 0)
   {
      std::cout << "\n About to MPI_Comm_spawn." << myid;
      std::cout.flush();
   }
   MPI_Comm_spawn("slave.exe", MPI_ARGV_NULL, 1, *spawninfo, 0,
MPI_COMM_SELF, &maincomm, MPI_ERRCODES_IGNORE);
   if (myid == 0)
   {
      std::cout << "\n MPI_Comm_spawn successful." << myid;
      std::cout.flush();
   }
   ierr = MPI_Finalize();
   return 0;
}

Here's the slave code:

int main(int argc, char* argv[])
{
   int myid, ierr;
  
   MPI_Comm parent;
  
   ierr = MPI_Init(&argc, &argv);
   MPI_Comm_get_parent(&parent);
  
   if (parent == MPI_COMM_NULL)
   {
      std::cout << "\n No parent.";
   }
   ierr = MPI_Comm_rank(MPI_COMM_WORLD, &myid);
  
   std::cout << "\n Hello from a worker " << myid;
   std::cout.flush();
  
   ierr = MPI_Finalize();
  
   return 0;
}

Also, this only starts up correctly if I kick it off with orterun.
Ideally I'd like to run it as "master.exe" and have it initialise the
MPI environment from there. Can anyone tell me what setup I need to do
that?

Thanks in advance,

Damien