Skip to content

Commit

Permalink
Add API support for Fortran MPI_F08 module definitions. (#3959)
Browse files Browse the repository at this point in the history
* revert to using c-stub for _F08 MPI APIs

* use mpi compiler wrappers for cmake and nvhpc
  • Loading branch information
brtnfld authored Jan 29, 2024
1 parent 365e233 commit d79667e
Show file tree
Hide file tree
Showing 14 changed files with 649 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nvhpc-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ jobs:
echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list
sudo apt-get update -y
sudo apt-get install -y nvhpc-23-9
echo "CC=nvc" >> $GITHUB_ENV
echo "FC=nvfortran" >> $GITHUB_ENV
echo "CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/comm_libs/openmpi4/bin/mpicc" >> $GITHUB_ENV
echo "FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/comm_libs/openmpi4/bin/mpifort" >> $GITHUB_ENV
echo "NVHPCSDK=/opt/nvidia/hpc_sdk" >> $GITHUB_ENV
echo "OMPI_CXX=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc++" >> $GITHUB_ENV
echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc" >> $GITHUB_ENV
Expand Down
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,13 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for
if (MPI_Fortran_LINK_FLAGS)
set (CMAKE_Fortran_EXE_LINKER_FLAGS "${MPI_Fortran_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
endif ()
# Check if MPI-3 Fortran 2008 module mpi_f08 is supported
if (MPI_Fortran_HAVE_F08_MODULE)
set (H5_HAVE_MPI_F08 1)
message (VERBOSE "MPI-3 Fortran 2008 module mpi_f08 is supported")
else ()
message (VERBOSE "MPI-3 Fortran 2008 module mpi_f08 is NOT supported")
endif ()
endif ()

#option (HDF5_INSTALL_MOD_FORTRAN "Copy FORTRAN mod files to include directory (NO SHARED STATIC)" "NO")
Expand Down
3 changes: 3 additions & 0 deletions config/cmake/H5pubconf.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@
/* Define if we have parallel support */
#cmakedefine H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@

/* Define if MPI Fortran supports mpi_f08 module */
#cmakedefine H5_HAVE_MPI_F08 @H5_HAVE_MPI_F08@

/* Define if we have support for writing to filtered datasets in parallel */
#cmakedefine H5_HAVE_PARALLEL_FILTERED_WRITES @H5_HAVE_PARALLEL_FILTERED_WRITES@

Expand Down
19 changes: 19 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2840,6 +2840,25 @@ if test -n "$PARALLEL"; then
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]
)

AC_LANG_PUSH([Fortran])
AC_MSG_CHECKING([for MPI-3 module mpi_f08])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([],
[
USE mpi_f08
IMPLICIT NONE
TYPE(MPI_Comm) :: comm
TYPE(MPI_INFO) :: info
]
)
],
[AC_DEFINE([HAVE_MPI_F08], [1],
[Define if mpi_f08 module exist])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]
)
AC_LANG_POP(Fortran)
fi

## ----------------------------------------------------------------------
Expand Down
7 changes: 7 additions & 0 deletions fortran/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ if (WIN32)
endif ()
endif ()

if (H5_HAVE_MPI_F08) # MPI-3 module mpi_f08 supported
set (CMAKE_H5_HAVE_MPI_F08 1)
else ()
set (H5_NOMPI_F08 ";")
set (CMAKE_H5_HAVE_MPI_F08 0)
endif ()

# configure for Fortran preprocessor

# Define Parallel variable for passing to H5config_f.inc.cmake
Expand Down
Loading

0 comments on commit d79667e

Please sign in to comment.