Hi Thatyene,

I took a look in your code and it seems to be logically correct. Maybe
there is some problem when you call the split function having one client
process with color = MPI_UNDEFINED. I understood you are trying to isolate
one of the client process to do something applicable only to it, am I
wrong? According to open mpi documentation, this function can be used to do
that, but it is not working. Anyone have any idea about what can be?

Best regards

Rodrigo Oliveira

On Mon, Jan 23, 2012 at 4:53 PM, Thatyene Louise Alves de Souza Ramos <
thaty...@dcc.ufmg.br> wrote:

> 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
>
> _______________________________________________
> users mailing list
> us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/users
>

Reply via email to