Skip to content

Commit

Permalink
Use the access-esm1.5 version and branch of GCOM4 (#114)
Browse files Browse the repository at this point in the history
* Use the access-esm1.5 version and branch of GCOM4
* Remove unused import
  • Loading branch information
penguian authored May 28, 2024
1 parent d853a27 commit 30e8ec8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 35 deletions.
62 changes: 28 additions & 34 deletions packages/gcom4/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

from spack.package import *

import llnl.util.filesystem as fs


class Gcom4(Package):
"""
Expand All @@ -19,12 +17,11 @@ class Gcom4(Package):
"""

homepage = "https://code.metoffice.gov.uk/trac/gcom"
git = "git@github.com:ACCESS-NRI/GCOM.git"
git = "git@github.com:ACCESS-NRI/GCOM4.git"

maintainers("penguian")

version("4.5", branch="dev")
build_directory = join_path("Share", "gcom4.5_access_config")
version("access-esm1.5", branch="access-esm1.5")

variant("mpi", default=True, description="Build with MPI")
depends_on("fcm", type="build")
Expand Down Expand Up @@ -55,15 +52,14 @@ def patch(self):
sed -i 's/-openmp/-qopenmp/g' $@/fcm-make/machines/nci_ifort_openmpi.cfg
sed -i 's/-openmp/-qopenmp/g' $@/fcm-make/machines/nci_ifort_serial.cfg
"""
with fs.working_dir(self.build_directory):
filter_file(
r"build\.target\{ns\}.*", "#",
join_path("fcm-make", "gcom.cfg"))
if self.spec.satisfies("%intel"):
machine = self.gcom_machine(self.spec)
filter_file(
r"build\.target\{ns\}.*", "#",
join_path("fcm-make", "gcom.cfg"))
if self.spec.satisfies("%intel"):
machine = self.gcom_machine(self.spec)
filter_file(
r"-openmp", "-qopenmp",
join_path("fcm-make", "machines", f"{machine}.cfg"))
r"-openmp", "-qopenmp",
join_path("fcm-make", "machines", f"{machine}.cfg"))


def build(self, spec, prefix):
Expand All @@ -73,32 +69,30 @@ def build(self, spec, prefix):
fcm = which("fcm")
if fcm is None:
raise FileNotFoundError("fcm not found in $PATH")
with fs.working_dir(self.build_directory):

# Set up variables used by fcm-make/gcom.cfg
env["ACTION"] = "preprocess build"
env["DATE"] = ""
env["GCOM_SOURCE"] = "$HERE/.."
env["MIRROR"] = ""
env["REMOTE_ACTION"] = ""
env["ROSE_TASK_MIRROR_TARGET"] = "localhost"

# Decide on the build variant
env["GCOM_MACHINE"] = self.gcom_machine(spec)

# Do the build with fcm
fcm("make", "-f", join_path("fcm-make", "gcom.cfg"))

# Set up variables used by fcm-make/gcom.cfg
env["ACTION"] = "preprocess build"
env["DATE"] = ""
env["GCOM_SOURCE"] = "$HERE/.."
env["MIRROR"] = ""
env["REMOTE_ACTION"] = ""
env["ROSE_TASK_MIRROR_TARGET"] = "localhost"

# Decide on the build variant
env["GCOM_MACHINE"] = self.gcom_machine(spec)

# Do the build with fcm
fcm("make", "-f", join_path("fcm-make", "gcom.cfg"))


def install(self, spec, prefix):
"""
Build and install the library.
"""
self.build(spec, prefix)
with fs.working_dir(self.build_directory):
mkdirp(prefix.lib)
install(
join_path("build", "lib", "libgcom.a"),
join_path(prefix.lib, "libgcom.a"))
install_tree(join_path("build", "include"), prefix.include)
mkdirp(prefix.lib)
install(
join_path("build", "lib", "libgcom.a"),
join_path(prefix.lib, "libgcom.a"))
install_tree(join_path("build", "include"), prefix.include)

2 changes: 1 addition & 1 deletion packages/um7/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Um7(Package):

depends_on("dummygrib", type=("build", "link"))
depends_on("fcm", type="build")
depends_on("gcom4+mpi", type=("build", "link"))
depends_on("gcom4@access-esm1.5+mpi", type=("build", "link"))
depends_on("mpi", type=("build", "run"))
depends_on("netcdf-fortran", type=("build", "link"))
depends_on("oasis3-mct@access-esm1.5", type=("build", "link"))
Expand Down

0 comments on commit 30e8ec8

Please sign in to comment.