Skip to content

Commit

Permalink
cice5: add a variant for deterministic builds
Browse files Browse the repository at this point in the history
* Restructure -traceback in NCI_INTEL_FLAGS
  • Loading branch information
harshula committed Aug 7, 2023
1 parent 32ab172 commit 969eb11
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions packages/cice5/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,21 @@ class Cice5(MakefilePackage):

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

variant("deterministic", default=False, description="Deterministic build.")

# Depend on virtual package "mpi".
depends_on("mpi")
depends_on("oasis3-mct")
depends_on("datetime-fortran")
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("libaccessom2")
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"]

Expand Down Expand Up @@ -101,6 +105,13 @@ def edit(self, spec, prefix):
ldeps = ["oasis3-mct", "libaccessom2", "netcdf-c", "netcdf-fortran", "datetime-fortran"]
libs = " ".join([lstr] + [self.get_linker_args(spec, d) for d in ldeps])

# TODO: https://github.com/ACCESS-NRI/ACCESS-OM/issues/12
NCI_OPTIM_FLAGS = "-g3 -O2 -axCORE-AVX2 -debug all -check none -traceback -qopt-report=5 -qopt-report-annotate -assume buffered_io"
CFLAGS = "-c -O2"
if "+deterministic" in self.spec:
NCI_OPTIM_FLAGS = "-g0 -O0 -axCORE-AVX2 -debug none -check none -qopt-report=5 -qopt-report-annotate -assume buffered_io"
CFLAGS = "-c -g0"

# Copied from bld/Macros.nci
config["pre"] = f"""
INCLDIR := -I. {incs}
Expand All @@ -111,7 +122,7 @@ def edit(self, spec, prefix):
CPPFLAGS := -P -traditional
CPPDEFS := -DLINUX -DPAROPT
CFLAGS := -c -O2
CFLAGS := {CFLAGS}
FIXEDFLAGS := -132
FREEFLAGS :=
"""
Expand All @@ -123,14 +134,14 @@ def edit(self, spec, prefix):

# module load intel-compiler/2019.5.281
config["intel"] = f"""
NCI_INTEL_FLAGS := -r8 -i4 -traceback -w -fpe0 -ftz -convert big_endian -assume byterecl -check noarg_temp_created
NCI_INTEL_FLAGS := -r8 -i4 -w -fpe0 -ftz -convert big_endian -assume byterecl -check noarg_temp_created
NCI_REPRO_FLAGS := -fp-model precise -fp-model source -align all
ifeq ($(DEBUG), 1)
NCI_DEBUG_FLAGS := -g3 -O0 -debug all -check all -no-vec -assume nobuffered_io
NCI_DEBUG_FLAGS := -g3 -O0 -debug all -check all -no-vec -traceback -assume nobuffered_io
FFLAGS := $(NCI_INTEL_FLAGS) $(NCI_REPRO_FLAGS) $(NCI_DEBUG_FLAGS)
CPPDEFS := $(CPPDEFS) -DDEBUG=$(DEBUG)
else
NCI_OPTIM_FLAGS := -g3 -O2 -axCORE-AVX2 -debug all -check none -qopt-report=5 -qopt-report-annotate -assume buffered_io
NCI_OPTIM_FLAGS = {NCI_OPTIM_FLAGS}
FFLAGS := $(NCI_INTEL_FLAGS) $(NCI_REPRO_FLAGS) $(NCI_OPTIM_FLAGS)
endif
"""
Expand Down

0 comments on commit 969eb11

Please sign in to comment.