Skip to content

Commit

Permalink
cice5: improve handling of targets for ESM1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
harshula committed Dec 10, 2024
1 parent 32bcad8 commit 756cb58
Showing 1 changed file with 42 additions and 32 deletions.
74 changes: 42 additions & 32 deletions packages/cice5/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Cice5(MakefilePackage):

maintainers = ["harshula"]

version("master", branch="master")
version("master", branch="master", preferred=True)

variant("deterministic", default=False, description="Deterministic build.")
variant("optimisation_report", default=False, description="Generate optimisation reports.")
Expand All @@ -25,45 +25,25 @@ class Cice5(MakefilePackage):
depends_on("mpi")
depends_on("[email protected]:")
depends_on("[email protected]:")
# TODO: For initial verification we are going to use static pio.
# Eventually we plan to move to shared pio
# ~shared requires: https://github.com/spack/spack/pull/34837
depends_on("parallelio~pnetcdf~timing~shared")
depends_on("datetime-fortran")
depends_on("oasis3-mct+deterministic", when="+deterministic")
depends_on("oasis3-mct~deterministic", when="~deterministic")
depends_on("libaccessom2+deterministic", when="+deterministic")
depends_on("libaccessom2~deterministic", when="~deterministic")

phases = ["edit", "build", "install"]
# Copied with when() from MOM5 SPR
with when("@:access-esm0,access-esm2:"):
# TODO: For initial verification we are going to use static pio.
# Eventually we plan to move to shared pio
# ~shared requires: https://github.com/spack/spack/pull/34837
depends_on("parallelio~pnetcdf~timing~shared")
depends_on("libaccessom2+deterministic", when="+deterministic")
depends_on("libaccessom2~deterministic", when="~deterministic")

phases = ["set_targets", "edit", "build", "install"]

_buildscript = "spack-build.sh"
_buildscript_path = join_path("bld", _buildscript)

# The integer represents environment variable NTASK
__targets = {24: {}, 480: {}, 722: {}, 1682: {}}
__targets[24]["driver"] = "auscom"
__targets[24]["grid"] = "360x300"
__targets[24]["blocks"] = "24x1"

__targets[480]["driver"] = "auscom"
__targets[480]["grid"] = "1440x1080"
__targets[480]["blocks"] = "48x40"

# Comment from bld/config.nci.auscom.3600x2700:
# Recommendations:
# use processor_shape = slenderX1 or slenderX2 in ice_in
# one per processor with distribution_type='cartesian' or
# squarish blocks with distribution_type='rake'
# If BLCKX (BLCKY) does not divide NXGLOB (NYGLOB) evenly, padding
# will be used on the right (top) of the grid.
__targets[722]["driver"] = "auscom"
__targets[722]["grid"] = "3600x2700"
__targets[722]["blocks"] = "90x90"

__targets[1682]["driver"] = "auscom"
__targets[1682]["grid"] = "3600x2700"
__targets[1682]["blocks"] = "200x180"
__targets = {}

def url_for_version(self, version):
return "https://github.com/ACCESS-NRI/cice5/tarball/{0}".format(version)
Expand All @@ -86,6 +66,36 @@ def make_linker_args(self, spec, name, namespecs):
"-Wl,-rpath=" + path]
)

def add_target(self, ntask, driver, grid, blocks):
self.__targets[ntask]["driver"] = driver
self.__targets[ntask]["grid"] = grid
self.__targets[ntask]["blocks"] = blocks

def set_targets(self, spec, prefix):

if self.spec.satisfies("@access-esm1.6"):
# The integer represents environment variable NTASK
self.__targets = {12: {}}
self.add_target(12, "access-esm1.6", "360x300", "12x1")

else:
# The integer represents environment variable NTASK
self.__targets = {24: {}, 480: {}, 722: {}, 1682: {}}

# TODO: Each of these targets could map to a variant:
self.add_target(24, "auscom", "360x300", "24x1")
self.add_target(480, "auscom", "1440x1080", "48x40")

# Comment from bld/config.nci.auscom.3600x2700:
# Recommendations:
# use processor_shape = slenderX1 or slenderX2 in ice_in
# one per processor with distribution_type='cartesian' or
# squarish blocks with distribution_type='rake'
# If BLCKX (BLCKY) does not divide NXGLOB (NYGLOB) evenly, padding
# will be used on the right (top) of the grid.
self.add_target(722, "auscom", "3600x2700", "90x90")
self.add_target(1682, "auscom", "3600x2700", "200x180")

def edit(self, spec, prefix):

srcdir = self.stage.source_path
Expand Down

0 comments on commit 756cb58

Please sign in to comment.