|
Boost Users : |
Subject: [Boost-users] [ Boost.MPI ] : Spawning processes, Intercommunicators and send custom data-types ?
From: Ashika Umanga Umagiliya (aumanga_at_[hidden])
Date: 2009-08-31 02:48:33
Greetings all,
I use OpenMPI 1.3.3 and I tried to spawn child processes (using
MPI_Comm_spawn) and send user-defined-datatypes across processes.The
child processes should be ranked from 1-5 while the rank 0 is the
manager processes (manager.cpp) .
But I get rank 0 for manager process and the child processes also ranked
starting from 0 (0-4) . So I cannot send data from manager process to
first child processes (which suppose to be rank 1)
Please give any suggestion to resolve this.
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)- should be ranked 1-5 ,but get 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);
if(parent==MPI_COMM_NULL){
cout << "Intercommunicator is Null !"<<endl;
}else{
int r=incomm.rank();
cout <<"Rank !"<<r<< endl; //get 0-4
if(r==1){
//try receiving data send from manager process
}
}
return 0;
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net