Skip to content

Commit

Permalink
Separate ESMF_COMM and MPITYPE
Browse files Browse the repository at this point in the history
  • Loading branch information
DusanJovic-NOAA committed Aug 13, 2024
1 parent dd179cc commit 113c602
Showing 1 changed file with 28 additions and 11 deletions.
39 changes: 28 additions & 11 deletions libs/ufslibs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,30 +242,30 @@ else()
message(FATAL_ERROR "Unsupported compiler ${CMAKE_C_COMPILER_ID}")
endif()

if(NOT MPITYPE)
if(NOT ESMF_COMM)
if(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*CRAY MPICH.*" AND MPI_C_VERSION_MAJOR MATCHES "3")
set(MPITYPE "mpi")
set(ESMF_COMM "mpi")
elseif(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*MPICH.*" AND MPI_C_VERSION_MAJOR MATCHES "3")
set(MPITYPE "mpich")
set(ESMF_COMM "mpich")
elseif(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*MPICH.*" AND MPI_C_VERSION_MAJOR MATCHES "4")
set(MPITYPE "mpich")
set(ESMF_COMM "mpich")
elseif(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*Open MPI.*" AND MPI_C_VERSION_MAJOR MATCHES "3")
set(MPITYPE "openmpi")
set(ESMF_COMM "openmpi")
elseif(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*HPE MPT.*" AND MPI_C_VERSION_MAJOR MATCHES "3")
set(MPITYPE "mpt")
set(ESMF_COMM "mpt")
elseif(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*Intel.*" AND MPI_C_VERSION_MAJOR MATCHES "3")
set(MPITYPE "intelmpi")
set(ESMF_COMM "intelmpi")
elseif(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*MVAPICH2.*" AND MPI_C_VERSION_MAJOR MATCHES "3")
set(MPITYPE "mvapich2")
set(ESMF_COMM "mvapich2")
else()
message(STATUS "MPI_C_LIBRARY_VERSION_STRING = '${MPI_C_LIBRARY_VERSION_STRING}'")
message(STATUS "MPI_C_VERSION_MAJOR = '${MPI_C_VERSION_MAJOR}'")
message(FATAL_ERROR "Cannot detect MPI type for ESMF, check that it is supported and set it via -DMPITYPE=... ; valid options are: mpi, mpich3, openmpi, mpt, intelmpi, mvapich2")
endif()
endif()
message(STATUS "Set ESMF_COMM to ${MPITYPE}")
message(STATUS "Set ESMF_COMM to ${ESMF_COMM}")

list(APPEND esmf_env ESMF_COMM=${MPITYPE})
list(APPEND esmf_env ESMF_COMM=${ESMF_COMM})
list(APPEND esmf_env ESMF_BOPT=O)
# list(APPEND esmf_env ESMF_OPTLEVEL=2)
list(APPEND esmf_env ESMF_F90COMPILEOPTS=${FCFLAGS_esmf})
Expand Down Expand Up @@ -412,7 +412,24 @@ ExternalProject_Add(gftl_shared
# Must specify a value for MPI_STACK
# with cmake ... -DMPI_STACK=<mpistack>. The acceptable values are:
# intelmpi, mvapich, mpt, mpich, openmpi
message(STATUS "Set MAPL's MPI_STACK to ${MPITYPE}")
if(NOT MPITYPE)
if(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*MPICH.*")
set(MPITYPE "mpich")
elseif(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*Open MPI.*")
set(MPITYPE "openmpi")
elseif(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*HPE MPT.*")
set(MPITYPE "mpt")
elseif(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*Intel.*")
set(MPITYPE "intelmpi")
elseif(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*MVAPICH2.*")
set(MPITYPE "mvapich2")
else()
message(STATUS "MPI_C_LIBRARY_VERSION_STRING = '${MPI_C_LIBRARY_VERSION_STRING}'")
message(STATUS "MPI_C_VERSION_MAJOR = '${MPI_C_VERSION_MAJOR}'")
message(FATAL_ERROR "Cannot detect MPI type for MAPL, check that it is supported and set it via -DMPITYPE=... ; valid options are: mpich, openmpi, mpt, intelmpi, mvapich2")
endif()
endif()
message(STATUS "Set MAPL MPI_STACK to ${MPITYPE}")

ExternalProject_Add(mapl
URL https://github.com/GEOS-ESM/MAPL/archive/refs/tags/v2.46.0.tar.gz
Expand Down

0 comments on commit 113c602

Please sign in to comment.