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
umanga
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;
}
worker.cpp (child process)- rank 0-4
-----------------------------------------------------------------------------------
int main(int argc,char *argv[]) {
mpi::environment evn(argc,argv);
MPI_Comm parent;
MPI_Comm_get_parent(&parent);
intercommunicator incomm(parent,comm_duplicate);
communicator world;
if(parent==MPI_COMM_NULL){
cout << "Intercommunicator is Null !"<<endl;
}else{
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
if(r==1){
//try receiving data send from manager process
}
}
return 0;
}
Federico Golfrè Andreasi wrote:
Look at
http://www.boost.org/doc/libs/1_40_0/doc/html/boost/mpi/intercommunicator.html
to have a Boost wrapper for an Intercommunicator.
Federico
2009/8/28 Ashika Umanga Umagiliya <auma...@biggjapan.com
<mailto:auma...@biggjapan.com>>
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
(http://www.boost.org/doc/libs/1_40_0/doc/html/mpi/getting_started.html#mpi.mpi_impl)
Will there be any version incompatibilities ?
thanks in advance,
umanga
_______________________________________________
users mailing list
us...@open-mpi.org <mailto:us...@open-mpi.org>
http://www.open-mpi.org/mailman/listinfo.cgi/users
------------------------------------------------------------------------
_______________________________________________
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users