From 22acad7c5c9a8693eb591d3a71ddea680f525208 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Tue, 26 Oct 2004 14:54:23 +0000 Subject: [PATCH] adding the routine to handle the proper disconnect of all dynamic communicators in MPI_Finalize (in cases the user did not explicitly disconnect). This commit was SVN r3338. --- src/communicator/comm_dyn.c | 37 +++++++++++++++++++++++++++++---- src/communicator/comm_init.c | 6 ++++-- src/communicator/communicator.h | 13 ++++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/src/communicator/comm_dyn.c b/src/communicator/comm_dyn.c index deef6fec23..fac088f47b 100644 --- a/src/communicator/comm_dyn.c +++ b/src/communicator/comm_dyn.c @@ -436,7 +436,8 @@ int ompi_comm_dyn_init (void) * now we have to decrease the reference counters to the according * objects */ -/* OBJ_RELEASE(&ompi_mpi_comm_null); +/* + OBJ_RELEASE(&ompi_mpi_comm_null); OBJ_RELEASE(&ompi_mpi_group_null); OBJ_RELEASE(&ompi_mpi_group_null); OBJ_RELEASE(&ompi_mpi_errors_are_fatal); @@ -451,12 +452,40 @@ int ompi_comm_dyn_init (void) /**********************************************************************/ /* this routine runs through the list of communicators and and does the disconnect for all dynamic communicators */ -/*int ompi_comm_dyn_finalize (void) +int ompi_comm_dyn_finalize (void) { - + int i,j=0, max=0; + ompi_comm_disconnect_obj **objs=NULL; + ompi_communicator_t *comm=NULL; + if ( 1 grp_flags = 0; ompi_mpi_comm_world.c_flags = 0; OBJ_DESTRUCT( &ompi_mpi_comm_world ); @@ -203,7 +205,7 @@ int ompi_comm_finalize(void) 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); for ( i=3; i