Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spack Components for OM3 #171

Draft
wants to merge 43 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5d72a48
hacks to build https://github.com/ACCESS-NRI/cice5/tree/cice_gsi8.1
anton-seaice Oct 23, 2024
6e9c3f6
draft of changes
anton-seaice Oct 25, 2024
b944115
attempt at a cice package
anton-seaice Nov 13, 2024
c984bee
draft of MOM6 package
minghangli-uni Nov 14, 2024
c53d2b9
add invariant
minghangli-uni Nov 14, 2024
2001f54
beginnings of an access share package
anton-seaice Nov 15, 2024
9d856f8
Revert "hacks to build https://github.com/ACCESS-NRI/cice5/tree/cice_…
anton-seaice Nov 17, 2024
4e4908e
Merge remote-tracking branch 'origin/main' into 163-om3-components
anton-seaice Nov 17, 2024
42eb0fc
revert cice5
anton-seaice Nov 17, 2024
0aaeca1
improvements
anton-seaice Nov 18, 2024
7f93dbc
Update MOM6/package.py
minghangli-uni Nov 26, 2024
2944f7a
increments
anton-seaice Nov 28, 2024
a2d610d
Merge remote-tracking branch 'origin/163-om3-components' into 163-om3…
anton-seaice Dec 6, 2024
79d34bb
increments
anton-seaice Dec 6, 2024
6e6421c
rename to access-cice & make access3-exe and other experiments
anton-seaice Dec 12, 2024
b8b394a
Merge remote-tracking branch 'origin/main' into 163-om3-components
anton-seaice Jan 9, 2025
d2dab1f
working draft of OM3 build (with CICE only)
anton-seaice Jan 14, 2025
b167ae5
formatting
anton-seaice Jan 14, 2025
ed3b028
whitespace
anton-seaice Jan 14, 2025
b72c6e0
whitespace
anton-seaice Jan 14, 2025
bd2bca8
fix define
anton-seaice Jan 14, 2025
c5f1658
temp set defaul configuration to CICE6 only
anton-seaice Jan 14, 2025
b75b6c9
refinements
anton-seaice Jan 17, 2025
d3aff02
Remove mom6
minghangli-uni Jan 20, 2025
2a0ad48
add access-mom6
minghangli-uni Jan 20, 2025
f91f2be
resolves whitespaces
minghangli-uni Jan 20, 2025
f2def26
Update package.py
anton-seaice Jan 21, 2025
a8e8a5f
submodules = True
anton-seaice Jan 21, 2025
2a4b0f1
Missing fms precision
anton-seaice Jan 21, 2025
07fc321
new cmakelist dir
anton-seaice Jan 22, 2025
49bde52
remove mom6_exec variant
minghangli-uni Jan 23, 2025
3ac4aea
Fix syntax errors
minghangli-uni Jan 23, 2025
71561ad
name tweaks
anton-seaice Jan 23, 2025
f219d71
Update packages/access-cice/package.py
anton-seaice Jan 23, 2025
30d37f2
possibly better build curation
anton-seaice Feb 5, 2025
be5bfcf
comment out unused lines
anton-seaice Feb 5, 2025
174fcb5
Update packages/access3-exe/package.py
anton-seaice Feb 24, 2025
4bede53
Update packages/access3-exe/package.py
anton-seaice Feb 24, 2025
94b9cb6
Merge remote-tracking branch 'origin/main' into 163-om3-components
anton-seaice Feb 25, 2025
30abf59
try without CMAKE compiler flags in package
anton-seaice Feb 25, 2025
957a4c8
some tidyups and review comments
anton-seaice Feb 27, 2025
9b6c462
messing around with configurations validation
anton-seaice Feb 27, 2025
2b84afc
fix handing of deps
anton-seaice Mar 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions packages/access-cice/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# 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
# ----------------------------------------------------------------------------

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 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")
Copy link
Contributor Author

@anton-seaice anton-seaice Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
url = "https://github.com/CICE-Consortium/CICE/archive/refs/tags/CICE6.6.0.tar.gz"
version("6.6.0", md5="1c678c0af67bf09f92c0a861344c3a92")

Shall we pre-emptively create a version("access-om3", branch="main") here ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this interact with the access3 variant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CMake build will pick the correct "driver" code to work with dependencies built in access3-share

a.k.a the customisation in our fork are not essential for the model to build, but misses some nice to have customisation in our fork

I am not sure thats the question ?

