Skip to content

Commit

Permalink
Merge pull request #436 from GMAO-SI-Team/add-mapl-2.46
Browse files Browse the repository at this point in the history
mapl: add v2.46.1
  • Loading branch information
climbfuji authored May 23, 2024
2 parents e379fd9 + c010249 commit 9e4f6f8
Showing 1 changed file with 78 additions and 9 deletions.
87 changes: 78 additions & 9 deletions var/spack/repos/builtin/packages/mapl/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ class Mapl(CMakePackage):
version("develop", branch="develop")
version("main", branch="main")

version("2.46.1", sha256="f3090281de6293b484259d58f852c45b98759de8291d36a4950e6d348ece6573")
version("2.46.0", sha256="726d9588b724bd43e5085d1a2f8d806d548f185ed6b22a1b13c0ed06212d7be2")
# NOTE: Due to issues with CMake and ESMF, versions 2.44 and 2.45 of MAPL were not
# correctly installable with spack. The versions are still available in the
# repository, but we are skipping them in spack. There are references to these
# versions below in case a 2.44 or 2.45 spack-compatible version is needed
# and changes backported.
version("2.43.2", sha256="966130931153a9a3974ad6ae011d1df194e057cb82301c8703ef69669b9f27ba")
version("2.43.1", sha256="62b7a8c438c960e47b83d9835cb37c7ce25f617d648f2affe9961b4a6e638abc")
version("2.43.0", sha256="1be99d64ca46001ac94f7db3607c345e144976dc34fe184e734e212bf3955d01")
version("2.42.4", sha256="f6b643cc45f2dc55df96a316c84d84ace341bb6e06f81f83b5de258d9978b3d4")
version("2.42.3", sha256="4ccac684dcbbca36cd7b30cb1515b52f05d7c06ca93399e60ccf42726d147018")
Expand Down Expand Up @@ -128,17 +137,29 @@ class Mapl(CMakePackage):

