Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the CI #49

Merged
merged 2 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/.parallelworks/checkout.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#!/bin/bash -xe

##############################################################################
## User set up variables
## Root directory for CI
dirRoot=/contrib/fv3
## Intel version to be used
intelVersion=2023.2.0
##############################################################################
## HPC-ME container
container=/contrib/containers/noaa-intel-prototype_2023.09.25.sif
container_env_script=/contrib/containers/load_spack_noaa-intel.sh
##############################################################################

#Parse Arguments
branch=main
commit=""
while [[ $# -gt 0 ]]; do
case $1 in
-b|--branch)
branch="$2"
shift # past argument
shift # past value
;;
-h|--hash)
commit="$2"
shift # past argument
shift # past value
;;
*)
echo "unknown argument"
exit 1
;;
esac
done

echo "branch is $branch"
echo "commit is $commit"


## Set up the directories
testDir=${dirRoot}/${intelVersion}/SHiELD_physics/${branch}/${commit}
logDir=${testDir}/log
export MODULESHOME=/usr/share/lmod/lmod
#Define External Libs path
export EXTERNAL_LIBS=${dirRoot}/${intelVersion}/SHiELD_physics/externallibs
mkdir -p ${EXTERNAL_LIBS}
## create directories
rm -rf ${testDir}
mkdir -p ${logDir}
# salloc commands to start up
#2 tests layout 8,8 (16 nodes)
#2 tests layout 4,8 (8 nodes)
#9 tests layout 4,4 (18 nodes)
#5 tests layout 4,1 (5 nodes)
#17 tests layout 2,2 (17 nodes)
#salloc --partition=p2 -N 64 -J ${branch} sleep 20m &

## clone code
cd ${testDir}
git clone --recursive https://github.com/NOAA-GFDL/SHiELD_build.git

##checkout components
cd ${testDir}/SHiELD_build && ./CHECKOUT_code

## Check out the PR
cd ${testDir}/SHiELD_SRC/SHiELD_physcis && git fetch origin ${branch}:toMerge && git merge toMerge

##Check if we already have FMS compiled and recompile if version doesn't match what is in SHiELD_build checkout script
grep -m 1 "fms_release" ${testDir}/SHiELD_build/CHECKOUT_code > ${logDir}/release.txt
source ${logDir}/release.txt
echo ${fms_release}
echo `cat ${EXTERNAL_LIBS}/FMSversion`
if [[ ${fms_release} != `cat ${EXTERNAL_LIBS}/FMSversion` ]]
then
#remove libFMS if it exists
if [ -d $EXTERNAL_LIBS/libFMS ]
then
rm -rf $EXTERNAL_LIBS/libFMS
fi
if [ -e $EXTERNAL_LIBS/FMSversion ]
then
rm $EXTERNAL_LIBS/FMSversion
fi
echo $fms_release > $EXTERNAL_LIBS/FMSversion
echo $container > $EXTERNAL_LIBS/FMScontainerversion
echo $container_env_script >> $EXTERNAL_LIBS/FMScontainerversion
# Build FMS
cd ${testDir}/SHiELD_build/Build
set -o pipefail
singularity exec -B /contrib ${container} ${container_env_script} "./BUILDlibfms intel"
fi
84 changes: 84 additions & 0 deletions .github/.parallelworks/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/bin/bash -xe

##############################################################################
## User set up variables
## Root directory for CI
dirRoot=/contrib/fv3
## Intel version to be used
intelVersion=2023.2.0
##############################################################################
## HPC-ME container
container=/contrib/containers/noaa-intel-prototype_2023.09.25.sif
container_env_script=/contrib/containers/load_spack_noaa-intel.sh
##############################################################################

#Parse Arguments
branch=main
commit=""
while [[ $# -gt 0 ]]; do
case $1 in
-b|--branch)
branch="$2"
shift # past argument
shift # past value
;;
-h|--hash)
commit="$2"
shift # past argument
shift # past value
;;
-c|--config)
config="$2"
shift # past argument
shift # past value
;;
--hydro)
hydro="$2"
shift # past argument
shift # past value
;;
--bit)
bit="$2"
shift # past argument
shift # past value
;;
-m|--mode)
mode="$2"
shift # past argument
shift # past value
;;
*)
echo "unknown argument"
exit 1
;;
esac
done

