diff --git a/Build/BUILDlibfms b/Build/BUILDlibfms index 604725b..b8601cb 100755 --- a/Build/BUILDlibfms +++ b/Build/BUILDlibfms @@ -28,6 +28,7 @@ # configure your build parameters compiler="intel" yaml="noyaml" + pic="nopic" # # parse arguments for arg in "$@" @@ -41,6 +42,10 @@ yaml="${arg#*=}" shift # Remove "yaml" from processing ;; + nopic|pic) + pic="${arg#*=}" + shift # Remove "PIC" from processing + ;; *) if [ ${arg#} != '--help' ] && [ ${arg#} != '-h' ] ; then echo "option "${arg#}" not found" @@ -49,6 +54,7 @@ echo -e "valid options are:" echo -e "\t[intel(D) | gnu | nvhpc] \t\t\t compiler" echo -e "\t[noyaml(D) | yaml] \t\t\t whether to build with -Duse_yaml" + echo -e "\t[nopic(D) | pic] \t\t\t whether to build all components with the -fPIC flag (position independent code)" echo -e "\n" exit ;; @@ -74,7 +80,7 @@ fi # # build FMS library echo " building ${NCEP_DIR}/libFMS/${compiler}" -MAKE_libFMS ${compiler} ${yaml} >> build_libFMS_${compiler}.out 2>&1 # build 32bit and 64bit versions of libFMS +MAKE_libFMS ${compiler} ${yaml} ${pic} >> build_libFMS_${compiler}.out 2>&1 # build 32bit and 64bit versions of libFMS # # test and report on libFMS build success if [ $? -ne 0 ] ; then diff --git a/Build/BUILDmom6 b/Build/BUILDmom6 new file mode 100755 index 0000000..9427719 --- /dev/null +++ b/Build/BUILDmom6 @@ -0,0 +1,117 @@ +#!/bin/bash +#*********************************************************************** +#* GNU Lesser General Public License +#* +#* This file is part of the SHiELD Build System. +#* +#* The SHiELD Build System free software: you can redistribute it +#* and/or modify it under the terms of the +#* GNU Lesser General Public License as published by the +#* Free Software Foundation, either version 3 of the License, or +#* (at your option) any later version. +#* +#* The SHiELD Build System distributed in the hope that it will be +#* useful, but WITHOUT ANY WARRANTY; without even the implied warranty +#* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +#* See the GNU General Public License for more details. +#* +#* You should have received a copy of the GNU Lesser General Public +#* License along with theSHiELD Build System +#* If not, see . +#*********************************************************************** +# +# DISCLAIMER: This script is provided as-is and as such is unsupported. +# +set -x +# +# set default values +# configure your build parameters + COMPILER="intel" + BIT="64bit" + COMP="" # implies PROD=Y +# +# parse arguments + for arg in "$@" + do + case $arg in + prod|repro|debug) + if [ ${arg#} = 'repro' ] ; then + COMP="REPRO=Y" + elif [ ${arg#} = 'debug' ] ; then + COMP="DEBUG=Y" + fi + shift # Remove COMP from processing + ;; + intel|gnu) + COMPILER="${arg#*=}" + shift # Remove "compiler" from processing + ;; + *) + if [ ${arg#} != '--help' ] && [ ${arg#} != '-h' ] ; then + echo "option "${arg#}" not found" + fi + echo -e ' ' + echo -e "valid options are:" + echo -e "\t[intel(D) | gnu] \t\t\t compiler" + echo -e "\t[prod(D) | repro | debug] \t\t compiler option settings" + echo -e "\n" + exit + ;; + esac + done + +# +# set up some default variables if not called from COMPILE +# BUILD_ROOT is set if this script is called from the COMPILE script +if [ -z ${BUILD_ROOT} ] ; then + export BUILD_ROOT=${PWD%/*} + export SHiELD_SRC=${PWD%/*/*}/SHiELD_SRC/ + export PATH="${BUILD_ROOT}/mkmf/bin:${BUILD_ROOT}/Build/mk_scripts:${PATH}" + export NCEP_DIR=${BUILD_ROOT}/Build + if [ ! -z ${EXTERNAL_LIBS} ] ; then + export NCEP_DIR=${EXTERNAL_LIBS} + fi + # load the proper environment for your machine + . ${BUILD_ROOT}/site/environment.${COMPILER}.sh +fi + + + +mkdir -p ${BUILD_ROOT}/Build/mom6 +list_paths -l -o ${BUILD_ROOT}/Build/mom6/pathnames_mom6 \ + ${SHiELD_SRC}/MOM6/config_src/memory/dynamic_nonsymmetric \ + ${SHiELD_SRC}/MOM6/config_src/drivers/FMS_cap \ + ${SHiELD_SRC}/MOM6/src/*/ \ + ${SHiELD_SRC}/MOM6/src/*/*/ \ + ${SHiELD_SRC}/MOM6/config_src/external/ODA_hooks \ + ${SHiELD_SRC}/MOM6/config_src/external/database_comms \ + ${SHiELD_SRC}/MOM6/config_src/external/drifters \ + ${SHiELD_SRC}/MOM6/config_src/external/stochastic_physics \ + ${SHiELD_SRC}/MOM6/config_src/external/GFDL_ocean_BGC \ + ${SHiELD_SRC}/MOM6/pkg/GSW-Fortran/*/ \ + ${SHiELD_SRC}/MOM6/config_src/infra/FMS2 +cd ${BUILD_ROOT}/Build + +pushd mom6 + +mkmf -m Makefile -a ${SHiELD_SRC} -p libmom6.a -t "${BUILD_ROOT}/${TEMPLATE}" \ + -c "-DINTERNAL_FILE_NML -g -DMAX_FIELDS_=100 -DNOT_SET_AFFINITY -D_USE_MOM6_DIAG -D_USE_GENERIC_TRACER -DUSE_PRECISION=2 -I${NCEP_DIR}/libFMS/${COMPILER}/${BIT}" \ + -I${SHiELD_SRC}/FMS/axis_utils/include -I${SHiELD_SRC}/FMS/diag_manager/include -I${SHiELD_SRC}/FMS/fms/include -I${SHiELD_SRC}/FMS/fms2_io/include \ + -I${SHiELD_SRC}/FMS/horiz_interp/include -I${SHiELD_SRC}/FMS/include -I${SHiELD_SRC}/FMS/mpp/include -I${SHiELD_SRC}/FMS/sat_vapor_pres/include \ + -I${SHiELD_SRC}/FMS/string_utils/include -I${SHiELD_SRC}/FMS/test_fms/fms/include \ + -I${SHiELD_SRC}/MOM6/src/framework ${BUILD_ROOT}/Build/mom6/pathnames_mom6 + +make -j8 ${COMP} AVX=Y NETCDF=3 Makefile libmom6.a >& Build_mom6.out + +################ +#will get noise with openmp in debugmode +################ + +# test and report on libFMS build success +if [ $? -ne 0 ] ; then + echo ">>> ${BUILD_ROOT}/Build/mom6 build failed" + exit 1 +fi +echo " libmom6 build successful" + +popd diff --git a/Build/BUILDnceplibs b/Build/BUILDnceplibs index 2121195..7a11128 100755 --- a/Build/BUILDnceplibs +++ b/Build/BUILDnceplibs @@ -23,8 +23,9 @@ # DISCLAIMER: This script is provided as-is and as such is unsupported. # -#set default compiler +# set default values compiler="intel" +pic="nopic" #define versions to checkout version_bacio="v2.6.0" @@ -40,6 +41,10 @@ version_w3nco="v2.4.1" compiler="${arg#*=}" shift # Remove "compiler" from processing ;; + nopic|pic) + pic="${arg#*=}" + shift # Remove "pic" from processing + ;; *) if [ ${arg#} != '--help' ] && [ ${arg#} != '-h' ] ; then echo "option "${arg#}" not found" @@ -47,6 +52,7 @@ version_w3nco="v2.4.1" echo -e ' ' echo -e "valid options are:" echo -e "\t[intel(D) | gnu | nvhpc] \t\t\t compiler" + echo -e "\t[nopic(D) | pic] \t\t\t whether to build all components with the -fPIC flag (position independent code)" echo -e "\n" exit ;; @@ -72,7 +78,11 @@ mkdir -p $nceplibs_dir cd $nceplibs_dir #Define common cmake flags -cmake_flags="-DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_C_STANDARD=99" +if [ ${pic} = 'pic' ] ; then + cmake_flags="-DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_C_STANDARD=99 -DCMAKE_POSITION_INDEPENDENT_CODE=ON" +else + cmake_flags="-DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_C_STANDARD=99" +fi git clone -b $version_bacio https://github.com/NOAA-EMC/NCEPLIBS-bacio pushd NCEPLIBS-bacio diff --git a/Build/BUILDsis2 b/Build/BUILDsis2 new file mode 100755 index 0000000..0a99fcd --- /dev/null +++ b/Build/BUILDsis2 @@ -0,0 +1,108 @@ +#!/bin/bash +#*********************************************************************** +#* GNU Lesser General Public License +#* +#* This file is part of the SHiELD Build System. +#* +#* The SHiELD Build System free software: you can redistribute it +#* and/or modify it under the terms of the +#* GNU Lesser General Public License as published by the +#* Free Software Foundation, either version 3 of the License, or +#* (at your option) any later version. +#* +#* The SHiELD Build System distributed in the hope that it will be +#* useful, but WITHOUT ANY WARRANTY; without even the implied warranty +#* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +#* See the GNU General Public License for more details. +#* +#* You should have received a copy of the GNU Lesser General Public +#* License along with theSHiELD Build System +#* If not, see . +#*********************************************************************** +# +# DISCLAIMER: This script is provided as-is and as such is unsupported. +# +set -x +# +# set default values +# configure your build parameters + COMPILER="intel" + BIT="64bit" + COMP="" # implies PROD=Y +# +# parse arguments + for arg in "$@" + do + case $arg in + prod|repro|debug) + if [ ${arg#} = 'repro' ] ; then + COMP="REPRO=Y" + elif [ ${arg#} = 'debug' ] ; then + COMP="DEBUG=Y" + fi + shift # Remove COMP from processing + ;; + intel|gnu) + COMPILER="${arg#*=}" + shift # Remove "compiler" from processing + ;; + *) + if [ ${arg#} != '--help' ] && [ ${arg#} != '-h' ] ; then + echo "option "${arg#}" not found" + fi + echo -e ' ' + echo -e "valid options are:" + echo -e "\t[intel(D) | gnu] \t\t\t compiler" + echo -e "\t[prod(D) | repro | debug] \t\t compiler option settings" + echo -e "\n" + exit + ;; + esac + done + +# set up some default variables if not called from COMPILE +# BUILD_ROOT is set if this script is called from the COMPILE script +if [ -z ${BUILD_ROOT} ] ; then + export BUILD_ROOT=${PWD%/*} + export SHiELD_SRC=${PWD%/*/*}/SHiELD_SRC/ + export PATH="${BUILD_ROOT}/mkmf/bin:${BUILD_ROOT}/Build/mk_scripts:${PATH}" + export NCEP_DIR=${BUILD_ROOT}/Build + if [ ! -z ${EXTERNAL_LIBS} ] ; then + export NCEP_DIR=${EXTERNAL_LIBS} + fi + # load the proper environment for your machine + . ${BUILD_ROOT}/site/environment.${COMPILER}.sh +fi + + +mkdir -p ${BUILD_ROOT}/Build/sis2 +list_paths -l -o ${BUILD_ROOT}/Build/sis2/pathnames_sis2 \ + ${SHiELD_SRC}/SIS2/config_src/dynamic_symmetric \ + ${SHiELD_SRC}/SIS2/config_src/external/Icepack_interfaces \ + ${SHiELD_SRC}/SIS2/src \ + ${SHiELD_SRC}/icebergs/src \ + ${SHiELD_SRC}/ice_param + +cd ${BUILD_ROOT}/Build + +pushd sis2 + +mkmf -m Makefile -a ${SHiELD_SRC} -p libsis2.a -t "${BUILD_ROOT}/${TEMPLATE}" \ + -c "-DINTERNAL_FILE_NML -g -DUSE_FMS2_IO -I${NCEP_DIR}/mom6 -I${NCEP_DIR}/libFMS/${COMPILER}/${BIT}" -I${SHiELD_SRC}/FMS/axis_utils/include \ + -I${SHiELD_SRC}/FMS/diag_manager/include -I${SHiELD_SRC}/FMS/fms/include -I${SHiELD_SRC}/FMS/fms2_io/include -I${SHiELD_SRC}/FMS/horiz_interp/include \ + -I${SHiELD_SRC}/FMS/include -I${SHiELD_SRC}/FMS/mpp/include -I${SHiELD_SRC}/FMS/sat_vapor_pres/include -I${SHiELD_SRC}/FMS/string_utils/include \ + -I${SHiELD_SRC}/FMS/test_fms/fms/include -I${SHiELD_SRC}/MOM6/pkg/CVMix-src/include \ + -I${SHiELD_SRC}/MOM6/src/framework ${BUILD_ROOT}/Build/sis2/pathnames_sis2 + + +make -j8 ${COMP} AVX=Y NETCDF=3 Makefile libsis2.a >& Build_sis2.out + +# +# test and report on libsis2 build success +if [ $? -ne 0 ] ; then + echo ">>> ${BUILD_ROOT}/Build/sis2 build failed" + exit 1 +fi +echo " libsis2 build successful" + +popd diff --git a/Build/COMPILE b/Build/COMPILE index 06061c1..6ef79c5 100755 --- a/Build/COMPILE +++ b/Build/COMPILE @@ -56,6 +56,7 @@ spin() compiler="intel" clean="noclean" yaml="noyaml" + pic="nopic" config_name="SHiELD" @@ -64,11 +65,17 @@ spin() for arg in "$@" do case $arg in - shield|solo) + shield|solo|shieldfull|shiemom) config="${arg#*=}" if [ $config = 'solo' ] ; then config_name="SOLO" fi + if [ $config = 'shieldfull' ] ; then + config_name="SHiELDFULL" + fi + if [ $config = 'shiemom' ] ; then + config_name="SHiEMOM" + fi shift # Remove "config" from processing ;; nh|hydro|sw) @@ -101,7 +108,7 @@ spin() sleep 20 fi ;; - noclean|clean|cleanall) + noclean|clean|cleanmom|cleanall) clean="${arg#*=}" shift # Remove "clean" from processing ;; @@ -109,6 +116,10 @@ spin() yaml="${arg#*=}" shift # Remove "yaml" from processing ;; + nopic|pic) + pic="${arg#*=}" + shift # Remove "pic" from processing + ;; *) if [ ${arg#} != '--help' ] && [ ${arg#} != '-h' ] ; then echo "option "${arg#}" not found" @@ -123,6 +134,7 @@ spin() echo -e "\t[intel(D) | gnu | nvhpc] \t\t\t compiler" echo -e "\t[noclean(D) | clean | cleanall] \t cleans exec area" echo -e "\t[noyaml(D) | yaml] \t will build the FMS library with the -Duse_yaml library. Default is no yaml" + echo -e "\t[nopic(D) | pic] \t whether to build all components with the -fPIC flag (position independent code)" echo -e "\n" exit ;; @@ -134,6 +146,11 @@ if [ $hydro = "sw" ] && [ $config = "shield" ] ; then exit 1 fi +if [ $compiler = "nvhpc" ] && [ $config = "shiemom" ] ; then + echo -e ">>> option '$compiler' with '$config' is not a valid configuration" + exit 1 +fi + # # set up some default variables for use within the helper scripts export BUILD_ROOT=${PWD%/*} @@ -157,6 +174,7 @@ echo -e "\tavx = $avx" echo -e "\tcompiler = $compiler" echo -e "\tclean = $clean" echo -e "\tyaml = $yaml" +echo -e "\tpic = $pic" echo -e "\n" sleep 5 @@ -186,10 +204,17 @@ fi \rm -rf libFMS/${compiler}/* \rm -rf exec/${config}_${hydro}.${comp}.${bit}.${compiler}/* \rm -rf nceplibs/${compiler}/* + \rm -rf mom6/* + \rm -rf sis2/* elif [ ${clean} = "clean" ] ; then echo " cleaning build directory in 2 seconds" sleep 2 \rm -rf exec/${config}_${hydro}.${comp}.${bit}.${compiler}/* + elif [ ${clean} = "cleanmom" ] ; then + echo " cleaning build directory in 2 seconds" + sleep 2 + \rm -rf mom6/* + \rm -rf sis2/* fi # If EXTERNAL_LIBS is set, then the program will use the path defined by @@ -205,7 +230,7 @@ fi echo " pre-built ${NCEP_DIR}/libFMS/${compiler} exists" else echo " ${NCEP_DIR}/libFMS/${compiler} does not exist" - ./BUILDlibfms ${compiler} ${yaml} + ./BUILDlibfms ${compiler} ${yaml} ${pic} if [ $? -ne 0 ] ; then echo ">>> ${NCEP_DIR}/Libfms/${compiler} build failed" exit 2 @@ -218,13 +243,33 @@ fi echo " pre-built ${NCEP_DIR}/nceplibs/${compiler} exists" else echo " ${NCEP_DIR}/nceplibs/${compiler} does not exist" - ./BUILDnceplibs ${compiler} + ./BUILDnceplibs ${compiler} ${pic} if [ $? -ne 0 ] ; then echo ">>> ${NCEP_DIR}/ncepdir/${compiler} build failed" exit 3 fi fi +if [ $config = "shiemom" ] ; then +# from lauren + # I think mom6 needs to be built in 64bit for now? + # I can only get it to compiler with 64bit FMS + ./BUILDmom6 ${comp} ${compiler} + if [ $? -ne 0 ] ; then + echo " MOM6 build failed" + exit + fi + echo "DONE WITH MOM6" + +# for sis2 + ./BUILDsis2 ${comp} ${compiler} + if [ $? -ne 0 ] ; then + echo " SIS2 build failed" + exit + fi + echo "DONE WITH SIS2" +fi + # # ensure the build and final executable locations are available mkdir -p ./exec/${config}_${hydro}.${comp}.${bit}.${compiler} @@ -248,7 +293,7 @@ echo -e " building ${config} ${hydro} ${comp} ${bit} ${compiler} \t `date`" fi # # build the configuration - mk_make ${config} ${hydro} ${comp} ${bit} ${avx} ${compiler} >> build_${config}_${hydro}.${comp}.${bit}.${compiler}.out 2>&1 + mk_make ${config} ${hydro} ${comp} ${bit} ${avx} ${compiler} ${pic} >> build_${config}_${hydro}.${comp}.${bit}.${compiler}.out 2>&1 # # move the executable to an accessible area mv exec/${config}_${hydro}.${comp}.${bit}.${compiler}/test.x bin/${config_name}_${hydro}.${comp}.${bit}.${compiler}.x diff --git a/Build/mk_scripts/MAKE_libFMS b/Build/mk_scripts/MAKE_libFMS index 6bd8cba..7bb4e2f 100755 --- a/Build/mk_scripts/MAKE_libFMS +++ b/Build/mk_scripts/MAKE_libFMS @@ -30,6 +30,7 @@ SHiELD_SRC=${PWD%/*/*}/SHiELD_SRC PATH="${BUILD_ROOT}/mkmf/bin:${PATH}" COMPILER="intel" YAML="noyaml" +pic="nopic" # ## parse arguments @@ -47,6 +48,15 @@ do fi shift # Remove yaml from processing ;; + nopic|pic) + pic="${arg#*=}" + if [ ${pic} = 'pic' ] ; then + PIC="Y" + else + PIC="N" + fi + shift # Remove "PIC" from processing + ;; esac done @@ -72,7 +82,7 @@ pushd ${NCEP_DIR}/libFMS/${COMPILER}/${bit} mkmf -m Makefile -a ${SHiELD_SRC} -t "${BUILD_ROOT}/${TEMPLATE}" -c "$cppDefs" \ -p libFMS.a ${NCEP_DIR}/libFMS/${COMPILER}/${bit}/pathnames_fms echo "building ${NCEP_DIR}/libFMS/${COMPILER}/32bit/libFMS.a..." -make -j8 OPENMP=Y AVX=Y 32BIT=Y Makefile libFMS.a >& Build_libFMS.out +make -j8 OPENMP=Y AVX=Y 32BIT=Y PIC=${PIC} Makefile libFMS.a >& Build_libFMS.out # # test and report on build success @@ -95,7 +105,7 @@ pushd ${NCEP_DIR}/libFMS/${COMPILER}/${bit} mkmf -m Makefile -a ${SHiELD_SRC} -t "${BUILD_ROOT}/${TEMPLATE}" -c "$cppDefs" \ -p libFMS.a ${NCEP_DIR}/libFMS/${COMPILER}/${bit}/pathnames_fms echo "building ${NCEP_DIR}/libFMS/${COMPILER}/64bit/libFMS.a..." -make -j8 OPENMP=Y AVX=Y Makefile libFMS.a >& Build_libFMS.out +make -j8 OPENMP=Y AVX=Y PIC=${PIC} Makefile libFMS.a >& Build_libFMS.out # # test and report on build success diff --git a/Build/mk_scripts/mk_make b/Build/mk_scripts/mk_make index caeb1ca..88e55c4 100755 --- a/Build/mk_scripts/mk_make +++ b/Build/mk_scripts/mk_make @@ -34,13 +34,14 @@ COMPILER="intel" bit="32bit" comp="prod" +pic="nopic" # ## parse arguments for arg in "$@" do case $arg in - shield|solo) + shield|solo|shieldfull|shiemom) CONFIG="${arg#*=}" shift # Remove CONFIG from processing ;; @@ -72,6 +73,14 @@ do COMPILER="${arg#*=}" shift # Remove COMPILER from processing ;; + nopic|pic) + if [ "${arg#*=}" = 'pic' ] ; then + PIC=Y + else + PIC=N + fi + shift # Remove PIC from processing + ;; esac done @@ -80,16 +89,36 @@ done module list $FC --version - -NCEPLIBS="${NCEP_DIR}/libFMS/${COMPILER}/${bit}/libFMS.a" if [ ${CONFIG} = 'shield' ] ; then + NCEPLIBS="./libfv3.a" + NCEPLIBS+=" ${NCEP_DIR}/libFMS/${COMPILER}/${bit}/libFMS.a" + NCEPLIBS+=" ./libgfs.a" + NCEPLIBS+=" -L${NCEP_DIR}/nceplibs/${COMPILER}/ -lbacio -lsp_d -lw3emc_d -lw3nco_d" +elif [ ${CONFIG} = 'shieldfull' ] ; then + NCEPLIBS="./libfv3.a" + NCEPLIBS+=" ${NCEP_DIR}/libFMS/${COMPILER}/64bit/libFMS.a" + NCEPLIBS+=" ./libgfs.a" + NCEPLIBS+=" -L${NCEP_DIR}/nceplibs/${COMPILER}/ -lbacio -lsp_d -lw3emc_d -lw3nco_d" +elif [ ${CONFIG} = 'solo' ] ; then + NCEPLIBS=${NCEP_DIR}/libFMS/${COMPILER}/${bit}/libFMS.a +elif [ ${CONFIG} = 'shiemom' ] ; then + NCEPLIBS="./libfv3.a" + NCEPLIBS+=" ${NCEP_DIR}/sis2/libsis2.a" + NCEPLIBS+=" ${NCEP_DIR}/mom6/libmom6.a" + NCEPLIBS+=" ${NCEP_DIR}/libFMS/${COMPILER}/64bit/libFMS.a" NCEPLIBS+=" ./libgfs.a" NCEPLIBS+=" -L${NCEP_DIR}/nceplibs/${COMPILER}/ -lbacio -lsp_d -lw3emc_d -lw3nco_d" fi -if [ ${CONFIG} = 'shield' ] ; then - (cd exec/${CONFIG}_${HYDRO}.${comp}.${bit}.${COMPILER} ; make -j 8 OPENMP=Y ${COMP} AVX=${AVX} -f Makefile_gfs) +if [ ${CONFIG} = 'shield' ] || [ ${CONFIG} = 'shieldfull' ] || [ ${CONFIG} = 'shiemom' ] ; then + (cd exec/${CONFIG}_${HYDRO}.${comp}.${bit}.${COMPILER} ; make -j 8 OPENMP=Y ${COMP} AVX=${AVX} PIC=${PIC} -f Makefile_gfs) fi -(cd exec/${CONFIG}_${HYDRO}.${comp}.${bit}.${COMPILER} ; make -j 8 OPENMP=Y NETCDF=3 ${COMP} AVX=${AVX} ${BIT} NCEPLIBS="${NCEPLIBS}" -f Makefile_fv3) +(cd exec/${CONFIG}_${HYDRO}.${comp}.${bit}.${COMPILER} ; make -j 8 OPENMP=Y NETCDF=3 ${COMP} AVX=${AVX} ${BIT} PIC=${PIC} NCEPLIBS="${NCEPLIBS}" -f Makefile_fv3) + +if [ ${CONFIG} = 'shieldfull' ] || [ ${CONFIG} = 'shiemom' ] ; then + (cd exec/${CONFIG}_${HYDRO}.${comp}.${bit}.${COMPILER} ; make -j 8 OPENMP=Y NETCDF=3 ${COMP} AVX=${AVX} PIC=${PIC} NCEPLIBS="${NCEPLIBS}" -f Makefile_driver) +elif [ ${CONFIG} = 'shield' ] ; then + (cd exec/${CONFIG}_${HYDRO}.${comp}.${bit}.${COMPILER} ; make -j 8 OPENMP=Y NETCDF=3 ${COMP} AVX=${AVX} ${BIT} PIC=${PIC} NCEPLIBS="${NCEPLIBS}" -f Makefile_driver) +fi exit 0 diff --git a/Build/mk_scripts/mk_makefile b/Build/mk_scripts/mk_makefile index cbeed5f..04583f9 100755 --- a/Build/mk_scripts/mk_makefile +++ b/Build/mk_scripts/mk_makefile @@ -36,7 +36,7 @@ COMPILER="intel" for arg in "$@" do case $arg in - shield|solo) + shield|solo|shieldfull|shiemom) CONFIG="${arg#*=}" shift # Remove CONFIG from processing ;; @@ -70,6 +70,8 @@ GFS_cppDefs="-DNEW_TAUCTMAX -DNEMS_GSM -DINTERNAL_FILE_NML" FV3_cppDefs="-Duse_libMPI -Duse_netCDF -DHAVE_SCHED_GETAFFINITY -DSPMD -Duse_LARGEFILE -DINTERNAL_FILE_NML" if [ ${CONFIG} = 'shield' ] ; then FV3_cppDefs+=" -DGFS_PHYS -DUSE_GFSL63" +elif [ ${CONFIG} = 'shieldfull' ] || [ ${CONFIG} = 'shiemom' ] ; then + FV3_cppDefs+=" -DGFS_PHYS -DUSE_GFSL63 -D_USE_LEGACY_LAND_" elif [ ${CONFIG} = 'solo' ] ; then FV3_cppDefs+=" -DDCMIP -DDYCORE_SOLO -DHIWPP" fi @@ -87,14 +89,44 @@ pushd exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/ ############################ #---CREATE MAKEFILES ############################ -if [ ${CONFIG} = 'shield' ] ; then +if [ ${CONFIG} = 'shield' ] || [ ${CONFIG} = 'shieldfull' ] ; then mkmf -m Makefile_gfs -a ${SHiELD_SRC} -t "${BUILD_ROOT}/${TEMPLATE}" -o "-cpp" -c "${GFS_cppDefs}" \ -p libgfs.a ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_gfs -fi -mkmf -m Makefile_fv3 -a ${SHiELD_SRC} -t "${BUILD_ROOT}/${TEMPLATE}" -c "${FV3_cppDefs}" \ - -p test.x -o "-I${SHiELD_SRC}/FMS/include -I${NCEP_DIR}/libFMS/${COMPILER}/${BIT}" \ - ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_fv3 + if [ ${CONFIG} = 'shield' ] ; then + mkmf -m Makefile_fv3 -a ${SHiELD_SRC} -t "${BUILD_ROOT}/${TEMPLATE}" \ + -o "-I${SHiELD_SRC}/FMS/include -I${NCEP_DIR}/libFMS/${COMPILER}/${BIT}" -c "${FV3_cppDefs}" \ + -p libfv3.a ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_fv3 + mkmf -m Makefile_driver -a ${SHiELD_SRC} -t "${BUILD_ROOT}/${TEMPLATE}" -c "${FV3_cppDefs}" \ + -p test.x -o "-I${SHiELD_SRC}/FMS/include -I${NCEP_DIR}/libFMS/${COMPILER}/${BIT}" \ + ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_driver + elif [ ${CONFIG} = 'shieldfull' ] ; then + mkmf -m Makefile_fv3 -a ${SHiELD_SRC} -t "${BUILD_ROOT}/${TEMPLATE}" \ + -o "-I${SHiELD_SRC}/FMS/include -I${SHiELD_SRC}/GFDL_atmos_cubed_sphere/driver/SHiELDFULL/include -I${NCEP_DIR}/libFMS/${COMPILER}/64bit" -c "${FV3_cppDefs}" \ + -p libfv3.a ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_fv3 + mkmf -m Makefile_driver -a ${SHiELD_SRC} -t "${BUILD_ROOT}/${TEMPLATE}" -c "${FV3_cppDefs}" \ + -p test.x -o "-I${SHiELD_SRC}/FMS/include -I${NCEP_DIR}/libFMS/${COMPILER}/64bit" \ + ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_driver + fi + + +elif [ ${CONFIG} = 'shiemom' ] ; then + mkmf -m Makefile_gfs -a ${SHiELD_SRC} -t "${BUILD_ROOT}/${TEMPLATE}" -o "-cpp" -c "${GFS_cppDefs}" \ + -p libgfs.a ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_gfs + + mkmf -m Makefile_fv3 -a ${SHiELD_SRC} -t "${BUILD_ROOT}/${TEMPLATE}" \ + -o "-I${SHiELD_SRC}/FMS/include -I${SHiELD_SRC}/GFDL_atmos_cubed_sphere/driver/SHiELDFULL/include -I${NCEP_DIR}/libFMS/${COMPILER}/64bit" -c "${FV3_cppDefs}" \ + -p libfv3.a ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_fv3 + + mkmf -m Makefile_driver -a ${SHiELD_SRC} -t "${BUILD_ROOT}/${TEMPLATE}" -c "${FV3_cppDefs}" \ + -p test.x -o "-I${SHiELD_SRC}/FMS/include -I${NCEP_DIR}/libFMS/${COMPILER}/64bit -I${NCEP_DIR}/mom6 -I${NCEP_DIR}/sis2" \ + ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_driver + +elif [ ${CONFIG} = 'solo' ] ; then + mkmf -m Makefile_fv3 -a ${SHiELD_SRC} -t "${BUILD_ROOT}/${TEMPLATE}" -c "${FV3_cppDefs}" \ + -p test.x -o "-I${SHiELD_SRC}/FMS/include -I${NCEP_DIR}/libFMS/${COMPILER}/${BIT}" \ + ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_fv3 +fi ############################ #---ADD LIBS TO FINAL LINK @@ -102,11 +134,15 @@ mkmf -m Makefile_fv3 -a ${SHiELD_SRC} -t "${BUILD_ROOT}/${TEMPLATE}" -c "${FV3_c sed 's/LDFLAGS/NCEPLIBS) $(LDFLAGS/g' < Makefile_fv3 > OUT mv OUT Makefile_fv3 +if [ ${CONFIG} = 'shield' ] || [ ${CONFIG} = 'shieldfull' ] || [ ${CONFIG} = 'shiemom' ] ; then + sed 's/LDFLAGS/NCEPLIBS) $(LDFLAGS/g' < Makefile_driver > OUT + mv OUT Makefile_driver +fi ############################ #---COMPILE -O0 (for speed) #---GFS_diagnostics.F90 ############################ -if [ ${CONFIG} = 'shield' ] ; then +if [ ${CONFIG} = 'shield' ] || [ ${CONFIG} = 'shieldfull' ] || [ ${CONFIG} = 'shiemom' ] ; then sed -i 's"$(FC) $(CPPDEFS) $(FPPFLAGS) $(FFLAGS) $(OTHERFLAGS) $(OTHER_FFLAGS) -c\t$(SRCROOT)SHiELD_physics/GFS_layer/GFS_diagnostics.F90" $(FC) $(CPPDEFS) $(FPPFLAGS) $(FFLAGS) $(OTHERFLAGS) $(OTHER_FFLAGS) -O0 -c\t$(SRCROOT)SHiELD_physics/GFS_layer/GFS_diagnostics.F90" ' Makefile_gfs fi diff --git a/Build/mk_scripts/mk_paths b/Build/mk_scripts/mk_paths index b41da01..680e3cf 100755 --- a/Build/mk_scripts/mk_paths +++ b/Build/mk_scripts/mk_paths @@ -34,7 +34,7 @@ COMPILER="intel" for arg in "$@" do case $arg in - shield|solo) + shield|solo|shieldfull|shiemom) CONFIG="${arg#*=}" shift # Remove CONFIG from processing ;; @@ -73,8 +73,6 @@ if [ ${CONFIG} = 'solo' ] ; then elif [ ${CONFIG} = 'shield' ] ; then list_paths -o ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_gfs \ - GFDL_atmos_cubed_sphere/model/gfdl_cld_mp.F90 \ - GFDL_atmos_cubed_sphere/model/cld_eff_rad.F90 \ SHiELD_physics/gsmphys/ \ SHiELD_physics/GFS_layer/ \ SHiELD_physics/IPD_layer/ @@ -82,11 +80,56 @@ elif [ ${CONFIG} = 'shield' ] ; then list_paths -o ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_fv3 \ SHiELD_physics/FV3GFS/ \ atmos_drivers/SHiELD/atmos_model.F90 \ - FMSCoupler/SHiELD/coupler_main.F90 \ GFDL_atmos_cubed_sphere/driver/SHiELD/atmosphere.F90 \ GFDL_atmos_cubed_sphere/tools/ \ + GFDL_atmos_cubed_sphere/model/ + + list_paths -o ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_driver \ + FMSCoupler/SHiELD/coupler_main.F90 + +elif [ ${CONFIG} = 'shieldfull' ] ; then + list_paths -o ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_gfs \ + SHiELD_physics/gsmphys/ \ + SHiELD_physics/GFS_layer/ \ + SHiELD_physics/IPD_layer/ + + list_paths -o ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_fv3 \ + SHiELD_physics/FV3GFS/ \ + GFDL_atmos_cubed_sphere/tools/ \ + GFDL_atmos_cubed_sphere/model/ \ + SHiELD_physics/atmos_shared/ \ + GFDL_atmos_cubed_sphere/driver/SHiELDFULL/atmosphere.F90 + + list_paths -o ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_driver \ + ocean_null/ \ + ice_null/ \ + ice_param/ \ + land_null/ \ + atmos_drivers/SHiELDFULL/ \ + FMSCoupler/full/ \ + FMSCoupler/shared/ + +elif [ ${CONFIG} = 'shiemom' ] ; then + + list_paths -o ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_gfs \ + SHiELD_physics/gsmphys/ \ + SHiELD_physics/GFS_layer/ \ + SHiELD_physics/IPD_layer/ + + list_paths -o ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_fv3 \ + SHiELD_physics/FV3GFS/ \ + GFDL_atmos_cubed_sphere/tools/ \ GFDL_atmos_cubed_sphere/model/ \ - GFDL_atmos_cubed_sphere/GFDL_tools/fv_diag_column.F90 + SHiELD_physics/atmos_shared/ \ + GFDL_atmos_cubed_sphere/driver/SHiELDFULL/atmosphere.F90 + + list_paths -o ${BUILD_ROOT}/Build/exec/${CONFIG}_${HYDRO}.${COMP}.${BIT}.${COMPILER}/pathnames_driver \ + land_null/ \ + atmos_drivers/SHiELDFULL/ \ + GFDL_atmos_cubed_sphere/driver/SHiELDFULL/atmosphere.F90 \ + FMSCoupler/full/ \ + FMSCoupler/shared/ + fi popd diff --git a/CHECKOUT_code b/CHECKOUT_code index 4014378..4d59f8d 100755 --- a/CHECKOUT_code +++ b/CHECKOUT_code @@ -31,18 +31,86 @@ export SHiELD_SRC=${PWD%/*}/SHiELD_SRC/ mkdir -p ${SHiELD_SRC} cd ${SHiELD_SRC} +config="shield" +config_name="SHiELD" + +#Check input argument +###################### +for arg in "$@" + do + case $arg in + solo|shield|shieldfull|shiemom) + config="${arg#*=}" + if [ $config = 'solo' ] ; then + config_name="SOLO" + fi + if [ $config = 'shield' ] ; then + config_name="SHiELD" + fi + if [ $config = 'shieldfull' ] ; then + config_name="SHiELDFULL" + fi + if [ $config = 'shiemom' ] ; then + config_name="SHiEMOM" + fi + shift # Remove "config" from processing + ;; + *) + if [ ${arg#} != '--help' ] && [ ${arg#} != '-h' ] ; then + echo "option "${arg#}" not found" + fi + echo -e ' ' + echo -e "valid options are:" + echo -e "\t[solo] \t\t\t SOLO FV3 configuration" + echo -e "\t[shield] \t\t\t SHiELD configuration" + echo -e "\t[shieldfull] \t\t\t SHiELD with the full coupler configuration" + echo -e "\t[shiemom] \t\t\t SHiEMOM (SHiELD+MOM6/SIS2) configuration" + echo -e "\n" + exit + ;; + esac + done + + +#CHECKOUT code +################ +echo ' ' +echo 'Checking out files for: '$config_name +echo ' ' + release="main" fv3_release=$release phy_release=$release -fms_release="2023.04" +fms_release="2024.03" +fms_c_release="2024.03.01" drivers_release=$release git clone -b ${fv3_release} https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere -git clone -b ${phy_release} https://github.com/NOAA-GFDL/SHiELD_physics git clone -b ${fms_release} https://github.com/NOAA-GFDL/FMS -git clone -b ${fms_release} https://github.com/NOAA-GFDL/FMSCoupler git clone -b ${drivers_release} https://github.com/NOAA-GFDL/atmos_drivers +if [ $config_name = 'SHiELD' ] || [ $config_name = 'SHiELDFULL' ] || [ $config_name = 'SHiEMOM' ] ; then + phy_release=$release + git clone -b ${phy_release} https://github.com/NOAA-GFDL/SHiELD_physics + git clone -b ${fms_c_release} https://github.com/NOAA-GFDL/FMSCoupler +fi + +if [ $config_name = 'SHiELDFULL' ] ; then + git clone https://github.com/NOAA-GFDL/ocean_null + git clone https://github.com/NOAA-GFDL/land_null + git clone https://github.com/NOAA-GFDL/ice_null + git clone https://github.com/NOAA-GFDL/ice_param +fi + +if [ $config_name = 'SHiEMOM' ] ; then + git clone https://github.com/NOAA-GFDL/land_null + git clone https://github.com/NOAA-GFDL/ice_param + cd ../SHiELD_build/ + ./CHECKOUT_mom6.csh +fi + #Automatic release tracking from Matt M. echo $release > release + + diff --git a/CHECKOUT_mom6.csh b/CHECKOUT_mom6.csh new file mode 100755 index 0000000..a17533e --- /dev/null +++ b/CHECKOUT_mom6.csh @@ -0,0 +1,20 @@ +#!/bin/tcsh -f + +source $MODULESHOME/init/csh + +cd ../SHiELD_SRC/ +echo `pwd` + +git clone -b dev/gfdl https://github.com/NOAA-GFDL/MOM6/ +git clone -b dev/gfdl https://github.com/NOAA-GFDL/SIS2/ +git clone -b dev/gfdl https://github.com/NOAA-GFDL/icebergs/ + +(cd icebergs && git checkout dev/gfdl) +if ("fffb6f35" != "") then + echo WARNING: Checking out from a fork! Work in progress + (cd MOM6; git submodule update --recursive --init; git checkout fffb6f35; ) +endif +if ("fac2ec43" != "") then + echo WARNING: Checking out from a fork! Work in progress + (cd SIS2;git submodule update --recursive --init; git checkout fac2ec43; ) +endif diff --git a/README.md b/README.md index e74d3b9..df6eeeb 100644 --- a/README.md +++ b/README.md @@ -10,19 +10,30 @@ The top level directory structure groups source code and input files as follow: | -------------- | ------- | | ```LICENSE.md``` | copy of the Gnu Lesser General Public license, version 3 | | ```README.md``` | this file with basic pointers to more information | -| ```CHECKOUT_code``` | script to download necessary source for proper build GFDL's SHield and FV3 Solo models | +| ```CHECKOUT_code``` | script to download necessary source for proper build GFDL's SHield and FV3 Solo models *| | ```Build/``` | contains scripts used for building models listed above | | ```mkmf/``` | submodule entry point for the externally managed [mkmf software](https://github.com/NOAA-GFDL/mkmf) | | ```RTS/``` | contains scripts for use in CI software regression testing (see [RTS/README.md](https://github.com/NOAA-GFDL/SHiELD_build/blob/main/RTS/README.md))| | ```site/``` | contains site specific scripts and compiler make templates | +*By default, ```CHECKOUT_code``` checks out the latest main branch from each repository, which may include experimental features + # Compiling Be sure to download the mkmf submodule prior to beginning. To use: - 1) checkout code via CHECKOUT_code script + 1) Checkout code via CHECKOUT_code script + - ./CHECKOUT_code will checkout necessary files for shields (running with either simple or full coupler) + - ./CHECKOUT_code will automatically run ./CHECKOUT_mom6 for mom6/sis2 files + 2) cd Build and execute ./COMPILE script with the --help option to see usage - 3) sample compile: ./COMPILE shield nh repro 32bit intel + + 3) COMPILE: + - ./COMPILE shield: will compile shield with simple coupler + - ./COMPILE shieldfull: will compile shield with full coupler (utilizing null modules for ocean, land, ice) + - ./COMPILE shiemom: will compile mom6, sis2, fv3, gfs as libraries and link them to the full coupler (no null ocean and ice modules.) + + Example: ./COMPILE shield nh repro 32bit intel # Disclaimer diff --git a/RTS/CI/C48.solo.2TC.3nest b/RTS/CI/C48.solo.2TC.3nest new file mode 100755 index 0000000..a19795a --- /dev/null +++ b/RTS/CI/C48.solo.2TC.3nest @@ -0,0 +1,616 @@ +#!/bin/sh +#*********************************************************************** +#* GNU Lesser General Public License +#* +#* This file is part of the SHiELD Build System. +#* +#* The SHiELD Build System free software: you can redistribute it +#* and/or modify it under the terms of the +#* GNU Lesser General Public License as published by the +#* Free Software Foundation, either version 3 of the License, or +#* (at your option) any later version. +#* +#* The SHiELD Build System distributed in the hope that it will be +#* useful, but WITHOUT ANYWARRANTY; without even the implied warranty +#* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +#* See the GNU General Public License for more details. +#* +#* You should have received a copy of the GNU Lesser General Public +#* License along with theSHiELD Build System +#* If not, see . +#*********************************************************************** +# +# DISCLAIMER: This script is provided as-is for the purpose of continuous +# integration software regression testing and as such is +# unsupported. +# +#SBATCH --ntasks=96 + +#Runscript to test the multiple same level and telescoping nest framework. +#The test case consists of two idealized TCs running at a C48 global resolution with three nests: +#1- One nest in tile4 over a first TC at longitude 180 +#2- Two nests in tiles1,7 (second nest is telescope) over the second TC at longitude -30 +#contact joseph.mouallem@noaa.gov + +if [ -z ${BUILDDIR} ] ; then + echo -e "\nERROR:\tset BUILDDIR to the base path //SHiELD_build/ \n" + exit 99 +fi + +# when we are running this test for CI, we run it in a container +# an expected value for container would be "--mpi=pmi2 singularity exec -B " +# this is needed within the run command +if [ -z "$1" ] ; then + CONTAINER="" +else + CONTAINER=$1 + echo -e "\nThis test will be run inside of a container with the command $1" +fi + +# configure the site +COMPILER=${COMPILER:-intel} +. ${BUILDDIR}/site/environment.${COMPILER}.sh + +set -x + +# necessary for OpenMP +export OMP_STACKSIZE=256m + +# case specific details +res=48 +MEMO="solo.2TC.3nest" # trying repro executable +TYPE="nh" # choices: nh, hydro +MODE="64bit" # choices: 32bit, 64bit +GRID="C$res.3n2" +HYPT="on" # choices: on, off (controls hyperthreading) +if [ -z ${COMP} ] ; then + COMP="repro" # choices: debug, repro, prod +fi + +# directory structure + WORKDIR=${SCRATCHDIR:-${BUILDDIR}}/CI/BATCH-CI/${GRID}.${MEMO}/ + executable=${BUILDDIR}/Build/bin/SOLO_${TYPE}.${COMP}.${MODE}.${COMPILER}.x + +# changeable parameters + # dycore definitions + npx="49" + npy="49" + npz="63" + layout_x="2" + layout_y="2" + io_layout="1,1" #Want to increase this in a production run?? + num_nest="3" + npx_nest=(57 37 37) + npy_nest=(57 37 37) + layout_x_nest=(8 2 2) + layout_y_nest=(8 2 2) + io_layout_x_nest=(1 1 1) + io_layout_y_nest=(1 1 1) + + nthreads="2" + blocksize="32" + blocksize_nest=(32 32 32) + + # run length + days="5" + hours="0" + minutes="0" + months="0" + seconds="0" + dt_atmos="1200" + + # variables in input.nml for initial run + ecmwf_ic=".F." + mountain=".F." + external_ic=".F." + warm_start=".F." + na_init=0 + curr_date="0,0,0,0" + + use_yaml=".F." + +if [ ${TYPE} = "nh" ] ; then + # non-hydrostatic options + make_nh=".T." + hydrostatic=".F." + phys_hydrostatic=".F." # can be tested + use_hydro_pressure=".F." # can be tested + consv_te="1." + k_split="1" + n_split="6" + k_split_nest=(1 1 2) # array ?!?# 1 2 3 + n_split_nest=(10 10 10) # 12 11 10 +else + # hydrostatic options + make_nh=".F." + hydrostatic=".T." + phys_hydrostatic=".F." # will be ignored in hydro mode + use_hydro_pressure=".T." # have to be .T. in hydro mode + consv_te="0." +fi + + no_dycore=".F." + dycore_only=".T." + chksum_debug=".F." + print_freq="12" + do_vort_damp=".True." + vtdm4="0.06" + fdiag="1." + d_con="1." + consv_te="1." + +# variables for hyperthreading +if [ ${HYPT} = "on" ] ; then + hyperthread=".true." + div=2 +else + hyperthread=".false." + div=1 +fi +skip=`expr ${nthreads} \/ ${div}` + +# when running with threads, need to use the following command +npes_g1=`expr ${layout_x} \* ${layout_y} \* 6 ` + +for ((i=0; i<$num_nest; i++)); do + prod=$((layout_x_nest[i] * layout_y_nest[i])) + npes_nest+=("$prod") + npes_nest_total=$((npes_nest_total + prod)) +done + +npes=$((npes_nest_total + npes_g1)) +LAUNCHER=${LAUNCHER:-srun} +if [ ${LAUNCHER} = 'srun' ] ; then + export SLURM_CPU_BIND=verbose + run_cmd="${LAUNCHER} --label --ntasks=$npes --cpus-per-task=$skip $CONTAINER ./${executable##*/}" +else + export MPICH_ENV_DISPLAY=YES + run_cmd="${LAUNCHER} -np $npes $CONTAINER ./${executable##*/}" +fi + +# set up the run area +\rm -rf $WORKDIR +mkdir -p $WORKDIR +cd $WORKDIR +mkdir -p RESTART +mkdir -p INPUT + +# copy over the executable +cp $executable . + +# create an empty data_table +if [ $use_yaml = ".T." ] ; then + cat > data_table.yaml << EOF +data_table: [] +EOF +else + touch data_table +fi + +# build the diag_table with the experiment name and date stamp +cat > diag_table << EOF +${GRID}.${MODE} +0 0 0 0 0 0 +"grid_spec", -1, "hours", 1, "days", "time", +"atmos_daily", 24, "hours", 1, "days", "time", + +"dynamics", "grid_lon", "grid_lon", "grid_spec", "all", .false., "none", 2, +"dynamics", "grid_lat", "grid_lat", "grid_spec", "all", .false., "none", 2, +"dynamics", "area", "area", "grid_spec", "all", .false., "none", 2, + +"dynamics", "ps_ic", "ps_ic", "atmos_daily", "all", .false., "none", 2, +"dynamics", "ps", "ps", "atmos_daily", "all", .false., "none", 2, +"dynamics", "ua_ic", "ua_ic", "atmos_daily", "all", .false., "none", 2, +"dynamics", "va_ic", "va_ic", "atmos_daily", "all", .false., "none", 2, +"dynamics", "us", "us", "atmos_daily", "all", .false., "none", 2, +"dynamics", "vs", "vs", "atmos_daily", "all", .false., "none", 2, +"dynamics", "tb", "tb", "atmos_daily", "all", .false., "none", 2 +"dynamics", "u850", "u850", "atmos_daily", "all", .false., "none", 2 +"dynamics", "v850", "v850", "atmos_daily", "all", .false., "none", 2 +"dynamics", "w500", "w500", "atmos_daily", "all", .false., "none", 2, +"dynamics", "vort850", "vort850", "atmos_daily", "all", .false., "none", 2, +"dynamics", "area", "area", "atmos_daily", "all", .false., "none", 2, + +"dynamics", "tq", "PWAT", "atmos_daily", "all", .false., "none", 2 +"dynamics", "tm", "TMP500_300", "atmos_daily", "all", .false., "none", 2 + +EOF + + +# +# build the field_table +if [ $use_yaml = ".T." ] ; then + cat > field_table.yaml << EOF +field_table: +- field_type: tracer + modlist: + - model_type: atmos_mod + varlist: + - variable: sphum + longname: specific humidity + units: kg/kg + profile_type: fixed + subparams: + - surface_value: 1.e30 + - variable: liq_wat + longname: cloud water mixing ratio + units: kg/kg + profile_type: fixed + subparams: + - surface_value: 1.e30 + - variable: rainwat + longname: rain mixing ratio + units: kg/kg + profile_type: fixed + subparams: + - surface_value: 1.e30 + - variable: ice_wat + longname: cloud ice mixing ratio + units: kg/kg + profile_type: fixed + subparams: + - surface_value: 1.e30 + - variable: snowwat + longname: snow mixing ratio + units: kg/kg + profile_type: fixed + subparams: + - surface_value: 1.e30 + - variable: graupel + longname: graupel mixing ratio + units: kg/kg + profile_type: fixed + subparams: + - surface_value: 1.e30 + - variable: cld_amt + longname: cloud amount + units: '1' + profile_type: fixed + subparams: + - surface_value: 1.e30 +EOF +else +cat > field_table < input.nml <> input.nml << EOF + &field_manager_nml + use_field_table_yaml = $use_yaml +/ + &data_override_nml + use_data_table_yaml = $use_yaml +/ +EOF +fi + + +# Nests namelists +################## + +for ((counter=0; counter<$num_nest; counter++)); do +cat > input_nest0$((counter + 2)).nml <> input_nest0$((counter + 2)).nml < diff --git a/RTS/CI/runCI_C5.sh b/RTS/CI/runCI_C5.sh index b241fc4..c1d779b 100755 --- a/RTS/CI/runCI_C5.sh +++ b/RTS/CI/runCI_C5.sh @@ -45,3 +45,4 @@ sbatch ${SBATCHARGS} --nodes=1 d96_2k.solo.bubble sbatch ${SBATCHARGS} --nodes=1 d96_2k.solo.bubble.n0 sbatch ${SBATCHARGS} --nodes=1 d96_2k.solo.bubble.nhK sbatch ${SBATCHARGS} --nodes=1 d96_500m.solo.mtn_schar +sbatch ${SBATCHARGS} --nodes=1 C48.solo.2TC.3nest diff --git a/RTS/GAEA_RTS/C3072_res.csh b/RTS/GAEA_RTS/C3072_res.csh index 35047ca..71116cb 100755 --- a/RTS/GAEA_RTS/C3072_res.csh +++ b/RTS/GAEA_RTS/C3072_res.csh @@ -21,6 +21,8 @@ endif set RELEASE = "`cat ${BUILD_AREA}/../SHiELD_SRC/release`" +source ${BUILD_AREA}/site/environment.${COMPILER}.csh + #set hires_oro_factor = 3 set res = 3072 diff --git a/RTS/GAEA_RTS/C384.csh b/RTS/GAEA_RTS/C384.csh index 3aecbdc..eadb5e8 100755 --- a/RTS/GAEA_RTS/C384.csh +++ b/RTS/GAEA_RTS/C384.csh @@ -21,7 +21,7 @@ endif set RELEASE = "`cat ${BUILD_AREA}/../SHiELD_SRC/release`" -source ${BUILD_AREA}/site/environment.${COMPILER}.sh +source ${BUILD_AREA}/site/environment.${COMPILER}.csh #set hires_oro_factor = 12 set res = 384 diff --git a/RTS/GAEA_RTS/C48_res.csh b/RTS/GAEA_RTS/C48_res.csh index 2e5f4df..e874a16 100755 --- a/RTS/GAEA_RTS/C48_res.csh +++ b/RTS/GAEA_RTS/C48_res.csh @@ -20,7 +20,7 @@ endif set RELEASE = "`cat ${BUILD_AREA}/../SHiELD_SRC/release`" -source ${BUILD_AREA}/site/environment.${COMPILER}.sh +source ${BUILD_AREA}/site/environment.${COMPILER}.csh #set hires_oro_factor = 3 set res = 48 diff --git a/RTS/GAEA_RTS/C48_test.csh b/RTS/GAEA_RTS/C48_test.csh index b113ca2..59dc6bf 100755 --- a/RTS/GAEA_RTS/C48_test.csh +++ b/RTS/GAEA_RTS/C48_test.csh @@ -21,7 +21,7 @@ endif set RELEASE = "`cat ${BUILD_AREA}/../SHiELD_SRC/release`" -source ${BUILD_AREA}/site/environment.${COMPILER}.sh +source ${BUILD_AREA}/site/environment.${COMPILER}.csh #set hires_oro_factor = 3 set res = 48 diff --git a/RTS/GAEA_RTS/C48n4.csh b/RTS/GAEA_RTS/C48n4.csh index 956946f..84122a7 100755 --- a/RTS/GAEA_RTS/C48n4.csh +++ b/RTS/GAEA_RTS/C48n4.csh @@ -19,7 +19,7 @@ endif set RELEASE = "`cat ${BUILD_AREA}/../SHiELD_SRC/release`" -source ${BUILD_AREA}/site/environment.${COMPILER}.sh +source ${BUILD_AREA}/site/environment.${COMPILER}.csh #set hires_oro_factor = 3 set res = 48 diff --git a/RTS/GAEA_RTS/C768.csh b/RTS/GAEA_RTS/C768.csh index 1660cfc..a684ec1 100755 --- a/RTS/GAEA_RTS/C768.csh +++ b/RTS/GAEA_RTS/C768.csh @@ -20,7 +20,7 @@ endif set RELEASE = "`cat ${BUILD_AREA}/../SHiELD_SRC/release`" -source ${BUILD_AREA}/site/environment.${COMPILER}.sh +source ${BUILD_AREA}/site/environment.${COMPILER}.csh # case specific details set TYPE = "nh" # choices: nh, hydro diff --git a/RTS/GAEA_RTS/C768r15n3.csh b/RTS/GAEA_RTS/C768r15n3.csh index de811e3..390be01 100644 --- a/RTS/GAEA_RTS/C768r15n3.csh +++ b/RTS/GAEA_RTS/C768r15n3.csh @@ -20,7 +20,7 @@ endif set RELEASE = "`cat ${BUILD_AREA}/../SHiELD_SRC/release`" -source ${BUILD_AREA}/site/environment.${COMPILER}.sh +source ${BUILD_AREA}/site/environment.${COMPILER}.csh # case specific details set TYPE = "nh" # choices: nh, hydro diff --git a/RTS/GAEA_RTS/Regional3km.csh b/RTS/GAEA_RTS/Regional3km.csh index ab05e82..5f729a2 100755 --- a/RTS/GAEA_RTS/Regional3km.csh +++ b/RTS/GAEA_RTS/Regional3km.csh @@ -20,7 +20,7 @@ endif set RELEASE = "`cat ${BUILD_AREA}/../SHiELD_SRC/release`" -source ${BUILD_AREA}/site/environment.${COMPILER}.sh +source ${BUILD_AREA}/site/environment.${COMPILER}.csh #set hires_oro_factor = 12 set res = 3072 diff --git a/site/environment.gnu.csh b/site/environment.gnu.csh new file mode 100755 index 0000000..047251a --- /dev/null +++ b/site/environment.gnu.csh @@ -0,0 +1,57 @@ +#!/bin/csh +#*********************************************************************** +#* GNU Lesser General Public License +#* +#* This file is part of the SHiELD Build System. +#* +#* The SHiELD Build System free software: you can redistribute it +#* and/or modify it under the terms of the +#* GNU Lesser General Public License as published by the +#* Free Software Foundation, either version 3 of the License, or +#* (at your option) any later version. +#* +#* The SHiELD Build System distributed in the hope that it will be +#* useful, but WITHOUT ANYWARRANTY; without even the implied warranty +#* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +#* See the GNU General Public License for more details. +#* +#* You should have received a copy of the GNU Lesser General Public +#* License along with theSHiELD Build System +#* If not, see . +#*********************************************************************** +# +# DISCLAIMER: This script is provided as-is and as such is unsupported. +# + +set hostname=`hostname` + +switch ($hostname) + case gaea5?: + case c5n*: + echo " gaea C5 environment " + source ${MODULESHOME}/init/csh + module unload PrgEnv-pgi PrgEnv-intel PrgEnv-gnu + module rm intel-classic + module rm intel-oneapi + module rm intel + module load PrgEnv-gnu + module rm gcc + module load gcc-native/13.2 + module load cray-hdf5/1.12.2.11 + module load cray-netcdf/4.9.0.11 + module load craype-hugepages4M + module load cmake/3.23.1 + module load libyaml/0.2.5 + + # Needed with the new Environment on C5 as of 10/16/2024 + setenv FI_VERBS_PREFER_XRC 0 + + setenv LAUNCHER "srun" + + echo -e ' ' + module list + breaksw + default: + echo " no environment available based on the hostname " + breaksw +endsw diff --git a/site/environment.gnu.sh b/site/environment.gnu.sh index f91e287..3fba16a 100755 --- a/site/environment.gnu.sh +++ b/site/environment.gnu.sh @@ -35,15 +35,17 @@ case $hostname in module rm intel module load PrgEnv-gnu module rm gcc - module load gcc/10.3.0 - module load cray-hdf5/1.12.2.3 - module load cray-netcdf/4.9.0.3 + module load gcc-native/13.2 + module load cray-hdf5/1.12.2.11 + module load cray-netcdf/4.9.0.11 module load craype-hugepages4M module load cmake/3.23.1 module load libyaml/0.2.5 # Add -DHAVE_GETTID to the FMS cppDefs export FMS_CPPDEFS=-DHAVE_GETTID + # Needed with the new Environment on C5 as of 10/16/2024 + export FI_VERBS_PREFER_XRC=0 # make your compiler selections here export FC=ftn diff --git a/site/environment.intel.csh b/site/environment.intel.csh new file mode 100755 index 0000000..c54e13b --- /dev/null +++ b/site/environment.intel.csh @@ -0,0 +1,87 @@ +#!/bin/csh +#*********************************************************************** +#* GNU Lesser General Public License +#* +#* This file is part of the SHiELD Build System. +#* +#* The SHiELD Build System free software: you can redistribute it +#* and/or modify it under the terms of the +#* GNU Lesser General Public License as published by the +#* Free Software Foundation, either version 3 of the License, or +#* (at your option) any later version. +#* +#* The SHiELD Build System distributed in the hope that it will be +#* useful, but WITHOUT ANYWARRANTY; without even the implied warranty +#* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +#* See the GNU General Public License for more details. +#* +#* You should have received a copy of the GNU Lesser General Public +#* License along with theSHiELD Build System +#* If not, see . +#*********************************************************************** +# +# DISCLAIMER: This script is provided as-is and as such is unsupported. +# + + +set hostname=`hostname` + +switch ($hostname) + case gaea6?: + case c6n*: + echo " gaea C6 environment " + + source ${MODULESHOME}/init/csh + module unload PrgEnv-pgi PrgEnv-intel PrgEnv-gnu + module unload darshan-runtime + module load PrgEnv-intel + module rm intel-classic + module rm intel-oneapi + module rm intel + module rm gcc + module load intel-classic/2023.2.0 + module unload cray-libsci + module load cray-hdf5 + module load cray-netcdf + module load craype-hugepages4M + #module load cmake/3.23.1 + #module load libyaml/0.2.5 + + setenv LAUNCHER "srun" + + echo -e ' ' + module list + breaksw + case gaea5?: + case c5n*: + echo " gaea C5 environment " + + source ${MODULESHOME}/init/csh + module unload PrgEnv-pgi PrgEnv-intel PrgEnv-gnu + module unload darshan-runtime + module load PrgEnv-intel + module rm intel-classic + module rm intel-oneapi + module rm intel + module rm gcc + module load intel-classic/2023.2.0 + module unload cray-libsci + module load cray-hdf5/1.12.2.11 + module load cray-netcdf/4.9.0.11 + module load craype-hugepages4M + module load cmake/3.23.1 + module load libyaml/0.2.5 + + # Needed with the new Environment on C5 as of 10/16/2024 + setenv FI_VERBS_PREFER_XRC 0 + + setenv LAUNCHER "srun" + + echo -e ' ' + module list + breaksw + default: + echo " no environment available based on the hostname " + breaksw +endsw + diff --git a/site/environment.intel.sh b/site/environment.intel.sh index b3eced6..d30932d 100755 --- a/site/environment.intel.sh +++ b/site/environment.intel.sh @@ -27,26 +27,64 @@ hostname=`hostname` case $hostname in - gaea5? | c5n* ) - echo " gaea C5 environment " + gaea6? | c6n* ) + echo " gaea C6 environment " . ${MODULESHOME}/init/sh module unload PrgEnv-pgi PrgEnv-intel PrgEnv-gnu + module unload darshan-runtime module load PrgEnv-intel module rm intel-classic module rm intel-oneapi module rm intel module rm gcc - module load intel-classic/2022.2.1 + module load intel-classic/2023.2.0 module unload cray-libsci module load cray-hdf5 module load cray-netcdf module load craype-hugepages4M + #module load cmake/3.23.1 + #module load libyaml/0.2.5 + + # Add -DHAVE_GETTID to the FMS cppDefs + export FMS_CPPDEFS=-DHAVE_GETTID + + # make your compiler selections here + export FC=ftn + export CC=cc + export CXX=CC + export LD=ftn + export TEMPLATE=site/intel.mk + export LAUNCHER=srun + + # highest level of AVX support + export AVX_LEVEL=-march=core-avx2 + echo -e ' ' + module list + ;; + gaea5? | c5n* ) + echo " gaea C5 environment " + + . ${MODULESHOME}/init/sh + module unload PrgEnv-pgi PrgEnv-intel PrgEnv-gnu + module unload darshan-runtime + module load PrgEnv-intel + module rm intel-classic + module rm intel-oneapi + module rm intel + module rm gcc + module load intel-classic/2023.2.0 + module unload cray-libsci + module load cray-hdf5/1.12.2.11 + module load cray-netcdf/4.9.0.11 + module load craype-hugepages4M module load cmake/3.23.1 module load libyaml/0.2.5 # Add -DHAVE_GETTID to the FMS cppDefs export FMS_CPPDEFS=-DHAVE_GETTID + # Needed with the new Environment on C5 as of 10/16/2024 + export FI_VERBS_PREFER_XRC=0 # make your compiler selections here export FC=ftn @@ -207,6 +245,33 @@ case $hostname in fi echo -e ' ' module list + ;; + stellar* ) + echo " Stellar environment " + + . ${MODULESHOME}/init/sh + module purge + module load cmake/3.19.7 + module load intel/2021.1.2 + module load openmpi/intel-2021.1/4.1.2 + module load netcdf/intel-2021.1/hdf5-1.10.6/4.7.4 + module load hdf5/intel-2021.1/1.10.6 + + export FMS_CPPDEFS="" + + # make your compiler selections here + export FC=mpif90 + export CC=mpicc + export CXX=mpicxx + export LD=mpif90 + export TEMPLATE=site/intel.mk + export LAUNCHER=srun + + # highest level of AVX support + export AVX_LEVEL=-march=core-avx2 + echo -e ' ' + module list + ;; * ) echo " no environment available based on the hostname " diff --git a/site/gnu.mk b/site/gnu.mk index e14ac7d..8ca84f1 100644 --- a/site/gnu.mk +++ b/site/gnu.mk @@ -15,6 +15,7 @@ DEBUG = REPRO = VERBOSE = OPENMP = +PIC = ############################################## # Need to use at least GNU Make version 3.81 # @@ -60,6 +61,15 @@ FFLAGS += -march=native CFLAGS += -march-native endif +# For some applications, namely wrapping SHiELD in Python, it can be required to +# compile all libraries as position independent code. Setting the PIC option to +# 'Y' with this Makefile template will enable this. +ifeq ($(PIC),Y) +FFLAGS += -fPIC +CFLAGS += -fPIC +CPPFLAGS += -fPIC +endif + FFLAGS_OPT = -O2 -fno-range-check FFLAGS_REPRO = -O2 -ggdb -fno-range-check FFLAGS_DEBUG = -O0 -ggdb -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check diff --git a/site/intel.mk b/site/intel.mk index 26dace6..e8b2b87 100644 --- a/site/intel.mk +++ b/site/intel.mk @@ -15,6 +15,7 @@ DEBUG = REPRO = VERBOSE = OPENMP = +PIC = ############################################## # Need to use at least GNU Make version 3.81 # @@ -59,6 +60,15 @@ FFLAGS += -xCORE-AVX-I -qno-opt-dynamic-align CFLAGS += -xCORE-AVX-I -qno-opt-dynamic-align endif +# For some applications, namely wrapping SHiELD in Python, it can be required to +# compile all libraries as position independent code. Setting the PIC option to +# 'Y' with this Makefile template will enable this. +ifeq ($(PIC),Y) +FFLAGS += -fPIC +CFLAGS += -fPIC +CPPFLAGS += -fPIC +endif + FFLAGS_OPT = -O2 -debug minimal -fp-model source -qoverride-limits -qopt-prefetch=3 FFLAGS_REPRO = -O2 -debug minimal -fp-model source -qoverride-limits #-fpe0 #causes problems?? FFLAGS_DEBUG = -g -O0 -debug -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fp-stack-check -fstack-protector-all -fpe0 -ftrapuv diff --git a/site/nvhpc.mk b/site/nvhpc.mk index fed4159..5b5e1d7 100644 --- a/site/nvhpc.mk +++ b/site/nvhpc.mk @@ -15,6 +15,7 @@ DEBUG = REPRO = VERBOSE = OPENMP = +PIC = ############################################## # Need to use at least GNU Make version 3.81 # @@ -56,6 +57,15 @@ FFLAGS += -tp=host CFLAGS += -tp=host endif +# For some applications, namely wrapping SHiELD in Python, it can be required to +# compile all libraries as position independent code. Setting the PIC option to +# 'Y' with this Makefile template will enable this. +ifeq ($(PIC),Y) +FFLAGS += -fPIC +CFLAGS += -fPIC +CPPFLAGS += -fPIC +endif + FFLAGS_OPT = -g -O3 -Mvect=nosse -Mnoscalarsse -Mallocatable=95 FFLAGS_REPRO = -g -O2 -Mvect=nosse -Mnoscalarsse FFLAGS_DEBUG = -g -O0 -Ktrap=divz