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 aaabe3f
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 5 deletions.
4 changes: 4 additions & 0 deletions examples/ph5_subfiling.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,11 @@ 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
17 changes: 15 additions & 2 deletions src/H5FDsubfiling/H5FDioc.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,17 @@ 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 +256,15 @@ 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
17 changes: 15 additions & 2 deletions src/H5FDsubfiling/H5FDsubfiling.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,17 @@ 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 +330,15 @@ 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
4 changes: 4 additions & 0 deletions testpar/t_subfiling_vfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2142,7 +2142,11 @@ 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
6 changes: 5 additions & 1 deletion testpar/t_vfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -5907,12 +5907,16 @@ 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 aaabe3f

Please sign in to comment.