From 3ffd4c21f7553bb5c1584c44d801aff27e8bd73c Mon Sep 17 00:00:00 2001 From: Micael Oliveira Date: Mon, 23 Oct 2023 15:14:10 +1100 Subject: [PATCH] Proper implementation of ACCESS-OM3 SPD. This now builds and install the OM3 executables and is aware of the different variants. --- packages/access-om3/package.py | 58 ++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/packages/access-om3/package.py b/packages/access-om3/package.py index 7b6c6e1..72197d7 100644 --- a/packages/access-om3/package.py +++ b/packages/access-om3/package.py @@ -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("esmf@8.3.1+external-parallelio~pnetcdf") - depends_on("fms@2022.04") - depends_on("parallelio@2.5.9") - - # 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("cmake@3.18:", type="build") + depends_on("mpi") + depends_on("netcdf-fortran@4.6.0:") + depends_on("esmf@8.3.0:") + depends_on("fms@2021.03:") + depends_on("parallelio@2.5.10:") + + 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