Skip to content

Commit

Permalink
Subfiling VFD - add note about MPICH_MAX_THREAD_SAFETY env. var.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhendersonHDF committed Aug 31, 2023
1 parent 54d19b0 commit cd53699
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 5 deletions.
5 changes: 5 additions & 0 deletions examples/ph5_subfiling.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,12 @@ main(int argc, char **argv)
/* HDF5 Subfiling VFD requires MPI_Init_thread with MPI_THREAD_MULTIPLE */
MPI_Init_thread(&argc, &argv, mpi_thread_required, &mpi_thread_provided);
if (mpi_thread_provided < mpi_thread_required) {
#ifdef MPICH
printf("MPI_THREAD_MULTIPLE not supported. Try setting the environment variable "
"MPICH_MAX_THREAD_SAFETY=multiple\n");
#else
printf("MPI_THREAD_MULTIPLE not supported\n");
#endif
MPI_Abort(comm, -1);
}

Expand Down
20 changes: 18 additions & 2 deletions src/H5FDsubfiling/H5FDioc.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,18 @@ H5FD_ioc_init(void)
/* If MPI is initialized, validate that it was initialized with MPI_THREAD_MULTIPLE */
if (MPI_SUCCESS != (mpi_code = MPI_Query_thread(&provided)))
H5_SUBFILING_MPI_GOTO_ERROR(H5I_INVALID_HID, "MPI_Query_thread failed", mpi_code);
if (provided != MPI_THREAD_MULTIPLE)
if (provided != MPI_THREAD_MULTIPLE) {
#ifdef MPICH
H5_SUBFILING_GOTO_ERROR(
H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID,
"IOC VFD requires the use of MPI_Init_thread with MPI_THREAD_MULTIPLE. Try setting "
"the environment variable MPICH_MAX_THREAD_SAFETY=multiple");
#else
H5_SUBFILING_GOTO_ERROR(
H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID,
"IOC VFD requires the use of MPI_Init_thread with MPI_THREAD_MULTIPLE");
#endif
}
}
else {
int required = MPI_THREAD_MULTIPLE;
Expand All @@ -249,9 +257,17 @@ H5FD_ioc_init(void)

H5FD_mpi_self_initialized = TRUE;

if (provided != required)
if (provided != required) {
#ifdef MPICH
H5_SUBFILING_GOTO_ERROR(
H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID,
"MPI doesn't support MPI_Init_thread with MPI_THREAD_MULTIPLE. Try setting the "
"environment variable MPICH_MAX_THREAD_SAFETY=multiple");
#else
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID,
"MPI doesn't support MPI_Init_thread with MPI_THREAD_MULTIPLE");
#endif
}
}
}

Expand Down
19 changes: 17 additions & 2 deletions src/H5FDsubfiling/H5FDsubfiling.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,18 @@ H5FD_subfiling_init(void)
/* If MPI is initialized, validate that it was initialized with MPI_THREAD_MULTIPLE */
if (MPI_SUCCESS != (mpi_code = MPI_Query_thread(&provided)))
H5_SUBFILING_MPI_GOTO_ERROR(H5I_INVALID_HID, "MPI_Query_thread failed", mpi_code);
if (provided != MPI_THREAD_MULTIPLE)
if (provided != MPI_THREAD_MULTIPLE) {
#ifdef MPICH
H5_SUBFILING_GOTO_ERROR(
H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID,
"Subfiling VFD requires the use of MPI_Init_thread with MPI_THREAD_MULTIPLE. Try setting "
"the environment variable MPICH_MAX_THREAD_SAFETY=multiple");
#else
H5_SUBFILING_GOTO_ERROR(
H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID,
"Subfiling VFD requires the use of MPI_Init_thread with MPI_THREAD_MULTIPLE");
#endif
}
}
else {
int required = MPI_THREAD_MULTIPLE;
Expand All @@ -323,9 +331,16 @@ H5FD_subfiling_init(void)

H5FD_mpi_self_initialized = TRUE;

if (provided != required)
if (provided != required) {
#ifdef MPICH
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID,
"MPI doesn't support MPI_Init_thread with MPI_THREAD_MULTIPLE. Try "
"setting the environment variable MPICH_MAX_THREAD_SAFETY=multiple");
#else
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID,
"MPI doesn't support MPI_Init_thread with MPI_THREAD_MULTIPLE");
#endif
}

if (atexit(H5FD__subfiling_mpi_finalize) < 0)
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID,
Expand Down
5 changes: 5 additions & 0 deletions testpar/t_subfiling_vfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2142,7 +2142,12 @@ main(int argc, char **argv)

if (provided != required) {
if (MAINPROCESS)
#ifdef MPICH
printf("MPI doesn't support MPI_Init_thread with MPI_THREAD_MULTIPLE. Try setting the "
"environment variable MPICH_MAX_THREAD_SAFETY=multiple\n");
#else
printf("MPI doesn't support MPI_Init_thread with MPI_THREAD_MULTIPLE\n");
#endif
nerrors++;
goto exit;
}
Expand Down
7 changes: 6 additions & 1 deletion testpar/t_vfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -5907,12 +5907,17 @@ main(int argc, char **argv)

#ifdef H5_HAVE_SUBFILING_VFD
if (MPI_SUCCESS != MPI_Init_thread(&argc, &argv, required, &provided)) {
printf(" MPI doesn't support MPI_Init_thread with MPI_THREAD_MULTIPLE. Exiting\n");
printf(" MPI_Init_thread failed. Exiting\n");
goto finish;
}

if (provided != required) {
#ifdef MPICH
printf(" MPI doesn't support MPI_Init_thread with MPI_THREAD_MULTIPLE. Try setting the "
"environment variable MPICH_MAX_THREAD_SAFETY=multiple. Exiting\n");
#else
printf(" MPI doesn't support MPI_Init_thread with MPI_THREAD_MULTIPLE. Exiting\n");
#endif
goto finish;
}
#else
Expand Down

0 comments on commit cd53699

Please sign in to comment.