Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: [OMPI users] MPI_Comm_split and intercommunicator - Problem
From: Thatyene Louise Alves de Souza Ramos (thatyene_at_[hidden])
Date: 2012-01-23 13:53:14


Hi there!

I've been trying to use the MPI_Comm_split function on an
intercommunicator, but I didn't have success. My application is very simple
and consists of a server that spawns 2 clients. After that, I want to split
the intercommunicator between the server and the clients so that one client
stay not connected with the server.

The processes block in the split call and do not return. Can anyone help me?

== Simplified server code ==

int main( int argc, char *argv[] ) {

MPI::Intracomm spawn_communicator = MPI::COMM_SELF;
MPI::Intercomm group1;

MPI::Init(argc, argv);
group1 = spawn_client ( /* spawns 2 processes and returns the
intercommunicator with them */ );
 /* Tryes to split the intercommunicator */
int color = 0;
 MPI::Intercomm new_G1 = group1.Split(color, 0);
group1.Free();
group1 = new_G1;

cout << "server after splitting- size G1 = " << group1.Get_remote_size() <<
endl << endl;
MPI::Finalize();
 return 0;
}

== Simplified client code ==

int main( int argc, char *argv[] ) {

 MPI::Intracomm group_communicator;
MPI::Intercomm parent;
int group_rank;
 MPI::Init(argc, argv);
 parent = MPI::Comm::Get_parent ();
group_communicator = MPI::COMM_WORLD;
group_rank = group_communicator.Get_rank();
 if (group_rank == 0) {
color = 0;
 }
else {
color = MPI_UNDEFINED;
 }
 MPI::Intercomm new_parent = parent.Split(color, inter_rank);
 if (new_parent != MPI::COMM_NULL) {
parent.Free();
parent = new_parent;
 }
 group_communicator.Free();
 parent.Free();
MPI::Finalize();
return 0;
}

Thanks in advance.

Thatyene Ramos