Skip to content

Commit

Permalink
Proper implementation of ACCESS-OM3 SPD.
Browse files Browse the repository at this point in the history
This now builds and install the OM3 executables and is aware of the different variants.
  • Loading branch information
micaeljtoliveira committed Oct 23, 2023
1 parent 9957fdc commit 3ffd4c2
Showing 1 changed file with 48 additions and 10 deletions.
58 changes: 48 additions & 10 deletions packages/access-om3/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,56 @@
from spack.package import *


class AccessOm3(BundlePackage):
"""Dummy package to install the ACCESS-OM3 dependencies."""
class AccessOm3(CMakePackage):
"""ACCESS-OM3 global ocean-sea ice-wave coupled model."""

homepage = "https://www.github.com/COSIMA/access-om3"
# There is no URL since there is no code to download.
git = "https://github.com/COSIMA/access-om3.git"

maintainers = ["micaeljtoliveira", "aekiss"]

version("0.0.1")

depends_on("[email protected]+external-parallelio~pnetcdf")
depends_on("[email protected]")
depends_on("[email protected]")

# There is no need for install() since there is no code.
version("main", branch="main", submodules=True)

variant(
"build_type", default="Release", description="The build type to build",
values=("Debug", "Release")
)
variant(
"configurations", default="MOM6-CICE6, CICE6-WW3, MOM6-CICE6-WW3",
values=("MOM6", "CICE6", "WW3", "MOM6-WW3", "MOM6-CICE6", "CICE6-WW3", "MOM6-CICE6-WW3"),
multi=True, description="ACCESS-OM3 configurations to build"
)
variant("openmp", default=False, description="Enable OpenMP")
variant("mom_symmetric", default=False, description="Use symmetric memory in MOM6")
variant(
"cice_io", default="PIO", description="CICE IO option",
values=("NectCDF", "PIO", "Binary"), multi=False
)

depends_on("[email protected]:", type="build")
depends_on("mpi")
depends_on("[email protected]:")
depends_on("[email protected]:")
depends_on("[email protected]:")
depends_on("[email protected]:")

flag_handler = CMakePackage.build_system_flags

def cmake_args(self):
args = [
self.define_from_variant("OM3_MOM_SYMMETRIC", "mom_symmetric"),
self.define_from_variant("OM3_OPENMP", "openmp"),
self.define("OM3_ENABLE_MOM6", "configurations=MOM6" in self.spec),
self.define("OM3_ENABLE_CICE6", "configurations=CICE6" in self.spec),
self.define("OM3_ENABLE_WW3", "configurations=WW3" in self.spec),
self.define("OM3_ENABLE_MOM6-WW3", "configurations=MOM6-WW3" in self.spec),
self.define("OM3_ENABLE_MOM6-CICE6", "configurations=MOM6-CICE6" in self.spec),
self.define("OM3_ENABLE_CICE6-WW3", "configurations=CICE6-WW3" in self.spec),
self.define("OM3_ENABLE_MOM6-CICE6-WW3", "configurations=MOM6-CICE6-WW3" in self.spec)
]

args.append(self.define("CMAKE_C_COMPILER", self.spec["mpi"].mpicc))
args.append(self.define("CMAKE_CXX_COMPILER", self.spec["mpi"].mpicxx))
args.append(self.define("CMAKE_Fortran_COMPILER", self.spec["mpi"].mpifc))

return args

0 comments on commit 3ffd4c2

Please sign in to comment.