diff --git a/var/spack/repos/builtin/packages/mapl/package.py b/var/spack/repos/builtin/packages/mapl/package.py index b4d1a970032f8b..eaae13e52f3e8e 100644 --- a/var/spack/repos/builtin/packages/mapl/package.py +++ b/var/spack/repos/builtin/packages/mapl/package.py @@ -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") @@ -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", @@ -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") @@ -208,19 +233,25 @@ class Mapl(CMakePackage): depends_on("hdf5") depends_on("netcdf-c") depends_on("netcdf-fortran") - depends_on("esmf@8.5:", when="@2.40:") + depends_on("esmf@8.6.1:", when="@2.45:") + depends_on("esmf@8.6.0", when="@2.44") + depends_on("esmf@8.5:", when="@2.40:2.43") depends_on("esmf@8.4", when="@2.34:2.39") depends_on("esmf@8.3", 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("gftl@1.10.0:", when="@2.40:") + depends_on("gftl@1.13.0:", when="@2.45:") + depends_on("gftl@1.11.0:", when="@2.44") + depends_on("gftl@1.10.0:", when="@2.40:2.43") depends_on("gftl@1.5.5: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("gftl-shared@1.6.1:", when="@2.40:") + depends_on("gftl-shared@1.8.0:", when="@2.45:") + depends_on("gftl-shared@1.7.0:", when="@2.44") + depends_on("gftl-shared@1.6.1:", when="@2.40:2.43") depends_on("gftl-shared@1.3.1:1.6.0", when="@:2.39") # There was an interface change in yaFyaml, so we need to control versions @@ -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("pflogger@1.9.1: +mpi", when="@2.23:2.39+pflogger") - depends_on("pflogger@1.9.5: +mpi", when="@2.40:+pflogger") + depends_on("pflogger@1.9.5: +mpi", when="@2.40:2.43+pflogger") + depends_on("pflogger@1.11.0: +mpi", when="@2.44+pflogger") + depends_on("pflogger@1.14.0: +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("fargparse@1.5.0:", when="@2.40:+fargparse") + depends_on("fargparse@1.7.0:", when="@2.45:+fargparse") + depends_on("fargparse@1.6.0:", when="@2.44+fargparse") + depends_on("fargparse@1.5.0:", when="@2.40:43+fargparse") depends_on("fargparse@1.4.1:1.4", when="@:2.39+fargparse") - depends_on("pfunit@4.2: +mpi +fhamcrest", when="+pfunit") + depends_on("pfunit@4.9: +mpi +fhamcrest", when="@2.45:+pfunit") + depends_on("pfunit@4.8: +mpi +fhamcrest", when="@2.44+pfunit") + depends_on("pfunit@4.7.3: +mpi +fhamcrest", when="@2.40:+pfunit") + depends_on("pfunit@4.6.1: +mpi +fhamcrest", when="@2.32:+pfunit") + depends_on("pfunit@4.4.1: +mpi +fhamcrest", when="@2.26:+pfunit") + depends_on("pfunit@4.2: +mpi +fhamcrest", when="@:2.25+pfunit") depends_on("flap", when="+flap") depends_on("ecbuild", type="build") @@ -255,7 +295,6 @@ 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"), @@ -263,6 +302,11 @@ def cmake_args(self): 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)) @@ -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):