From aacb3f1ef36c42a17aea07134c1e390a2d2a7968 Mon Sep 17 00:00:00 2001 From: Anton Steketee <79179784+anton-seaice@users.noreply.github.com> Date: Tue, 17 Dec 2024 09:03:19 +1100 Subject: [PATCH] Spack package to add build options for CICE5 in esm1.6 (#173) This change adds a version to the CICE5 spack package for access-esm1.6. This uses code from the access-esm1.6 branch and the 'access' driver. This sets other options appropriate for testing with access-esm1.6, e.g. a build with 12 and 16 cores, zero-layer thermodynamics, and no bio-geochemistry. --- packages/cice5/package.py | 7 ++-- packages/cice5/spack-build.sh | 62 +++++++++++++++++++++-------------- 2 files changed, 42 insertions(+), 27 deletions(-) mode change 100644 => 100755 packages/cice5/package.py diff --git a/packages/cice5/package.py b/packages/cice5/package.py old mode 100644 new mode 100755 index 4568a1e..9f90af8 --- a/packages/cice5/package.py +++ b/packages/cice5/package.py @@ -14,9 +14,10 @@ class Cice5(MakefilePackage): homepage = "https://www.access-nri.org.au" git = "https://github.com/ACCESS-NRI/cice5.git" - maintainers = ["harshula"] + maintainers = ["harshula", "anton-seaice"] version("master", branch="master", preferred=True) + version("access-esm1.6", branch="access-esm1.6") variant("deterministic", default=False, description="Deterministic build.") variant("optimisation_report", default=False, description="Generate optimisation reports.") @@ -77,8 +78,10 @@ def set_deps_targets(self, spec, prefix): if self.spec.satisfies("@access-esm1.6"): # The integer represents environment variable NTASK - self.__targets = {12: {}} + # esm1.5 used 12 (cice4), cm2 used 16 (cice5), build both for testing + self.__targets = {12: {}, 16: {}} self.add_target(12, "access-esm1.6", "360x300", "12x1") + self.add_target(16, "access-esm1.6", "360x300", "8x2") ideps = ["oasis3-mct", "netcdf-fortran"] diff --git a/packages/cice5/spack-build.sh b/packages/cice5/spack-build.sh index 20b66a0..32798ed 100755 --- a/packages/cice5/spack-build.sh +++ b/packages/cice5/spack-build.sh @@ -35,28 +35,46 @@ if ($debug == 'unit_testing') then endif ### Specialty code -setenv CAM_ICE no # set to yes for CAM runs (single column) -setenv SHRDIR csm_share # location of CCSM shared code -setenv IO_TYPE pio # set to none if netcdf library is unavailable -setenv DITTO no # reproducible diagnostics -setenv THRD no # set to yes for OpenMP threading +setenv CAM_ICE no # set to yes for CAM runs (single column) +setenv SHRDIR csm_share # location of CCSM shared code +setenv DITTO no # reproducible diagnostics +setenv THRD no # set to yes for OpenMP threading if ( $THRD == 'yes') setenv OMP_NUM_THREADS 2 # positive integer -setenv BARRIERS yes # set -Dgather_scatter_barrier, prevents hangs on raijin -setenv AusCOM yes -if ($driver == 'access') then - setenv ACCESS yes -else - setenv ACCESS no +setenv BARRIERS yes # set -Dgather_scatter_barrier, prevents hangs on raijin +setenv NSNWLYR 1 # number of vertical layers in the snow +setenv NICECAT 5 # number of ice thickness categories +setenv OASIS3_MCT yes # oasis3-mct version +setenv AusCOM yes + +if ($driver == 'access-esm1.6') then + setenv DRVDIR 'access' + setenv ACCESS yes + setenv IO_TYPE netcdf + setenv CHAN MPI1 # MPI1 or MPI2 (always MPI1!) + setenv NICELYR 1 # 1 for ktherm=0, zero-layer thermodynamics + setenv TRBGCS 0 + # This branch does not include version.F90.template and does not need version_mod.F90 +# else if ($driver == 'access-cm2') then +# setenv DRVDIR 'access' +# setenv ACCESS yes +# setenv IO_TYPE netcdf +# setenv CHAN MPI1 # MPI1 or MPI2 (always MPI1!) +# setenv NICELYR 4 #4 for standard multi-layer ice (ktherm=1) +# setenv TRBGCS 2 + # This branch does not include version.F90.template and does not need version_mod.F90 +else #driver = auscom + setenv DRVDIR $driver + setenv ACCESS no + setenv IO_TYPE pio + setenv NICELYR 4 # number of vertical layers in the ice + setenv TRBGCS 2 # number of skeletal layer bgc tracers + # TRBGCS=0 or 2<=TRBGCS<=9) + ### The version of an executable can be found with the following + ### command: strings | grep 'CICE_VERSION=' + set version='202301' + sed -e "s/{CICE_VERSION}/$version/g" $SRCDIR/drivers/$driver/version.F90.template > $SRCDIR/drivers/$driver/version_mod.F90 endif -setenv OASIS3_MCT yes # oasis3-mct version -setenv NICELYR 4 # number of vertical layers in the ice -setenv NSNWLYR 1 # number of vertical layers in the snow -setenv NICECAT 5 # number of ice thickness categories -### The version of an executable can be found with the following -### command: strings | grep 'CICE_VERSION=' -set version='202301' -sed -e "s/{CICE_VERSION}/$version/g" $SRCDIR/drivers/$driver/version.F90.template > $SRCDIR/drivers/$driver/version_mod.F90 ### Where this model is compiled setenv OBJDIR $SRCDIR/build_${driver}_${grid}_${blocks}_${ntask}p @@ -90,8 +108,6 @@ setenv NTRAERO 0 # number of aerosol tracers # CESM uses 3 aerosol tracers setenv TRBRI 1 # set to 1 for brine height tracer setenv NBGCLYR 0 # number of zbgc layers -setenv TRBGCS 2 # number of skeletal layer bgc tracers - # TRBGCS=0 or 2<=TRBGCS<=9) ### File unit numbers setenv NUMIN 11 # minimum file unit number @@ -105,8 +121,6 @@ else setenv IODIR io_binary endif - - cp -f $CBLD/Makefile.std $CBLD/Makefile if ($NTASK == 1) then @@ -116,8 +130,6 @@ else endif echo COMMDIR: $COMMDIR -setenv DRVDIR $driver - cd $OBJDIR ### List of source code directories (in order of importance).