Merge pull request #7323 from bosilca/fix/7320
Trap wrong parameters to MPI_Init_thread.
Этот коммит содержится в:
Коммит
af1ec9a594
@ -61,7 +61,7 @@ void ompi_mpi_errors_are_fatal_comm_handler(struct ompi_communicator_t **comm,
|
||||
|
||||
va_start(arglist, error_code);
|
||||
|
||||
if (NULL != comm) {
|
||||
if ( (NULL != comm) && (NULL != *comm) ) {
|
||||
name = (*comm)->c_name;
|
||||
abort_comm = *comm;
|
||||
} else {
|
||||
|
@ -47,26 +47,36 @@ static const char FUNC_NAME[] = "MPI_Init_thread";
|
||||
int MPI_Init_thread(int *argc, char ***argv, int required,
|
||||
int *provided)
|
||||
{
|
||||
int err;
|
||||
int err, safe_required = MPI_THREAD_SERIALIZED;
|
||||
|
||||
ompi_hook_base_mpi_init_thread_top(argc, argv, required, provided);
|
||||
|
||||
if ( MPI_PARAM_CHECK ) {
|
||||
if (required < MPI_THREAD_SINGLE || required > MPI_THREAD_MULTIPLE) {
|
||||
ompi_mpi_errors_are_fatal_comm_handler(NULL, NULL, FUNC_NAME);
|
||||
}
|
||||
/* Detect an incorrect thread support level, but dont report until we have the minimum
|
||||
* infrastructure setup.
|
||||
*/
|
||||
if( (MPI_THREAD_SINGLE == required) || (MPI_THREAD_SERIALIZED == required) ||
|
||||
(MPI_THREAD_FUNNELED == required) || (MPI_THREAD_MULTIPLE == required) ) {
|
||||
safe_required = required;
|
||||
}
|
||||
|
||||
*provided = required;
|
||||
*provided = safe_required;
|
||||
|
||||
/* Call the back-end initialization function (we need to put as
|
||||
little in this function as possible so that if it's profiled, we
|
||||
don't lose anything) */
|
||||
|
||||
if (NULL != argc && NULL != argv) {
|
||||
err = ompi_mpi_init(*argc, *argv, required, provided, false);
|
||||
err = ompi_mpi_init(*argc, *argv, safe_required, provided, false);
|
||||
} else {
|
||||
err = ompi_mpi_init(0, NULL, required, provided, false);
|
||||
err = ompi_mpi_init(0, NULL, safe_required, provided, false);
|
||||
}
|
||||
|
||||
if( safe_required != required ) {
|
||||
/* Trigger the error handler for the incorrect argument. Keep it separate from the
|
||||
* check on the ompi_mpi_init return and report a nice, meaningful error message to
|
||||
* the user. */
|
||||
return ompi_errhandler_invoke((ompi_errhandler_t*)&ompi_mpi_errors_are_fatal, NULL, OMPI_ERRHANDLER_TYPE_COMM,
|
||||
MPI_ERR_ARG, FUNC_NAME);
|
||||
}
|
||||
|
||||
/* Since we don't have a communicator to invoke an errorhandler on
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user