diff --git a/packages/access-cice/package.py b/packages/access-cice/package.py new file mode 100755 index 00000000..12b1b0e0 --- /dev/null +++ b/packages/access-cice/package.py @@ -0,0 +1,50 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class AccessCice(CMakePackage): + """CICE is a computationally efficient model for simulating the growth, + melting, and movement of polar sea ice. CICE is maintained and developed by + the CICE-Consortium. This package builds using the Access3Share common + libraries for ACCESS3 models.""" + + homepage = "https://github.com/CICE-Consortium/CICE" + git = "https://github.com/ACCESS-NRI/CICE" + submodules = True + maintainers("anton-seaice", "harshula") + + # see license file at https://github.com/CICE-Consortium/CICE + license("LicenseRef-CICE", checked_by="anton-seaice") + + variant("openmp", default=False, description="Enable OpenMP") + variant( + "access3", + default=True, + description="Install CICE as library for Access3 models" + ) + + variant("io_type", + default="NetCDF", + values=("NetCDF", "PIO", "Binary"), + description="CICE IO Method" + ) + + depends_on("access3-share", when="+access3") + depends_on("cmake@3.18:", type="build") + depends_on("mpi") + depends_on("netcdf-fortran@4.6.0:", when="io_type=NetCDF") + depends_on("parallelio@2.5.3:", when="io_type=PIO") + + root_cmakelists_dir = "configuration/scripts/cmake" + + def cmake_args(self): + args = [ + self.define_from_variant("CICE_OPENMP", "openmp"), + self.define_from_variant("CICE_IO", "io_type"), + self.define_from_variant("CICE_ACCESS3", "access3"), + ] + + return args diff --git a/packages/access-mom6/package.py b/packages/access-mom6/package.py new file mode 100755 index 00000000..5f8ffeee --- /dev/null +++ b/packages/access-mom6/package.py @@ -0,0 +1,48 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class AccessMom6(CMakePackage): + """The Modular Ocean Model (MOM) describes the numerical ocean models + originating from NOAA/GFDL. They are used to simulate ocean currents at both + regional and global scales, enabling scientists to answer fundamental + questions about the role of the ocean in the dynamics of the global climate. + This package builds using the Access3Share common libraries for ACCESS3 + models.""" + + homepage = "https://github.com/ACCESS-NRI/MOM6" + git = "https://github.com/ACCESS-NRI/MOM6.git" + submodules = True + maintainers("minghangli-uni", "harshula") + + # see license file in https://github.com/ACCESS-NRI/MOM6/blob/e92c971084e185cfd3902f18072320b45d583a54/LICENSE.md + license("LGPL-3.0-only", checked_by="minghangli-uni") + + variant("openmp", default=False, description="Enable OpenMP") + variant("asymmetric_mem", default=False, description="Use asymmetric memory in MOM6") + variant( + "access3", + default=True, + description="Install MOM6 as library for Access3 models" + ) + + depends_on("access3-share", when="+access3") + depends_on("cmake@3.18:", type="build") + depends_on("mpi") + depends_on("netcdf-fortran@4.6.0:") + depends_on("fms@2023.02: precision=64 +large_file ~gfs_phys ~quad_precision") + depends_on("fms +openmp", when="+openmp") + depends_on("fms ~openmp", when="~openmp") + + + def cmake_args(self): + args = [ + self.define_from_variant("MOM6_OPENMP", "openmp"), + self.define_from_variant("MOM6_ASYMMETRIC", "asymmetric_mem"), + self.define_from_variant("MOM6_ACCESS3", "access3"), + ] + + return args diff --git a/packages/access-om3-nuopc/package.py b/packages/access-om3-nuopc/package.py index c1c9e89b..911c2a9d 100644 --- a/packages/access-om3-nuopc/package.py +++ b/packages/access-om3-nuopc/package.py @@ -1,5 +1,4 @@ -# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. +# Copyright Spack Project Developers. See COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) @@ -47,7 +46,7 @@ class AccessOm3Nuopc(CMakePackage): "cice_io", default="PIO", description="CICE IO option", - values=("NectCDF", "PIO", "Binary"), + values=("NetCDF", "PIO", "Binary"), multi=False, ) diff --git a/packages/access-om3/package.py b/packages/access-om3/package.py index 9ed8316b..443d712f 100644 --- a/packages/access-om3/package.py +++ b/packages/access-om3/package.py @@ -1,7 +1,4 @@ -# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# Copyright 2024 ACCESS-NRI +# Copyright Spack Project Developers. See COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) @@ -25,4 +22,4 @@ class AccessOm3(BundlePackage): version("latest") - depends_on("access-om3-nuopc") + depends_on("access3") \ No newline at end of file diff --git a/packages/access-ww3/package.py b/packages/access-ww3/package.py new file mode 100755 index 00000000..74d09057 --- /dev/null +++ b/packages/access-ww3/package.py @@ -0,0 +1,36 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + +class AccessWw3(CMakePackage): + """WAVEWATCH IIIĀ® is a community wave modeling framework that includes the + latest scientific advancements in the field of wind-wave modeling and + dynamics. This package builds using the Access3Share common libraries for + ACCESS3 models.""" + + homepage = "https://github.com/noaa-emc/ww3/" + git = "https://github.com/ACCESS-NRI/WW3" + maintainers("anton-seaice", "harshula") + license("LGPL-3.0-only", checked_by="anton-seaice") + + variant("openmp", default=False, description="Enable OpenMP") + variant( + "access3", + default=True, + description="Install WW3 as library for Access3 models" + ) + + depends_on("access3-share", when="+access3") + depends_on("cmake@3.18:", type="build") + depends_on("mpi") + depends_on("netcdf-fortran@4.6.0:") + + def cmake_args(self): + args = [ + self.define_from_variant("WW3_OPENMP", "openmp"), + self.define_from_variant("WW3_ACCESS3", "access3"), + ] + + return args \ No newline at end of file diff --git a/packages/access3-share/package.py b/packages/access3-share/package.py new file mode 100755 index 00000000..01fe4163 --- /dev/null +++ b/packages/access3-share/package.py @@ -0,0 +1,42 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class Access3Share(CMakePackage): + """Shared coupler/mediator libraries used by the ACCESS version 3 climate + models. This package includes the Community Mediator for Earth Prediction + Systems (CMEPS) and Community Data models for Earth Prediction Systems + (CDEPS) as used in ACCESS-OM3 (and the future ACCESS-CM3 and ACCESS-ESM3 etc + ). See Access3 package to produce executable programs.""" + + homepage = "https://github.com/ACCESS-NRI/access3-share" + git = "https://github.com/ACCESS-NRI/access3-share" + submodules = True + maintainers("anton-seaice", "harshula", "micaeljtoliveira") + license("Apache-2.0", checked_by="anton-seaice") + + variant("openmp", default=False, description="Enable OpenMP") + + depends_on("cmake@3.18:", type="build") + depends_on("mpi") + depends_on("netcdf-fortran@4.6.0:") + depends_on("esmf@8.7.0:") + depends_on("esmf fflags='-fp-model precise'", when="%intel") # for consistency with access-om3-nuopc builds, e.g. https://github.com/ACCESS-NRI/spack-packages/blob/e2bdb46e56af8ac14183e7ed25da9235486c973a/packages/access-om3-nuopc/package.py#L58 + depends_on("fortranxml@4.1.2:") + + depends_on("parallelio@2.5.3:") + depends_on(("parallelio " + "fflags='-qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model precise' " + "cflags='-qno-opt-dynamic-align -fp-model precise -std=gnu99'"), + when="%intel") # consistency with access-om3-nuopc builds, e.g. https://github.com/ACCESS-NRI/spack-packages/blob/e2bdb46e56af8ac14183e7ed25da9235486c973a/packages/access-om3-nuopc/package.py#L65 + + def cmake_args(self): + args = [ + self.define("ACCESS3_LIB_INSTALL", True), + self.define_from_variant("OPENMP", "openmp"), + ] + + return args \ No newline at end of file diff --git a/packages/access3/package.py b/packages/access3/package.py new file mode 100755 index 00000000..6a1e194c --- /dev/null +++ b/packages/access3/package.py @@ -0,0 +1,72 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + +# supported model configurations +KNOWN_CONF = ( + "MOM6", + "CICE6", + "WW3", + "MOM6-WW3", + "MOM6-CICE6", + "CICE6-WW3", + "MOM6-CICE6-WW3", +) + +class Access3(CMakePackage): + """Executable build for ACCESS version 3 climate models. The exectuable is + defined in Community Mediator for Earth Prediction Systems (CMEPS). + Currently implemented for ACCESS-OM3, and in the future may support + ACCESS-CM3 and ACCESS-ESM3. This is a companion package to Access3Share + which builds the shared libraries.""" + + homepage = "https://github.com/ACCESS-NRI/access3-share" + git = "https://github.com/ACCESS-NRI/access3-share" + submodules = True + maintainers("anton-seaice", "harshula", "micaeljtoliveira") + license("Apache-2.0", checked_by="anton-seaice") + + variant( + "configurations", + values=(*KNOWN_CONF, 'none'), + default='none', + multi=True, + description=( + "ACCESS-OM3 configurations to build. When a model component " + "is not included in a configuration, that component is replaced by " + "a CDEPS data component." + ), + sticky=True # force concretizer to not pick alternative variants + ) + + # force user to supply a build combination + conflicts( + "configurations=none", + msg=f"A configurations variant must be set, can be one or many of {KNOWN_CONF}" + ) + + depends_on("cmake@3.18:", type="build") + depends_on("mpi") + depends_on("access3-share") + depends_on("esmf@8.7.0:") + + for conf in KNOWN_CONF: + if "CICE6" in conf: + depends_on("access-cice+access3", when=f"configurations={conf}") + if "MOM6" in conf: + depends_on("access-mom6+access3", when=f"configurations={conf}") + if "WW3" in conf: + depends_on("access-ww3+access3", when=f"configurations={conf}") + + def cmake_args(self): + # make configurations a cmake argument + buildConf = ";".join(self.spec.variants["configurations"].value) + + args = [ + self.define("BuildConfigurations", buildConf), + self.define("ACCESS3_LIB_INSTALL", False), + ] + + return args