From a889629317697ccd33f4a2ce06fe555016783449 Mon Sep 17 00:00:00 2001 From: Philippe SWARTVAGHER <philippe.swartvagher@inria.fr> Date: Thu, 10 Feb 2022 17:00:10 +0100 Subject: [PATCH] Check provided MPI thread support fits requested one --- control/control.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/control/control.c b/control/control.c index 52f738517..f1688b2eb 100644 --- a/control/control.c +++ b/control/control.c @@ -96,7 +96,17 @@ int __chameleon_initpar(int ncpus, int ncudas, int nthreads_per_worker) MPI_Initialized( &flag ); chamctxt->mpi_outer_init = flag; if ( !flag ) { - MPI_Init_thread( NULL, NULL, MPI_THREAD_MULTIPLE, &provided ); + /* MPI_THREAD_SERIALIZED should be enough. + * In testings, only StarPU's internal thread performs + * communications, and *then* Chameleon performs communications in + * the check step. */ + const int required = MPI_THREAD_SERIALIZED; + if ( MPI_Init_thread( NULL, NULL, required, &provided ) != MPI_SUCCESS) { + chameleon_fatal_error("CHAMELEON_Init", "MPI_Init_thread() failed"); + } + if ( provided < required ) { + chameleon_fatal_error("CHAMELEON_Init", "MPI_Init_thread() was not able to provide the requested thread support"); + } } } # endif -- GitLab