Skip to content

Commit

Permalink
Allow mpi_init_thread to override the MPI_THREAD_LEVEL
Browse files Browse the repository at this point in the history
Signed-off-by: Austen Lauria <awlauria@us.ibm.com>
  • Loading branch information
AboorvaDevarajan authored and awlauria committed Aug 24, 2021
1 parent 12192f1 commit babfd93
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ompi/mpi/c/init_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ int MPI_Init_thread(int *argc, char ***argv, int required,
int *provided)
{
int err, safe_required = MPI_THREAD_SERIALIZED;
char *env;

ompi_hook_base_mpi_init_thread_top(argc, argv, required, provided);

Expand All @@ -56,7 +57,13 @@ int MPI_Init_thread(int *argc, char ***argv, int required,
*/
if( (MPI_THREAD_SINGLE == required) || (MPI_THREAD_SERIALIZED == required) ||
(MPI_THREAD_FUNNELED == required) || (MPI_THREAD_MULTIPLE == required) ) {
safe_required = required;

if (NULL != (env = getenv("OMPI_MPI_THREAD_LEVEL"))) {
safe_required = atoi(env);
}
else {
safe_required = required;
}
}

*provided = safe_required;
Expand Down

0 comments on commit babfd93

Please sign in to comment.