Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: Re: [OMPI users] OpenMPI 1.3.3 with Boost.MPI ?
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2009-09-02 00:07:07


On Sep 1, 2009, at 4:57 AM, Ashika Umanga Umagiliya wrote:

> 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.

I'm not familiar with the details of Boost.MPI, but when you call
MPI_COMM_SPAWN, the resulting intercommunicator will have a remote
group size of the number of processes that were spawned and the local
group size of the number of processes that invoked MPI_COMM_SPAWN.
Hence, in your case (mpirun -np 1 manager), the local group size will
be 1 and the remote group size will be 5.

> 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,
> MPI_ERRCODES_IGNORE);
>
> intercommunicator intcomm(everyone,comm_duplicate);
>
> if(rank==0){
> GPSPosition *obj=new GPSPosition(100,200,300);
> shared_ptr<Position> pos(new Position);
> pos->setVals();
> obj->addP(pos);
> intcomm.send(0,100,obj);
> }
>
> return 0;
> }

-- 
Jeff Squyres
jsquyres_at_[hidden]