Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into cice5_esm1p6
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-seaice committed Dec 12, 2024
2 parents b932254 + cdd87af commit 473eeee
Show file tree
Hide file tree
Showing 16 changed files with 806 additions and 109 deletions.
46 changes: 40 additions & 6 deletions packages/access-esm1p6/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from spack.package import *

class AccessEsm1p6(BundlePackage):
"""ACCESS-ESM1.6 bundle contains the coupled UM7, CICE4 and MOM5 models.
"""ACCESS-ESM1.6 bundle contains the coupled UM7, CICE4/CICE5 and MOM5
models.
ACCESS-ESM1.6 comprises of:
Expand All @@ -17,21 +18,54 @@ class AccessEsm1p6(BundlePackage):
* The CABLE land surface model with biogeochemistry (CASA-CNP) (CABLE2.4)
* The GFDL MOM5 ocean model at 1 degree resolution
* The WOMBATlite ocean BGC model (generic tracer version)
* The LANL CICE4.1 sea ice model (version as ACCESS1.4)
* The LANL CICE4.1 sea ice model (version as ACCESS1.4). CICE5 for testing.
* The OASIS-MCT coupler
"""

homepage = "https://www.access-nri.org.au"

git = "https://github.com/ACCESS-NRI/ACCESS-ESM1.6.git"

maintainers("dougiesquire")
maintainers("dougiesquire", "harshula")

version("latest")

depends_on("[email protected]", type="run")
depends_on("[email protected] type=ACCESS-ESM", type="run")
variant(
"cice",
default="4",
description="Choose the version of the CICE sea-ice model.",
values=("4", "5"),
multi=False,
)
variant(
"generic-tracers",
default=True,
description="Enable generic tracers.",
)
variant(
"um",
default="access-esm1.6",
description="Choose the branch of um7.",
values=("access-esm1.5", "access-esm1.6"),
multi=False,
)

depends_on("[email protected]", type="run", when="cice=4")
depends_on("[email protected]", type="run", when="cice=5")
# TODO: Use the access-esm1.6 branch when it has been confirmed that
# MOM5 master supports building with generic tracers disabled.
depends_on(
"[email protected] type=ACCESS-CM",
type="run",
when="~generic-tracers",
)
depends_on(
"[email protected] type=ACCESS-ESM",
type="run",
when="+generic-tracers",
)
# um7 is in a private repository
depends_on("[email protected]", type="run")
depends_on("[email protected]", type="run", when="um=access-esm1.5")
depends_on("[email protected]", type="run", when="um=access-esm1.6")

# There is no need for install() since there is no code.
63 changes: 63 additions & 0 deletions packages/access-fms/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# Copyright 2024 ACCESS-NRI
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack.package import find_headers, find_libraries

# Based on upstream $spack/var/spack/repos/builtin/packages/fms/package.py
class AccessFms(CMakePackage):
"""GFDL's Flexible Modeling System (FMS) is a software environment
that supports the efficient development, construction, execution,
and scientific interpretation of atmospheric, oceanic, and climate
system models. This is ACCESS-NRI's fork."""

homepage = "https://github.com/ACCESS-NRI/FMS"
git = "https://github.com/ACCESS-NRI/FMS.git"

license("LGPL-3.0-or-later")

maintainers("harshula")

version("master", branch="master")
# TODO: Needs to be changed once changes to build system enter master.
version("development", branch="development", preferred=True)

variant("gfs_phys", default=True, description="Use GFS Physics")
variant("large_file", default=False, description="Enable compiler definition -Duse_LARGEFILE.")
variant(
"internal_file_nml",
default=True,
description="Enable compiler definition -DINTERNAL_FILE_NML.",
)

depends_on("netcdf-c")
depends_on("netcdf-fortran")
depends_on("mpi")

def url_for_version(self, version):
return "https://github.com/ACCESS-NRI/FMS/tarball/{0}".format(version)

@property
def headers(self):
return find_headers(
"*", root=self.prefix, recursive=True
)

@property
def libs(self):
libraries = ["libfms_r4", "libfms_r8"]
return find_libraries(
libraries, root=self.prefix, shared=False, recursive=True
)

def cmake_args(self):
args = [
self.define_from_variant("GFS_PHYS"),
self.define_from_variant("LARGEFILE", "large_file"),
self.define_from_variant("INTERNAL_FILE_NML"),
]

return args
38 changes: 38 additions & 0 deletions packages/access-generic-tracers/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack.package import find_libraries

class AccessGenericTracers(CMakePackage):
"""This is a fork of the NOAA-GFDL/ocean_BGC repo managed by NOAA-GFDL.
It contains a collection of tracers and associated code for use with
the MOM and GOLD ocean models. This fork includes generic tracer
implementations of the suite of WOMBAT models used in ACCESS earth-system
models."""

homepage = "https://github.com/ACCESS-NRI/GFDL-generic-tracers"
git = "https://github.com/ACCESS-NRI/GFDL-generic-tracers.git"

maintainers("harshula")

