Commit 83ed8667 authored by PRUVOST Florent's avatar PRUVOST Florent
Browse files

avoid to call MPI_Finalize if MPI has been initialized by user

parent 10286ffe
......@@ -110,7 +110,7 @@ int MORSE_InitPar(int nworkers, int ncudas, int nthreads_per_worker)
return MORSE_ERR_NOT_FOUND;
}
nworkers = morse->world_size;
/* Get the size of each NUMA node */
morse->group_size = morse_get_numthreads_numa();
while ( ((morse->world_size)%(morse->group_size)) != 0 )
......@@ -121,6 +121,7 @@ int MORSE_InitPar(int nworkers, int ncudas, int nthreads_per_worker)
{
int flag = 0, provided = 0;
MPI_Initialized( &flag );
morse->mpi_outer_init = flag;
if ( !flag ) {
MPI_Init_thread( NULL, NULL, MPI_THREAD_MULTIPLE, &provided );
}
......@@ -160,7 +161,8 @@ int MORSE_Finalize(void)
morse_context_destroy();
#if defined(CHAMELEON_USE_MPI)
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize();
if (!morse->mpi_outer_init)
MPI_Finalize();
#endif
return MORSE_SUCCESS;
......
......@@ -139,7 +139,8 @@ typedef struct morse_context_s {
int nbnbsize; // tile size in elements (possibly padded)
int ibnbsize; // T or L tile size in elements (---''---)
int rhblock; // block size for tree-based (reduction) Householder
void *schedopt;
void *schedopt; // structure for runtimes
int mpi_outer_init; // MPI has been initialized outside our functions
} MORSE_context_t;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment