Skip to content

Commit 26cd0aa

Browse files
authored
Workaround for MPICH MPIX_Query_cuda_support assertion error (#4824)
For MPICH < 4, MPIX_Query_cuda_support will trigger an assertion error if its call to PMPIX_GPU_query_support returns an error code. Here, we work around it by calling MPIX_GPU_query_support directly. If it returns an error code, it is treated as not supporting CUDA. Close #4820
1 parent 0338c0f commit 26cd0aa

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Src/Base/AMReX_ParallelDescriptor.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1544,8 +1544,13 @@ Initialize ()
15441544
{
15451545
#if defined(AMREX_USE_CUDA)
15461546

1547-
#if (defined(OMPI_HAVE_MPI_EXT_CUDA) && OMPI_HAVE_MPI_EXT_CUDA) || (defined(MPICH) && defined(MPIX_GPU_SUPPORT_CUDA))
1547+
#if defined(OMPI_HAVE_MPI_EXT_CUDA) && OMPI_HAVE_MPI_EXT_CUDA
15481548
use_gpu_aware_mpi = (bool) MPIX_Query_cuda_support();
1549+
#elif defined(MPICH) && defined(MPIX_GPU_SUPPORT_CUDA)
1550+
int is_supported = 0;
1551+
if (MPIX_GPU_query_support(MPIX_GPU_SUPPORT_CUDA, &is_supported) == MPI_SUCCESS) {
1552+
use_gpu_aware_mpi = (bool) is_supported;
1553+
}
15491554
#endif
15501555

15511556
#elif defined(AMREX_USE_HIP)

0 commit comments

Comments
 (0)