version("master", branch="master")
# TODO: Needs to be changed once changes to build system enter master.
version("development", branch="development", preferred=True)

depends_on("access-mocsy")
depends_on("access-fms")
depends_on("mpi")

def url_for_version(self, version):
return "https://github.com/ACCESS-NRI/GFDL-generic-tracers/tarball/{0}".format(version)

@property
def libs(self):
libraries = find_libraries(
"libgtracers", root=self.prefix, shared=False, recursive=True
)
# mocsy is an internal lib dependency of this static library.
# Hence we need to propagate it.
return libraries + self.spec["access-mocsy"].libs
108 changes: 108 additions & 0 deletions packages/access-mocsy/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# Copyright 2024 ACCESS-NRI
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack.package import find_libraries, install, join_path, mkdirp

# https://spack.readthedocs.io/en/latest/build_systems/makefilepackage.html
class AccessMocsy(MakefilePackage):
"""Routines to model ocean carbonate system thermodynamics. ACCESS NRI's fork."""

homepage = "https://www.access-nri.org.au"
git = "https://github.com/ACCESS-NRI/mocsy.git"

maintainers("harshula")

version("master", branch="master")
version("mom5", branch="mom5", preferred=True)

# Need: self.spec["mpi"].mpifc
depends_on("mpi")

_header = join_path("src", "mocsy_DNADHeaders.h")
_libname = "libmocsy.a"
_pcfile = "mocsy.pc"
_pkgdir = "pkgconfig"
_modfiles = [
"dual_num_auto_diff.mod",
"mocsy_buffesm.mod",
"mocsy_constants.mod",
"mocsy_depth2press.mod",
"mocsy_derivauto.mod",
"mocsy_derivnum.mod",
"mocsy_errors.mod",
"mocsy_f2pco2.mod",
"mocsy_gasx.mod",
"mocsy_p2fco2.mod",
"mocsy_p80.mod",
"mocsy_phsolvers.mod",
"mocsy_rho.mod",
"mocsy_rhoinsitu.mod",
"mocsy_singledouble.mod",
"mocsy_sw_adtg.mod",
"mocsy_sw_ptmp.mod",
"mocsy_sw_temp.mod",
"mocsy_tis.mod",
"mocsy_tpot.mod",
"mocsy_vars.mod",
"mocsy_varsolver.mod",
]

def url_for_version(self, version):
return "https://github.com/ACCESS-NRI/mocsy/tarball/{0}".format(version)

@property
def libs(self):
return find_libraries(
"libmocsy", root=self.prefix, shared=False, recursive=True
)

def _create_pkgconf(self, spec, prefix):

text = f"""\
prefix={prefix}
exec_prefix=${{prefix}}
libdir=${{exec_prefix}}/lib
includedir=${{prefix}}/include
Name: mocsy
Description: Routines to model ocean carbonate system thermodynamics.
Version: 2024.08.1
Libs: -L${{libdir}} -lmocsy
Cflags: -I${{includedir}}
Fflags: -I${{includedir}}
"""

with open(join_path(self.stage.source_path, self._pcfile), "w", encoding="utf-8") as pc:
nchars_written = pc.write(text)

if nchars_written < len(text):
raise OSError

def build(self, spec, prefix):
build = Executable("make")
build(
self._libname,
"FC=" + self.spec["mpi"].mpifc,
# Copied from MOM5/bin/mkmf.template.nci
"FCFLAGS=-fno-alias -safe-cray-ptr -fpe0 -ftz -assume byterecl -i4 -r8 -traceback -nowarn -check noarg_temp_created -assume nobuffered_io -convert big_endian -grecord-gcc-switches -align all -g3 -O2 -xCORE-AVX2 -debug all -check none",
"F90=" + self.spec["mpi"].mpifc
)
self._create_pkgconf(spec, prefix)

def install(self, spec, prefix):

# Creates prefix.lib too
pkgconfdir = join_path(prefix.lib, self._pkgdir)
mkdirp(pkgconfdir)
mkdirp(prefix.include)

install(join_path(self.stage.source_path, self._libname), prefix.lib)
install(join_path(self.stage.source_path, self._header), prefix.include)
for f in self._modfiles:
install(join_path(self.stage.source_path, f), prefix.include)
install(join_path(self.stage.source_path, self._pcfile), pkgconfdir)

26 changes: 26 additions & 0 deletions packages/access-test/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# Copyright 2024 ACCESS-NRI
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack.package import *

class AccessTest(BundlePackage):
"""ACCESS-TEST bundle is for testing ACCESS-NRI infrastructure."""

homepage = "https://www.access-nri.org.au"

git = "https://github.com/ACCESS-NRI/ACCESS-TEST.git"

maintainers("harshula")

version("latest")

variant("deterministic", default=False, description="Deterministic build.")

depends_on("oasis3-mct+deterministic", when="+deterministic", type="run")
depends_on("oasis3-mct~deterministic", when="~deterministic", type="run")

# There is no need for install() since there is no code.
Loading

0 comments on commit 473eeee

Please sign in to comment.