# Versions later than 3.14 remove FindESMF.cmake
# from ESMA_CMake.
resource(
name="esma_cmake",
git="https://github.com/GEOS-ESM/ESMA_cmake.git",
tag="v3.45.2",
when="@2.45:",
)
resource(
name="esma_cmake",
git="https://github.com/GEOS-ESM/ESMA_cmake.git",
tag="v3.40.0",
when="@2.44",
)
resource(
name="esma_cmake",
git="https://github.com/GEOS-ESM/ESMA_cmake.git",
tag="v3.36.0",
when="@2.42.0:",
when="@2.42.0:2.43",
)
resource(
name="esma_cmake",
git="https://github.com/GEOS-ESM/ESMA_cmake.git",
tag="v3.31.0",
when="@2.40.0:",
when="@2.40.0:2.41",
)
resource(
name="esma_cmake",
Expand Down Expand Up @@ -183,6 +204,10 @@ class Mapl(CMakePackage):
conflicts("mpich@:3")
conflicts("mpich@4", when="@:2.41")

# MAPL only supports gcc 13 from MAPL 2.45 onwards, so we only allow
# builds with gcc 13 from that version onwards
conflicts("%gcc@13:", when="@:2.44")

variant("flap", default=False, description="Build with FLAP support", when="@:2.39")
variant("pflogger", default=True, description="Build with pFlogger support")
variant("fargparse", default=True, description="Build with fArgParse support")
Expand All @@ -208,19 +233,25 @@ class Mapl(CMakePackage):
depends_on("hdf5")
depends_on("netcdf-c")
depends_on("netcdf-fortran")
depends_on("[email protected]:", when="@2.40:")
depends_on("[email protected]:", when="@2.45:")
depends_on("[email protected]", when="@2.44")
depends_on("[email protected]:", when="@2.40:2.43")
depends_on("[email protected]", when="@2.34:2.39")
depends_on("[email protected]", when="@2.22:2.33")
depends_on("esmf", when="@:2.12.99")
depends_on("esmf~debug", when="~debug")
depends_on("esmf+debug", when="+debug")

depends_on("[email protected]:", when="@2.40:")
depends_on("[email protected]:", when="@2.45:")
depends_on("[email protected]:", when="@2.44")
depends_on("[email protected]:", when="@2.40:2.43")
depends_on("[email protected]:1.9", when="@:2.39")

# There was an interface change in gftl-shared, so we need to control versions
# MAPL 2.39 and older can use up to 1.6.0 but MAPL 2.40+ needs 1.6.1 or higher
depends_on("[email protected]:", when="@2.40:")
depends_on("[email protected]:", when="@2.45:")
depends_on("[email protected]:", when="@2.44")
depends_on("[email protected]:", when="@2.40:2.43")
depends_on("[email protected]:1.6.0", when="@:2.39")

# There was an interface change in yaFyaml, so we need to control versions
Expand All @@ -234,14 +265,23 @@ class Mapl(CMakePackage):
# yaFyaml so we need to use old pFlogger, but MAPL 2.23+ uses new yaFyaml
depends_on("pflogger@:1.6 +mpi", when="@:2.22+pflogger")
depends_on("[email protected]: +mpi", when="@2.23:2.39+pflogger")
depends_on("[email protected]: +mpi", when="@2.40:+pflogger")
depends_on("[email protected]: +mpi", when="@2.40:2.43+pflogger")
depends_on("[email protected]: +mpi", when="@2.44+pflogger")
depends_on("[email protected]: +mpi", when="@2.45:+pflogger")

# fArgParse v1.4.1 is the first usable version with MAPL
# we now require 1.5.0 with MAPL 2.40+
depends_on("[email protected]:", when="@2.40:+fargparse")
depends_on("[email protected]:", when="@2.45:+fargparse")
depends_on("[email protected]:", when="@2.44+fargparse")
depends_on("[email protected]:", when="@2.40:43+fargparse")
depends_on("[email protected]:1.4", when="@:2.39+fargparse")

depends_on("[email protected]: +mpi +fhamcrest", when="+pfunit")
depends_on("[email protected]: +mpi +fhamcrest", when="@2.45:+pfunit")
depends_on("[email protected]: +mpi +fhamcrest", when="@2.44+pfunit")
depends_on("[email protected]: +mpi +fhamcrest", when="@2.40:+pfunit")
depends_on("[email protected]: +mpi +fhamcrest", when="@2.32:+pfunit")
depends_on("[email protected]: +mpi +fhamcrest", when="@2.26:+pfunit")
depends_on("[email protected]: +mpi +fhamcrest", when="@:2.25+pfunit")
depends_on("flap", when="+flap")

depends_on("ecbuild", type="build")
Expand All @@ -255,14 +295,18 @@ class Mapl(CMakePackage):

def cmake_args(self):
args = [
self.define_from_variant("BUILD_WITH_FLAP", "flap"),
self.define_from_variant("BUILD_WITH_PFLOGGER", "pflogger"),
self.define_from_variant("BUILD_WITH_FARGPARSE", "fargparse"),
self.define_from_variant("BUILD_SHARED_MAPL", "shared"),
self.define_from_variant("USE_EXTDATA2G", "extdata2g"),
self.define_from_variant("USE_F2PY", "f2py"),
]

# We only want to add BUILD_WITH_FLAP if we are @:2.39 otherwise
# there is a weird empty string that gets added to the CMake command
if self.spec.satisfies("@:2.39"):
args.append(self.define("BUILD_WITH_FLAP", self.spec.satisfies("+flap")))

if self.spec.satisfies("@2.22.0:"):
args.append(self.define("CMAKE_MODULE_PATH", self.spec["esmf"].prefix.cmake))

Expand All @@ -281,6 +325,31 @@ def cmake_args(self):
if fflags:
args.append(self.define("CMAKE_Fortran_FLAGS", " ".join(fflags)))

# Scripts often need to know the MPI stack used to setup the environment.
# Normally, we can autodetect this, but building with Spack does not
# seem to work. We need to pass in the MPI stack used to CMake
# via -DMPI_STACK on the CMake command line. We use the following
# names for the MPI stacks:
#
# - MPICH --> mpich
# - Open MPI --> openmpi
# - Intel MPI --> intelmpi
# - MVAPICH --> mvapich
# - HPE MPT --> mpt

if self.spec.satisfies("^mpich"):
args.append(self.define("MPI_STACK", "mpich"))
elif self.spec.satisfies("^openmpi"):
args.append(self.define("MPI_STACK", "openmpi"))
elif self.spec.satisfies("^intel-oneapi-mpi"):
args.append(self.define("MPI_STACK", "intelmpi"))
elif self.spec.satisfies("^mvapich"):
args.append(self.define("MPI_STACK", "mvapich"))
elif self.spec.satisfies("^mpt"):
args.append(self.define("MPI_STACK", "mpt"))
else:
raise InstallError("Unsupported MPI stack")

return args

def patch(self):
Expand Down

0 comments on commit 9e4f6f8

Please sign in to comment.