Skip to content

Commit

Permalink
some tidyups and review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-seaice committed Feb 27, 2025
1 parent 30abf59 commit 957a4c8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 71 deletions.
29 changes: 8 additions & 21 deletions packages/access-cice/package.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Copyright 2013-2025 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: Apache-2.0
Expand All @@ -13,54 +13,41 @@ class AccessCice(CMakePackage):
This package builds using the Access3Share common libraries for ACCESS 3 models."""

homepage = "https://github.com/CICE-Consortium/CICE"
url = "https://github.com/CICE-Consortium/CICE/archive/refs/tags/CICE6.6.0.tar.gz"
version("6.6.0", md5="1c678c0af67bf09f92c0a861344c3a92")
git = "https://github.com/ACCESS-NRI/CICE"
submodules = True
maintainers = ["anton-seaice", "harshula"]

# see license file in at https://github.com/CICE-Consortium/CICE
# 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("cesmcoupled", default=False, description="Set CESMCOUPLED CPP Flag")
variant("openmp", default=False, description="Enable OpenMP")
variant("access3", default=True, description="Install CICE as library for Access3 models")
variant("cesmcoupled", default=False, description="Set CESMCOUPLED CPP Flag")

variant("io_type",
default="NetCDF",
values=("NetCDF", "PIO", "Binary"),
description="CICE IO Method"
)

variant(
"build_type",
default="Release",
description="The build type to build",
values=("Debug", "Release"),
)

depends_on("access3-share", when="+access3")
# depends_on("access3-share+openmp", when="+openmp+access3")
depends_on("access3-share+openmp", when="+openmp+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.10: build_type==RelWithDebInfo", when="io_type=PIO")
depends_on("parallelio fflags='-qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source' cflags='-qno-opt-dynamic-align -fp-model precise -std=gnu99'", when="%intel io_type=PIO")
depends_on("parallelio fflags='-qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source' cflags='-qno-opt-dynamic-align -fp-model precise -std=gnu99'", when="%oneapi io_type=PIO")

root_cmakelists_dir = "configuration/scripts/cmake"

def cmake_args(self):
args = [
self.define_from_variant("OPENMP", "openmp"),
self.define_from_variant("CICE_IO", "io_type"),
# self.define_from_variant("OPENMP", "openmp"),
self.define_from_variant("ACCESS3_CICE", "access3"),
self.define_from_variant("CESMCOUPLED", "cesmcoupled"),
self.define_from_variant("ACCESS3_CICE", "access3")
]

# we need this for cmake to find MPI_Fortran
# 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
23 changes: 5 additions & 18 deletions packages/access-mom6/package.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Copyright 2013-2025 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: Apache-2.0
Expand All @@ -13,38 +13,29 @@ class AccessMom6(CMakePackage):
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 ACCESS 3 models."""

homepage = "https://github.com/ACCESS-NRI"
homepage = "https://github.com/ACCESS-NRI/MOM6"
git = "https://github.com/ACCESS-NRI/MOM6.git"
submodules = True
url = "https://github.com/ACCESS-NRI/MOM6.git"

version("cmake_build",
git="https://github.com/ACCESS-NRI/MOM6.git",
branch="cmake_build",
submodules=True,
preferred=True,
)
maintainers = ["minghangli-uni", "harshula"]

# see license file in https://github.com/ACCESS-NRI/MOM6/blob/e92c971084e185cfd3902f18072320b45d583a54/LICENSE.md
license("LGPL-3.0", checked_by="minghangli-uni")

root_cmakelists_dir = "cmake"

variant("openmp", default=False, description="Enable OpenMP")
variant("mom_symmetric", default=True, description="Use symmetric memory in MOM6")
variant("access3", default=True, description="Building MOM6 library with Access3share")
variant("cesmcoupled", default=False, description="Enable parameters with cesm coupled")

depends_on("access3-share", when="+access3")
depends_on("access3-share+openmp", when="+openmp+access3")

depends_on("cmake@3.18:", type="build")
depends_on("mpi")
depends_on("netcdf-fortran@4.6.0:")
depends_on("fms@2021.03: build_type==RelWithDebInfo precision=64 +large_file ~gfs_phys ~quad_precision")
depends_on("fms +openmp", when="+openmp")
depends_on("fms ~openmp", when="~openmp")


root_cmakelists_dir = "cmake"

def cmake_args(self):
Expand All @@ -55,8 +46,4 @@ def cmake_args(self):
self.define_from_variant("CESMCOUPLED", "cesmcoupled"),
]

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
22 changes: 5 additions & 17 deletions packages/access3-exe/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-License-Identifier: Apache-2.0

from spack.package import *

from spack.variant import any_combination_of

class Access3Exe(CMakePackage):
"""Executable build for ACCESS version 3 climate models. The exectuable is defined in Community Mediator for Earth Prediction
Expand All @@ -18,27 +18,20 @@ class Access3Exe(CMakePackage):

license("Apache-2.0", checked_by="anton-seaice")

variant(
"build_type",
default="Release",
description="The build type to build",
values=("Debug", "Release"),
)

variant(
"configurations",
# default="MOM6-CICE6, CICE6-WW3, MOM6-CICE6-WW3", if we set these defaults there is no way to unset them in the deployment
default="CICE6",
values=(
# default="CICE6",
values=any_combination_of(
"MOM6",
"CICE6",
"WW3",
"MOM6-WW3",
"MOM6-CICE6",
"CICE6-WW3",
"MOM6-CICE6-WW3",
),
multi=True,
).prohibit_empty_set().with_error("at least one configuration to build is required (e.g. MOM6-CICE6)"),
# multi=True,
description="ACCESS-OM3 configurations to build",
)

Expand All @@ -63,10 +56,5 @@ def cmake_args(self):
args = [
self.define("BuildConfigurations",buildConf)

Check failure on line 57 in packages/access3-exe/package.py

View workflow job for this annotation

GitHub Actions / Check syntax

Ruff (E231)

packages/access3-exe/package.py:57:46: E231 Missing whitespace after ','
]

# we need this for cmake to find MPI_Fortran
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
19 changes: 4 additions & 15 deletions packages/access3-share/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,26 @@ class Access3Share(CMakePackage):

license("Apache-2.0", checked_by="anton-seaice")

# variant("openmp", default=False, description="Enable OpenMP")

variant(
"build_type",
default="Release",
description="The build type to build",
values=("Debug", "Release"),
)
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.3.0:")
depends_on("esmf cflags='-fp-model precise' fflags='-fp-model precise'", when="%intel")
depends_on("esmf cflags='-fp-model precise' fflags='-fp-model precise'", when="%oneapi")
depends_on("fortranxml@4.1.2:")

depends_on("parallelio@2.5.10: build_type==RelWithDebInfo")
depends_on("parallelio fflags='-qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source' cflags='-qno-opt-dynamic-align -fp-model precise -std=gnu99'", when="%intel")
depends_on("parallelio fflags='-qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source' cflags='-qno-opt-dynamic-align -fp-model precise -std=gnu99'", when="%oneapi")

flag_handler = CMakePackage.build_system_flags

def cmake_args(self):

args = [
self.define("ACCESS3_LIB_INSTALL", True),
# self.define_from_variant("OPENMP", "openmp"),
self.define_from_variant("OPENMP", "openmp"),
]

# we need this for cmake to find MPI_Fortran
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 957a4c8

Please sign in to comment.