if [ -z $mode ] || [ -z $bit ] || [ -z $hydro ] || [ -z $config ]
then
echo "must specify config, hydro, bit, and mode options for compile"
exit 1
fi

echo "branch is $branch"
echo "commit is $commit"
echo "mode is $mode"
echo "bit is $bit"
echo "hydro is $hydro"
echo "config is $config"

if [ $hydro = "sw" ] && [ $config = "shield" ]
then
echo "this combination should not be tested"
else
## Set up the directories
testDir=${dirRoot}/${intelVersion}/SHiELD_physics/${branch}/${commit}
logDir=${testDir}/log
# Set up build
cd ${testDir}/SHiELD_build/Build
#Define External Libs path
export EXTERNAL_LIBS=${dirRoot}/${intelVersion}/SHiELD_physics/externallibs
# Build SHiELD
set -o pipefail
singularity exec -B /contrib ${container} ${container_env_script} "./COMPILE ${config} ${hydro} ${bit} ${mode} intel clean"
fi
89 changes: 89 additions & 0 deletions .github/.parallelworks/run_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/bin/bash -xe
ulimit -s unlimited
##############################################################################
## User set up veriables
## Root directory for CI
dirRoot=/contrib/fv3
## Intel version to be used
intelVersion=2023.2.0
##############################################################################
## HPC-ME container
container=/contrib/containers/noaa-intel-prototype_2023.09.25.sif
container_env_script=/contrib/containers/load_spack_noaa-intel.sh
##############################################################################

#Parse Arguments
branch=main
commit=""
while [[ $# -gt 0 ]]; do
case $1 in
-b|--branch)
branch="$2"
shift # past argument
shift # past value
;;
-h|--hash)
commit="$2"
shift # past argument
shift # past value
;;
-t|--test)
testname="$2"
shift # past argument
shift # past value
;;
*)
echo "unknown argument"
exit 1
;;
esac
done

if [ -z $testname ]
then
echo "must specify a test name with -t"
exit 1
fi

echo "branch is $branch"
echo "commit is $commit"
echo "test is $testname"

## Set up the directories
MODULESHOME=/usr/share/lmod/lmod
testDir=${dirRoot}/${intelVersion}/SHiELD_physics/${branch}/${commit}
logDir=${testDir}/log
baselineDir=${dirRoot}/baselines/intel/${intelVersion}

## Run the CI Test
# Define the builddir testscriptdir and rundir
# Set the BUILDDIR for the test script to use
export BUILDDIR="${testDir}/SHiELD_build"
testscriptDir=${BUILDDIR}/RTS/CI
runDir=${BUILDDIR}/CI/BATCH-CI

# Run CI test scripts
cd ${testscriptDir}
set -o pipefail
# Execute the test piping output to log file
./${testname} " --partition=p2 --mpi=pmi2 --job-name=${commit}_${testname} singularity exec -B /contrib ${container} ${container_env_script}" |& tee ${logDir}/run_${testname}.log

## Compare Restarts to Baseline
#The following tests are not expectred to have run-to-run reproducibility:
#d96_2k.solo.bubble
#d96_2k.solo.bubble.n0
#d96_2k.solo.bubble.nhK
if [[ ${testname} == "d96_2k.solo.bubble" || ${testname} == "d96_2k.solo.bubble.n0" || ${testname} == "d96_2k.solo.bubble.nhK" ]]
then
echo "${testname} is not expected to reproduce so answers were not compared"
else
source $MODULESHOME/init/sh
export MODULEPATH=/mnt/shared/manual_modules:/usr/share/modulefiles/Linux:/usr/share/modulefiles/Core:/usr/share/lmod/lmod/modulefiles/Core:/apps/modules/modulefiles:/apps/modules/modulefamilies/intel
module load intel/2022.1.2
module load netcdf
module load nccmp
for resFile in `ls ${baselineDir}/${testname}`
do
nccmp -d ${baselineDir}/${testname}/${resFile} ${runDir}/${testname}/RESTART/${resFile}
done
fi
Loading