git = "https://github.com/ACCESS-NRI/CICE"
submodules = True
maintainers = ["anton-seaice", "harshula"]

# see license file in 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("access3", default=True, description="Install CICE as library for Access3 models")

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"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No RelWithDebInfo option?

)

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:", when="io_type=NetCDF")
depends_on("parallelio@2.5.10: build_type==RelWithDebInfo", when="io_type=PIO")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is overriding the global build_type variant. Is that intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fear this turns off some optimisation which needs to be off for bfb repro, Ill investigate

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")

root_cmakelists_dir = "configuration/scripts/cmake"

def cmake_args(self):
args = [
self.define_from_variant("CICE_IO", "io_type"),
# self.define_from_variant("OPENMP", "openmp"),
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
62 changes: 62 additions & 0 deletions packages/access-mom6/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 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
# ----------------------------------------------------------------------------

from spack.package import CMakePackage, variant, version, depends_on


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 ACCESS 3 models."""

homepage = "https://github.com/ACCESS-NRI"
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("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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard codes build_type and there is no build_type variant as there is in other packages.

depends_on("fms +openmp", when="+openmp")
depends_on("fms ~openmp", when="~openmp")


root_cmakelists_dir = "cmake"

def cmake_args(self):
args = [
self.define_from_variant("OPENMP", "openmp"),
self.define_from_variant("ENABLE_MOM_SYMMETRIC", "mom_symmetric"),
self.define_from_variant("ACCESS3_MOM6", "access3"),
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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should no longer be necessary.


return args
2 changes: 1 addition & 1 deletion packages/access-om3/package.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ class AccessOm3(BundlePackage):

version("latest")

depends_on("access-om3-nuopc")
depends_on("access3-exe")
88 changes: 88 additions & 0 deletions packages/access3-exe/package.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to have this separate package? Couldn't all this be just be put in the access-mom6 package?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the extent of my high-level feedback. The rest is pretty low level I'm afraid.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you leave this comment on the correct file ?

access3-exe uses different code to access-mom6 ...

We will at some point build models which don't include MOM6

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I make a mistake in my comment:

Is there a reason to have this separate package? Couldn't all this be just be put in the access-om3 package?

Does that make more sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how versioning and CD would work if we did this.

i.e.

the version on the access-om3 deployment, is the version of a git tag in the access-nri/access-om3 release

the version on access3-exe is the version from the source code, i.e. the access-nri/access3-share repo

So I think we need a bundle package so we have something to version ? (ping @CodeGat )

Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# 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

from spack.package import *


class Access3Exe(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 pacakge 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(
"build_type",
default="Release",
description="The build type to build",
values=("Debug", "Release"),
)

# To-DO: confirm if we want a MOM6 only for regional modelling
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=(
"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")

depends_on("cmake@3.18:", type="build")
depends_on("mpi")
depends_on("access-cice+cesmcoupled+access3")
depends_on("access-mom6+cesmcoupled+access3")
# depends_on("access-ww3 driver=nuopc/cmeps +cesmcoupled")

flag_handler = CMakePackage.build_system_flags

def cmake_args(self):

args = [
self.define_from_variant("OPENMP", "openmp"),
self.define(
"ENABLE_MOM6", "configurations=MOM6" in self.spec
),
self.define(
"ENABLE_CICE6", "configurations=CICE6" in self.spec
),
self.define(
"ENABLE_WW3", "configurations=WW3" in self.spec
),
self.define(
"ENABLE_MOM6-WW3", "configurations=MOM6-WW3" in self.spec
),
self.define(
"ENABLE_MOM6-CICE6", "configurations=MOM6-CICE6" in self.spec
),
self.define(
"ENABLE_CICE6-WW3", "configurations=CICE6-WW3" in self.spec
),
self.define(
"ENABLE_MOM6-CICE6-WW3", "configurations=MOM6-CICE6-WW3" in self.spec
),
]

# 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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should no longer be needed I believe.


return args
55 changes: 55 additions & 0 deletions packages/access3-share/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 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

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 Access3Exe 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")

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No option for RelWithDebInfo?

)

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("fortranxml@4.1.2:")

depends_on("parallelio@2.5.10: build_type==RelWithDebInfo")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build_type hard-coded.

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")

flag_handler = CMakePackage.build_system_flags

def cmake_args(self):

args = [
self.define("ACCESS3_LIB_INSTALL", True),
# 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
Loading