diff --git a/src/communicator/comm_cid.c b/src/communicator/comm_cid.c index 12f4a46406..c5ddfec4e2 100644 --- a/src/communicator/comm_cid.c +++ b/src/communicator/comm_cid.c @@ -129,8 +129,9 @@ int ompi_comm_nextcid ( ompi_communicator_t* newcomm, else { ompi_pointer_array_set_item(&ompi_mpi_communicators, nextlocal_cid, NULL); + nextlocal_cid = nextcid; flag = ompi_pointer_array_test_and_set_item(&ompi_mpi_communicators, - nextcid, comm ); + nextlocal_cid, comm ); if (true == flag) { response = 1; /* works as well */ } @@ -142,10 +143,16 @@ int ompi_comm_nextcid ( ompi_communicator_t* newcomm, (allredfnct)(&response, &glresponse, 1, MPI_MIN, comm, bridgecomm, local_leader, remote_leader, send_first ); - if (glresponse == 1) { + if (1 == glresponse) { done = 1; /* we are done */ break; } + else if ( 0 == glresponse ) { + /* we could use that, but other don't agree */ + ompi_pointer_array_set_item(&ompi_mpi_communicators, + nextlocal_cid, NULL); + start = nextcid+1; + } } /* set the according values to the newcomm */ diff --git a/src/communicator/comm_init.c b/src/communicator/comm_init.c index a4103ba87a..5625d5f26e 100644 --- a/src/communicator/comm_init.c +++ b/src/communicator/comm_init.c @@ -177,9 +177,14 @@ int ompi_comm_finalize(void) ompi_mpi_comm_self.c_flags = 0; OBJ_DESTRUCT( &ompi_mpi_comm_self ); + ompi_mpi_comm_parent->c_local_group->grp_flags = 0; + ompi_mpi_comm_parent->c_flags = 0; + OBJ_RETAIN (&ompi_mpi_comm_parent); + ompi_mpi_comm_null.c_local_group->grp_flags = 0; ompi_mpi_comm_null.c_flags = 0; OBJ_DESTRUCT( &ompi_mpi_comm_null ); + /* Check whether we have some communicators left */ max = ompi_pointer_array_get_size(&ompi_mpi_communicators); @@ -285,12 +290,12 @@ static void ompi_comm_destruct(ompi_communicator_t* comm) } - if (NULL != comm->c_local_group) { - OBJ_RELEASE ( comm->c_local_group ); - } if (NULL != comm->c_remote_group) { OBJ_RELEASE ( comm->c_remote_group ); } + if (NULL != comm->c_local_group) { + OBJ_RELEASE ( comm->c_local_group ); + } if (NULL != comm->error_handler) { OBJ_RELEASE ( comm->error_handler ); }