1
1

adding in finalize a verification, whether we still have some communicators there...which should not happen in a correct MPI code.

This commit was SVN r2124.
Этот коммит содержится в:
Edgar Gabriel 2004-08-13 18:55:07 +00:00
родитель 8b05d713ba
Коммит 1ca0115ff7
2 изменённых файлов: 28 добавлений и 0 удалений

Просмотреть файл

@ -162,6 +162,9 @@ ompi_communicator_t *ompi_comm_allocate ( int local_size, int remote_size )
int ompi_comm_finalize(void)
{
int max, i;
ompi_communicator_t *comm;
/* Destroy all predefined communicators */
OBJ_DESTRUCT( &ompi_mpi_comm_null );
@ -173,6 +176,30 @@ int ompi_comm_finalize(void)
ompi_mpi_comm_self.c_flags = 0;
OBJ_DESTRUCT( &ompi_mpi_comm_self );
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<max; i++ ) {
comm = ompi_pointer_array_get_item(&ompi_mpi_communicators, i);
if ( NULL != comm ) {
/* Communicator has not been freed before finalize */
OBJ_RELEASE(comm);
comm=ompi_pointer_array_get_item(&ompi_mpi_communicators, i);
if ( NULL != comm ) {
/* Still here ? */
if ( ompi_debug_show_handle_leaks && !(OMPI_COMM_IS_FREED(comm)) ){
ompi_output(0,"WARNING: MPI_Comm still allocated in MPI_Finalize\n");
ompi_comm_dump ( comm);
OBJ_RELEASE(comm);
}
}
}
}
OBJ_DESTRUCT (&ompi_mpi_communicators);
return OMPI_SUCCESS;

Просмотреть файл

@ -35,6 +35,7 @@ extern ompi_class_t ompi_communicator_t_class;
#define OMPI_COMM_IS_GRAPH(comm) ((comm)->c_flags & OMPI_COMM_GRAPH)
#define OMPI_COMM_IS_INTRINSIC(comm) ((comm)->c_flags & OMPI_COMM_INTRINSIC)
#define OMPI_COMM_IS_HIDDEN(comm) ((comm)->c_flags & OMPI_COMM_HIDDEN)
#define OMPI_COMM_IS_FREED(comm) ((comm)->c_flags & OMPI_COMM_ISFREED)
#define OMPI_COMM_SET_HIDDEN(comm) ((comm)->c_flags |= OMPI_COMM_HIDDEN)