Thanks Federico,
It worked fine.But I have small issue.Following code demonstrates how I use mpi::intercommunicator.But in the spawned child processes, the intercommunicator size is same as number of spawned processes.But it should be 1 ,right?
Because,I execute the manager process (manager.cpp) as "mpirun -np 1 manager" .So there should be only one process.

thanks in advance

manager.cpp (manager process which spawns child processes) - rank 0

int main(int argc,char *argv[]) {
 mpi::environment evn(argc,argv);
 mpi::communicator world;
 MPI_Comm everyone;

//spawn 5 child processes.
MPI_Comm_spawn("./worker", MPI_ARGV_NULL, 5,
                 MPI_INFO_NULL, 0, MPI_COMM_SELF, &everyone,

 intercommunicator intcomm(everyone,comm_duplicate);

   GPSPosition *obj=new GPSPosition(100,200,300);
   shared_ptr<Position> pos(new Position);
    return 0;

worker.cpp (child process)- rank 0-4

int main(int argc,char *argv[]) {
    mpi::environment evn(argc,argv);
    MPI_Comm parent;

    intercommunicator incomm(parent,comm_duplicate);
   communicator world;
        cout << "Intercommunicator is Null !"<<endl;
      int size=incomm.size() ; //Size should be 1 but gives 5 ???
      int worldsize=world.size(); //Size 5
      int r=incomm.rank();
      cout <<"Rank !"<<r<< endl; //get 0-4
            //try receiving data send from manager process
  return 0;

Federico Golfrè Andreasi wrote:
Look at
to have a Boost wrapper for an Intercommunicator.


2009/8/28 Ashika Umanga Umagiliya <>
Greetings all,

I wanted to send come complex user defined types between MPI processes and found out that Boost.MPI is  quite easy to use for my requirement.So far it worked well and I received my object model in every process without problems.
Now I am going to spawn processes (using MPI_Comm_spawn, because Boot.MPI doesn't have such a function) and then use Boost.MPI to send the objects across newly created child processes.
Is there any issues with this procedure?
And Boost.MPI says it only support OpenMPI 1.0.x (
Will there be any version incompatibilities ?

thanks in advance,

users mailing list

_______________________________________________ users mailing list