Skip to content

Commit

Permalink
cice5: Anton's feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
harshula committed Dec 11, 2024
1 parent 2fcdfb1 commit 5afdb77
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions packages/cice5/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ class Cice5(MakefilePackage):
depends_on("libaccessom2+deterministic", when="+deterministic")
depends_on("libaccessom2~deterministic", when="~deterministic")

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

__buildscript = "spack-build.sh"
__buildscript_path = join_path("bld", __buildscript)

__deps = {"includes": "", "ldflags": ""}
__targets = {}

def url_for_version(self, version):
Expand Down Expand Up @@ -71,13 +72,19 @@ def add_target(self, ntask, driver, grid, blocks):
self.__targets[ntask]["grid"] = grid
self.__targets[ntask]["blocks"] = blocks

def set_targets(self, spec, prefix):
def set_deps_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")

ideps = ["oasis3-mct", "netcdf-fortran"]

# NOTE: The order of the libraries matter during the linking step!
ldeps = ["oasis3-mct", "netcdf-c", "netcdf-fortran"]
lstr = ""

else:
# The integer represents environment variable NTASK
self.__targets = {24: {}, 480: {}, 722: {}, 1682: {}}
Expand All @@ -96,6 +103,19 @@ def set_targets(self, spec, prefix):
self.add_target(722, "auscom", "3600x2700", "90x90")
self.add_target(1682, "auscom", "3600x2700", "200x180")

ideps = ["parallelio", "oasis3-mct", "libaccessom2", "netcdf-fortran"]

# NOTE: The order of the libraries matter during the linking step!
# NOTE: datetime-fortran is a dependency of libaccessom2.
ldeps = ["oasis3-mct", "libaccessom2", "netcdf-c", "netcdf-fortran", "datetime-fortran"]
lstr = self.make_linker_args(spec, "parallelio", "-lpiof -lpioc")

istr = join_path((spec["oasis3-mct"].headers).cpp_flags, "psmile.MPI1")
self.__deps["includes"] = " ".join([istr] + [(spec[d].headers).cpp_flags for d in ideps])

self.__deps["ldflags"] = " ".join([lstr] + [self.get_linker_args(spec, d) for d in ldeps])


def edit(self, spec, prefix):

srcdir = self.stage.source_path
Expand All @@ -105,16 +125,8 @@ def edit(self, spec, prefix):
copy(join_path(self.package_dir, self.__buildscript), buildscript_dest)

config = {}

istr = join_path((spec["oasis3-mct"].headers).cpp_flags, "psmile.MPI1")
ideps = ["parallelio", "oasis3-mct", "libaccessom2", "netcdf-fortran"]
incs = " ".join([istr] + [(spec[d].headers).cpp_flags for d in ideps])

lstr = self.make_linker_args(spec, "parallelio", "-lpiof -lpioc")
# NOTE: The order of the libraries matter during the linking step!
# NOTE: datetime-fortran is a dependency of libaccessom2.
ldeps = ["oasis3-mct", "libaccessom2", "netcdf-c", "netcdf-fortran", "datetime-fortran"]
libs = " ".join([lstr] + [self.get_linker_args(spec, d) for d in ldeps])
incs = self.__deps["includes"]
libs = self.__deps["ldflags"]

# TODO: https://github.com/ACCESS-NRI/ACCESS-OM/issues/12
NCI_OPTIM_FLAGS = "-g3 -O2 -axCORE-AVX2 -debug all -check none -traceback -assume buffered_io"
Expand Down

0 comments on commit 5afdb77

Please sign in to comment.