From 095f3bf6484c660886682d9970a330a95b17a76d Mon Sep 17 00:00:00 2001 From: turner Date: Mon, 12 Jun 2017 15:35:54 +0000 Subject: [PATCH 01/29] Test scripts now write to README.case instead of a separate README.test. Replace the cice..csh scripts with cice.test.csh. --- configuration/scripts/tests/cice.10day.csh | 173 -------------------- configuration/scripts/tests/cice.annual.csh | 173 -------------------- configuration/scripts/tests/cice.smoke.csh | 173 -------------------- create.case | 6 +- 4 files changed, 3 insertions(+), 522 deletions(-) delete mode 100755 configuration/scripts/tests/cice.10day.csh delete mode 100755 configuration/scripts/tests/cice.annual.csh delete mode 100755 configuration/scripts/tests/cice.smoke.csh diff --git a/configuration/scripts/tests/cice.10day.csh b/configuration/scripts/tests/cice.10day.csh deleted file mode 100755 index 06d95d340..000000000 --- a/configuration/scripts/tests/cice.10day.csh +++ /dev/null @@ -1,173 +0,0 @@ -#! /bin/csh -f - -echo ${0} - -source ./cice.settings -source ${CICE_CASEDIR}/env.${CICE_MACHINE} || exit 2 - -set jobfile = cice.10day -set subfile = cice.submit - -set ntasks = ${CICE_NTASKS} -set nthrds = ${CICE_NTHRDS} -set maxtpn = ${CICE_MACHINE_TPNODE} -set acct = ${CICE_MACHINE_ACCT} - -@ taskpernode = ${maxtpn} / $nthrds -@ nnodes = ${ntasks} / ${taskpernode} -if (${nnodes} * ${taskpernode} < ${ntasks}) @ nnodes = $nnodes + 1 -set taskpernodelimit = ${taskpernode} -if (${taskpernodelimit} > ${ntasks}) set taskpernodelimit = ${ntasks} - -set ptile = $taskpernode -if ($ptile > ${maxtpn} / 2) @ ptile = ${maxtpn} / 2 - -#========================================== - -# Create test script that runs cice.build, cice.run, and validates -#========================================== - -cat >! ${jobfile} << EOF0 -#!/bin/csh -f -EOF0 - -#========================================== - -if (${CICE_MACHINE} =~ yellowstone*) then -cat >> ${jobfile} << EOFB -#BSUB -n ${ntasks} -#BSUB -R "span[ptile=${ptile}]" -#BSUB -q caldera -#BSUB -N -###BSUB -x -#BSUB -a poe -#BSUB -o poe.stdout.%J -#BSUB -e poe.stderr.%J -#BSUB -J ${CICE_CASENAME} -#BSUB -W 0:10 -#BSUB -P ${acct} -EOFB - -else if (${CICE_MACHINE} =~ thunder* || ${CICE_MACHINE} =~ gordon* || ${CICE_MACHINE} =~ conrad*) then -cat >> ${jobfile} << EOFB -#PBS -N ${CICE_CASENAME} -#PBS -q debug -#PBS -A ${acct} -#PBS -l select=${nnodes}:ncpus=${maxtpn}:mpiprocs=${taskpernode} -#PBS -l walltime=0:10:00 -#PBS -j oe -###PBS -M username@domain.com -###PBS -m be -EOFB - -else if (${CICE_MACHINE} =~ cori*) then -cat >> ${jobfile} << EOFB -#SBATCH -J ${CICE_CASENAME} -#SBATCH -p debug -###SBATCH -A ${acct} -#SBATCH -N ${nnodes} -#SBATCH -t 0:10:00 -#SBATCH -L SCRATCH -#SBATCH -C haswell -###SBATCH -e filename -###SBATCH -o filename -###SBATCH --mail-type FAIL -###SBATCH --mail-user username@domain.com -EOFB - -else if (${CICE_MACHINE} =~ wolf*) then -cat >> ${jobfile} << EOFB -#MSUB -A climateacme -#MSUB -l walltime=01:00:00 -#MSUB -l nodes=1:ppn=4 -#MSUB -N cice -EOFB -#cat >> ${jobfile} << EOFB -##SBATCH -J ${CICE_CASENAME} -####SBATCH -p tossdev -##SBATCH -t 0:45:00 -##SBATCH -A ${acct} -##SBATCH -N ${nnodes} -####SBATCH -L SCRATCH -####SBATCH -C haswell -##SBATCH -e slurm%j.err -##SBATCH -o slurm%j.out -####SBATCH --mail-type FAIL -####SBATCH --mail-user username@domain.com -#EOFB - -endif - -cat >> ${jobfile} << EOF2 -cd ${CICE_CASEDIR} -source ./cice.settings || exit 2 -source ./env.\${CICE_MACHINE} || exit 2 - -# Compile the CICE code -./cice.build -set rc_build = \$? - -# Run the CICE model -./cice.run -set rc_run = \$? - -EOF2 - -if ($1 != "") then -cat >> ${jobfile} << EOF3 - # Get the final output filename - foreach file (\${CICE_RUNDIR}/restart/*) - set test_data = \$file - end - - set baseline_data = $1/\$test_data:t - - if ( { cmp -s \$test_data \$baseline_data } ) then - set rc_valid = 0 - else - set rc_valid = 1 - endif -EOF3 -endif - -cat >> ${jobfile} << EOF4 - -if (\$rc_build == 0) then - echo "Build: PASS" -else - echo "Build: FAIL" -endif - -if (\$rc_run == 0) then - echo "Run: PASS" -else - echo "Run: FAIL" -endif -EOF4 - -if ($1 != "") then -cat >> ${jobfile} << EOF5 - -if (\$rc_valid == 0) then - echo "Validation: PASS" -else - echo "Validation: FAIL" -endif -EOF5 -endif - -#========================================== - -chmod +x ${jobfile} - -#========================================== - -cat >! ${subfile} << EOFS -#!/bin/csh -f - -${CICE_MACHINE_SUBMIT} ${jobfile} -echo "\`date\` \${0}: ${CICE_CASENAME} job submitted" >> ${CICE_CASEDIR}/README.test - -EOFS - -chmod +x ${subfile} diff --git a/configuration/scripts/tests/cice.annual.csh b/configuration/scripts/tests/cice.annual.csh deleted file mode 100755 index 04e256c90..000000000 --- a/configuration/scripts/tests/cice.annual.csh +++ /dev/null @@ -1,173 +0,0 @@ -#! /bin/csh -f - -echo ${0} - -source ./cice.settings -source ${CICE_CASEDIR}/env.${CICE_MACHINE} || exit 2 - -set jobfile = cice.annual -set subfile = cice.submit - -set ntasks = ${CICE_NTASKS} -set nthrds = ${CICE_NTHRDS} -set maxtpn = ${CICE_MACHINE_TPNODE} -set acct = ${CICE_MACHINE_ACCT} - -@ taskpernode = ${maxtpn} / $nthrds -@ nnodes = ${ntasks} / ${taskpernode} -if (${nnodes} * ${taskpernode} < ${ntasks}) @ nnodes = $nnodes + 1 -set taskpernodelimit = ${taskpernode} -if (${taskpernodelimit} > ${ntasks}) set taskpernodelimit = ${ntasks} - -set ptile = $taskpernode -if ($ptile > ${maxtpn} / 2) @ ptile = ${maxtpn} / 2 - -#========================================== - -# Create test script that runs cice.build, cice.run, and validates -#========================================== - -cat >! ${jobfile} << EOF0 -#!/bin/csh -f -EOF0 - -#========================================== - -if (${CICE_MACHINE} =~ yellowstone*) then -cat >> ${jobfile} << EOFB -#BSUB -n ${ntasks} -#BSUB -R "span[ptile=${ptile}]" -#BSUB -q caldera -#BSUB -N -###BSUB -x -#BSUB -a poe -#BSUB -o poe.stdout.%J -#BSUB -e poe.stderr.%J -#BSUB -J ${CICE_CASENAME} -#BSUB -W 0:10 -#BSUB -P ${acct} -EOFB - -else if (${CICE_MACHINE} =~ thunder* || ${CICE_MACHINE} =~ gordon* || ${CICE_MACHINE} =~ conrad*) then -cat >> ${jobfile} << EOFB -#PBS -N ${CICE_CASENAME} -#PBS -q debug -#PBS -A ${acct} -#PBS -l select=${nnodes}:ncpus=${maxtpn}:mpiprocs=${taskpernode} -#PBS -l walltime=0:10:00 -#PBS -j oe -###PBS -M username@domain.com -###PBS -m be -EOFB - -else if (${CICE_MACHINE} =~ cori*) then -cat >> ${jobfile} << EOFB -#SBATCH -J ${CICE_CASENAME} -#SBATCH -p debug -###SBATCH -A ${acct} -#SBATCH -N ${nnodes} -#SBATCH -t 0:10:00 -#SBATCH -L SCRATCH -#SBATCH -C haswell -###SBATCH -e filename -###SBATCH -o filename -###SBATCH --mail-type FAIL -###SBATCH --mail-user username@domain.com -EOFB - -else if (${CICE_MACHINE} =~ wolf*) then -cat >> ${jobfile} << EOFB -#MSUB -A climateacme -#MSUB -l walltime=01:00:00 -#MSUB -l nodes=1:ppn=4 -#MSUB -N cice -EOFB -#cat >> ${jobfile} << EOFB -##SBATCH -J ${CICE_CASENAME} -####SBATCH -p tossdev -##SBATCH -t 0:45:00 -##SBATCH -A ${acct} -##SBATCH -N ${nnodes} -####SBATCH -L SCRATCH -####SBATCH -C haswell -##SBATCH -e slurm%j.err -##SBATCH -o slurm%j.out -####SBATCH --mail-type FAIL -####SBATCH --mail-user username@domain.com -#EOFB - -endif - -cat >> ${jobfile} << EOF2 -cd ${CICE_CASEDIR} -source ./cice.settings || exit 2 -source ./env.\${CICE_MACHINE} || exit 2 - -# Compile the CICE code -./cice.build -set rc_build = \$? - -# Run the CICE model -./cice.run -set rc_run = \$? - -EOF2 - -if ($1 != "") then -cat >> ${jobfile} << EOF3 - # Get the final output filename - foreach file (\${CICE_RUNDIR}/restart/*) - set test_data = \$file - end - - set baseline_data = $1/\$test_data:t - - if ( { cmp -s \$test_data \$baseline_data } ) then - set rc_valid = 0 - else - set rc_valid = 1 - endif -EOF3 -endif - -cat >> ${jobfile} << EOF4 - -if (\$rc_build == 0) then - echo "Build: PASS" -else - echo "Build: FAIL" -endif - -if (\$rc_run == 0) then - echo "Run: PASS" -else - echo "Run: FAIL" -endif -EOF4 - -if ($1 != "") then -cat >> ${jobfile} << EOF5 - -if (\$rc_valid == 0) then - echo "Validation: PASS" -else - echo "Validation: FAIL" -endif -EOF5 -endif - -#========================================== - -chmod +x ${jobfile} - -#========================================== - -cat >! ${subfile} << EOFS -#!/bin/csh -f - -${CICE_MACHINE_SUBMIT} ${jobfile} -echo "\`date\` \${0}: ${CICE_CASENAME} job submitted" >> ${CICE_CASEDIR}/README.test - -EOFS - -chmod +x ${subfile} diff --git a/configuration/scripts/tests/cice.smoke.csh b/configuration/scripts/tests/cice.smoke.csh deleted file mode 100755 index d44240e80..000000000 --- a/configuration/scripts/tests/cice.smoke.csh +++ /dev/null @@ -1,173 +0,0 @@ -#! /bin/csh -f - -echo ${0} - -source ./cice.settings -source ${CICE_CASEDIR}/env.${CICE_MACHINE} || exit 2 - -set jobfile = cice.smoke -set subfile = cice.submit - -set ntasks = ${CICE_NTASKS} -set nthrds = ${CICE_NTHRDS} -set maxtpn = ${CICE_MACHINE_TPNODE} -set acct = ${CICE_MACHINE_ACCT} - -@ taskpernode = ${maxtpn} / $nthrds -@ nnodes = ${ntasks} / ${taskpernode} -if (${nnodes} * ${taskpernode} < ${ntasks}) @ nnodes = $nnodes + 1 -set taskpernodelimit = ${taskpernode} -if (${taskpernodelimit} > ${ntasks}) set taskpernodelimit = ${ntasks} - -set ptile = $taskpernode -if ($ptile > ${maxtpn} / 2) @ ptile = ${maxtpn} / 2 - -#========================================== - -# Create test script that runs cice.build, cice.run, and validates -#========================================== - -cat >! ${jobfile} << EOF0 -#!/bin/csh -f -EOF0 - -#========================================== - -if (${CICE_MACHINE} =~ yellowstone*) then -cat >> ${jobfile} << EOFB -#BSUB -n ${ntasks} -#BSUB -R "span[ptile=${ptile}]" -#BSUB -q caldera -#BSUB -N -###BSUB -x -#BSUB -a poe -#BSUB -o poe.stdout.%J -#BSUB -e poe.stderr.%J -#BSUB -J ${CICE_CASENAME} -#BSUB -W 0:10 -#BSUB -P ${acct} -EOFB - -else if (${CICE_MACHINE} =~ thunder* || ${CICE_MACHINE} =~ gordon* || ${CICE_MACHINE} =~ conrad*) then -cat >> ${jobfile} << EOFB -#PBS -N ${CICE_CASENAME} -#PBS -q debug -#PBS -A ${acct} -#PBS -l select=${nnodes}:ncpus=${maxtpn}:mpiprocs=${taskpernode} -#PBS -l walltime=0:10:00 -#PBS -j oe -###PBS -M username@domain.com -###PBS -m be -EOFB - -else if (${CICE_MACHINE} =~ cori*) then -cat >> ${jobfile} << EOFB -#SBATCH -J ${CICE_CASENAME} -#SBATCH -p debug -###SBATCH -A ${acct} -#SBATCH -N ${nnodes} -#SBATCH -t 0:10:00 -#SBATCH -L SCRATCH -#SBATCH -C haswell -###SBATCH -e filename -###SBATCH -o filename -###SBATCH --mail-type FAIL -###SBATCH --mail-user username@domain.com -EOFB - -else if (${CICE_MACHINE} =~ wolf*) then -cat >> ${jobfile} << EOFB -#MSUB -A climateacme -#MSUB -l walltime=01:00:00 -#MSUB -l nodes=1:ppn=4 -#MSUB -N cice -EOFB -#cat >> ${jobfile} << EOFB -##SBATCH -J ${CICE_CASENAME} -####SBATCH -p tossdev -##SBATCH -t 0:45:00 -##SBATCH -A ${acct} -##SBATCH -N ${nnodes} -####SBATCH -L SCRATCH -####SBATCH -C haswell -##SBATCH -e slurm%j.err -##SBATCH -o slurm%j.out -####SBATCH --mail-type FAIL -####SBATCH --mail-user username@domain.com -#EOFB - -endif - -cat >> ${jobfile} << EOF2 -cd ${CICE_CASEDIR} -source ./cice.settings || exit 2 -source ./env.\${CICE_MACHINE} || exit 2 - -# Compile the CICE code -./cice.build -set rc_build = \$? - -# Run the CICE model -./cice.run -set rc_run = \$? - -EOF2 - -if ($1 != "") then -cat >> ${jobfile} << EOF3 - # Get the final output filename - foreach file (\${CICE_RUNDIR}/restart/*) - set test_data = \$file - end - - set baseline_data = $1/\$test_data:t - - if ( { cmp -s \$test_data \$baseline_data } ) then - set rc_valid = 0 - else - set rc_valid = 1 - endif -EOF3 -endif - -cat >> ${jobfile} << EOF4 - -if (\$rc_build == 0) then - echo "Build: PASS" -else - echo "Build: FAIL" -endif - -if (\$rc_run == 0) then - echo "Run: PASS" -else - echo "Run: FAIL" -endif -EOF4 - -if ($1 != "") then -cat >> ${jobfile} << EOF5 - -if (\$rc_valid == 0) then - echo "Validation: PASS" -else - echo "Validation: FAIL" -endif -EOF5 -endif - -#========================================== - -chmod +x ${jobfile} - -#========================================== - -cat >! ${subfile} << EOFS -#!/bin/csh -f - -${CICE_MACHINE_SUBMIT} ${jobfile} -echo "\`date\` \${0}: ${CICE_CASENAME} job submitted" >> ${CICE_CASEDIR}/README.test - -EOFS - -chmod +x ${subfile} diff --git a/create.case b/create.case index c8c1c7fa3..7d723ecdb 100755 --- a/create.case +++ b/create.case @@ -176,7 +176,7 @@ else exit -1 endif mkdir -p $testname - echo "`date`${0} $initargv[*]" > $testname/README.test + echo "`date`${0} $initargv[*]" > $testname/README.case set case = $testname endif @@ -330,10 +330,10 @@ if ($test != $spval) then source ./env.${mach} || exit 2 if ($baseline == 0) then - ${CICE_SCRDIR}/tests/cice.${test}.csh $bdir + ${CICE_SCRDIR}/tests/cice.test.csh $bdir else # Generate baseline dataset - ${CICE_SCRDIR}/tests/cice.${test}.csh + ${CICE_SCRDIR}/tests/cice.test.csh endif endif From 34cd5f05fdd2c464148902ae9e1e3058176489d6 Mon Sep 17 00:00:00 2001 From: turner Date: Mon, 12 Jun 2017 15:37:17 +0000 Subject: [PATCH 02/29] when checking for compile success, write PASS/FAIL to new test_output file if the CICE_TEST variable is defined --- configuration/scripts/cice.build | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/configuration/scripts/cice.build b/configuration/scripts/cice.build index d71d1fd6b..2c684c769 100755 --- a/configuration/scripts/cice.build +++ b/configuration/scripts/cice.build @@ -80,6 +80,10 @@ gmake -j ${CICE_MACHINE_BLDTHRDS} VPFILE=Filepath EXEC=${CICE_RUNDIR}/cice CICE_ if ($status != 0) then echo "${0}: COMPILE FAILED, see" echo " cat ${CICE_OBJDIR}/${CICE_BLDLOG_FILE}" + if ( $?CICE_TEST ) then + # This is a test case. Write output to test_output file + echo "FAIL $CICE_CASENAME build" >> ${CICE_CASEDIR}/test_output + endif exit 99 endif @@ -87,4 +91,7 @@ if !(-d ${CICE_LOGDIR}) mkdir -p ${CICE_LOGDIR} cp -p ${CICE_BLDLOG_FILE} ${CICE_LOGDIR}/ echo "`date` ${0}:${CICE_CASENAME} build completed ${CICE_BLDLOG_FILE}" >> ${CICE_CASEDIR}/README.case echo "${0}: COMPILE SUCCESSFUL, ${CICE_LOGDIR}/${CICE_BLDLOG_FILE}" +if ( $?CICE_TEST ) then + echo "PASS $CICE_CASENAME build" >> ${CICE_CASEDIR}/test_output +endif From cfabe1530daa330e78b1861bf02b7480711a7a0d Mon Sep 17 00:00:00 2001 From: turner Date: Mon, 12 Jun 2017 15:38:33 +0000 Subject: [PATCH 03/29] update cice.run.setup.csh to add the option to write PASS/FAIL information to the test_output file (only if CICE_TEST is defined) --- configuration/scripts/cice.run.setup.csh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/configuration/scripts/cice.run.setup.csh b/configuration/scripts/cice.run.setup.csh index 1735720c7..9a5297823 100755 --- a/configuration/scripts/cice.run.setup.csh +++ b/configuration/scripts/cice.run.setup.csh @@ -205,11 +205,22 @@ echo " " if !(-d \${CICE_LOGDIR}) mkdir -p \${CICE_LOGDIR} cp -p \${CICE_RUNLOG_FILE} \${CICE_LOGDIR} -grep ' CICE COMPLETED SUCCESSFULLY' \${CICE_RUNLOG_FILE} || echo "CICE run did not complete - see \${CICE_LOGDIR}/\${CICE_RUNLOG_FILE}" && exit -1 +grep ' CICE COMPLETED SUCCESSFULLY' \${CICE_RUNLOG_FILE} +if ( \$? != 0 ) then + echo "CICE run did not complete - see \${CICE_LOGDIR}/\${CICE_RUNLOG_FILE}" + if ( \$?CICE_TEST ) then + echo "FAIL \${CICE_CASENAME} run" >> \${CICE_CASEDIR}/test_output + endif + exit -1 +endif echo "\`date\` \${0}: \${CICE_CASENAME} run completed \${CICE_RUNLOG_FILE}" >> \${CICE_CASEDIR}/README.case echo "done \${0}" +if ( \$?CICE_TEST ) then + echo "PASS \${CICE_CASENAME} run" >> \${CICE_CASEDIR}/test_output +endif + EOFE #========================================== From 0c8766135d27883e2351155c3774d55270044cca Mon Sep 17 00:00:00 2001 From: turner Date: Mon, 12 Jun 2017 15:40:41 +0000 Subject: [PATCH 04/29] delete old cice..csh scripts and replace with cice.test.csh script. The cice.test.csh script adds a new environment variable (CICE_TEST) to cice.settings. The build process has been removed from cice.test.csh, and replaced with a check to see if the executable exists. If not, the script prints an error message and exits. --- configuration/scripts/tests/cice.test.csh | 159 ++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100755 configuration/scripts/tests/cice.test.csh diff --git a/configuration/scripts/tests/cice.test.csh b/configuration/scripts/tests/cice.test.csh new file mode 100755 index 000000000..953baf4e3 --- /dev/null +++ b/configuration/scripts/tests/cice.test.csh @@ -0,0 +1,159 @@ +#! /bin/csh -f + +echo ${0} + +# Define this as a test case in the cice.settings file +cat >> ./cice.settings << EOF + +# Add variable defining this case_dir as a test +setenv CICE_TEST true +EOF + +source ./cice.settings +source ${CICE_CASEDIR}/env.${CICE_MACHINE} || exit 2 + +set jobfile = cice.test +set subfile = cice.submit + +set ntasks = ${CICE_NTASKS} +set nthrds = ${CICE_NTHRDS} +set maxtpn = ${CICE_MACHINE_TPNODE} +set acct = ${CICE_MACHINE_ACCT} + +@ taskpernode = ${maxtpn} / $nthrds +@ nnodes = ${ntasks} / ${taskpernode} +if (${nnodes} * ${taskpernode} < ${ntasks}) @ nnodes = $nnodes + 1 +set taskpernodelimit = ${taskpernode} +if (${taskpernodelimit} > ${ntasks}) set taskpernodelimit = ${ntasks} + +set ptile = $taskpernode +if ($ptile > ${maxtpn} / 2) @ ptile = ${maxtpn} / 2 + +#========================================== + +# Create test script that runs cice.run, and validates +#========================================== + +cat >! ${jobfile} << EOF0 +#!/bin/csh -f +EOF0 + +#========================================== + +if (${CICE_MACHINE} =~ yellowstone*) then +cat >> ${jobfile} << EOFB +#BSUB -n ${ntasks} +#BSUB -R "span[ptile=${ptile}]" +#BSUB -q caldera +#BSUB -N +###BSUB -x +#BSUB -a poe +#BSUB -o poe.stdout.%J +#BSUB -e poe.stderr.%J +#BSUB -J ${CICE_CASENAME} +#BSUB -W 0:10 +#BSUB -P ${acct} +EOFB + +else if (${CICE_MACHINE} =~ thunder* || ${CICE_MACHINE} =~ gordon* || ${CICE_MACHINE} =~ conrad*) then +cat >> ${jobfile} << EOFB +#PBS -N ${CICE_CASENAME} +#PBS -q debug +#PBS -A ${acct} +#PBS -l select=${nnodes}:ncpus=${maxtpn}:mpiprocs=${taskpernode} +#PBS -l walltime=0:10:00 +#PBS -j oe +###PBS -M username@domain.com +###PBS -m be +EOFB + +else if (${CICE_MACHINE} =~ cori*) then +cat >> ${jobfile} << EOFB +#SBATCH -J ${CICE_CASENAME} +#SBATCH -p debug +###SBATCH -A ${acct} +#SBATCH -N ${nnodes} +#SBATCH -t 0:10:00 +#SBATCH -L SCRATCH +#SBATCH -C haswell +###SBATCH -e filename +###SBATCH -o filename +###SBATCH --mail-type FAIL +###SBATCH --mail-user username@domain.com +EOFB + +else if (${CICE_MACHINE} =~ wolf*) then +cat >> ${jobfile} << EOFB +#MSUB -A climateacme +#MSUB -l walltime=01:00:00 +#MSUB -l nodes=1:ppn=4 +#MSUB -N cice +EOFB +#cat >> ${jobfile} << EOFB +##SBATCH -J ${CICE_CASENAME} +####SBATCH -p tossdev +##SBATCH -t 0:45:00 +##SBATCH -A ${acct} +##SBATCH -N ${nnodes} +####SBATCH -L SCRATCH +####SBATCH -C haswell +##SBATCH -e slurm%j.err +##SBATCH -o slurm%j.out +####SBATCH --mail-type FAIL +####SBATCH --mail-user username@domain.com +#EOFB + +endif + +cat >> ${jobfile} << EOF2 +cd ${CICE_CASEDIR} +source ./cice.settings || exit 2 +source ./env.\${CICE_MACHINE} || exit 2 + +# Check to see if executable exists in CICE_RUNDIR +if ( ! -f \${CICE_RUNDIR}/cice ) then + echo "cice executable does not exist in \${CICE_RUNDIR}. " + echo "Please run cice.build before this test." + exit 99 +endif + +# Run the CICE model +./cice.run + +EOF2 + +if ($1 != "") then +cat >> ${jobfile} << EOF3 + # Get the final output filename + foreach file (\${CICE_RUNDIR}/restart/*) + set test_data = \$file + end + + set baseline_data = $1/\$test_data:t + + echo "Performing binary comparison between files:" + echo "baseline: \$baseline_data" + echo "test: \$test_data" + if ( { cmp -s \$test_data \$baseline_data } ) then + echo "PASS \${CICE_CASENAME} test" >> ${CICE_CASEDIR}/test_output + else + echo "FAIL \${CICE_CASENAME} test" >> ${CICE_CASEDIR}/test_output + endif +EOF3 +endif + +#========================================== + +chmod +x ${jobfile} + +#========================================== + +cat >! ${subfile} << EOFS +#!/bin/csh -f + +${CICE_MACHINE_SUBMIT} ${jobfile} +echo "\`date\` \${0}: ${CICE_CASENAME} job submitted" >> ${CICE_CASEDIR}/README.case + +EOFS + +chmod +x ${subfile} From b2aafa274fb5f3dd648ad94267476f083e5369f3 Mon Sep 17 00:00:00 2001 From: turner Date: Mon, 12 Jun 2017 16:32:04 +0000 Subject: [PATCH 05/29] Move batch logic from cice.run.setup.csh and cice.test.csh to new cice.batch.csh. Move job launch logic from cice.run.setup.csh and cice.test.csh to cice.launch.csh. --- .../{tests/cice.smoke.csh => cice.batch.csh} | 111 ++++-------- configuration/scripts/cice.launch.csh | 53 ++++++ configuration/scripts/cice.run.setup.csh | 145 +-------------- configuration/scripts/tests/cice.annual.csh | 165 ------------------ configuration/scripts/tests/cice.test.csh | 80 +-------- create.case | 6 +- 6 files changed, 94 insertions(+), 466 deletions(-) rename configuration/scripts/{tests/cice.smoke.csh => cice.batch.csh} (56%) create mode 100755 configuration/scripts/cice.launch.csh delete mode 100755 configuration/scripts/tests/cice.annual.csh diff --git a/configuration/scripts/tests/cice.smoke.csh b/configuration/scripts/cice.batch.csh similarity index 56% rename from configuration/scripts/tests/cice.smoke.csh rename to configuration/scripts/cice.batch.csh index a4be7df39..3aac1056f 100755 --- a/configuration/scripts/tests/cice.smoke.csh +++ b/configuration/scripts/cice.batch.csh @@ -5,8 +5,7 @@ echo ${0} source ./cice.settings source ${CICE_CASEDIR}/env.${CICE_MACHINE} || exit 2 -set jobfile = cice.smoke -set subfile = cice.submit +set jobfile = $1 set ntasks = ${CICE_NTASKS} set nthrds = ${CICE_NTHRDS} @@ -24,9 +23,6 @@ if ($ptile > ${maxtpn} / 2) @ ptile = ${maxtpn} / 2 #========================================== -# Create test script that runs cice.build, cice.run, and validates -#========================================== - cat >! ${jobfile} << EOF0 #!/bin/csh -f EOF0 @@ -48,6 +44,20 @@ cat >> ${jobfile} << EOFB #BSUB -P ${acct} EOFB +#========================================== + +elseif (${CICE_MACHINE} =~ cheyenne*) then +cat >> ${jobfile} << EOFB +#PBS -j oe +#PBS -m ae +#PBS -V +#PBS -q regular +#PBS -N ${CICE_CASENAME} +#PBS -A ${CICE_ACCT} +#PBS -l select=${nnodes}:ncpus=${ntasks}:mpiprocs=${ntasks} +#PBS -l walltime=02:00:00 +EOFB + else if (${CICE_MACHINE} =~ thunder* || ${CICE_MACHINE} =~ gordon* || ${CICE_MACHINE} =~ conrad*) then cat >> ${jobfile} << EOFB #PBS -N ${CICE_CASENAME} @@ -78,88 +88,27 @@ EOFB else if (${CICE_MACHINE} =~ wolf*) then cat >> ${jobfile} << EOFB #SBATCH -J ${CICE_CASENAME} -#SBATCH -t 0:10:00 +#SBATCH -t 0:45:00 #SBATCH -A ${acct} #SBATCH -N ${nnodes} #SBATCH -e slurm%j.err #SBATCH -o slurm%j.out -#SBATCH --mail-type FAIL -#SBATCH --mail-user=eclare@lanl.gov +###SBATCH --mail-type END,FAIL +###SBATCH --mail-user=eclare@lanl.gov #SBATCH --qos=low EOFB -endif - -cat >> ${jobfile} << EOF2 -cd ${CICE_CASEDIR} -source ./cice.settings || exit 2 -source ./env.\${CICE_MACHINE} || exit 2 - -# Compile the CICE code -./cice.build -set rc_build = \$? - -# Run the CICE model -./cice.run -set rc_run = \$? - -EOF2 - -if ($1 != "") then -cat >> ${jobfile} << EOF3 - # Get the final output filename - foreach file (\${CICE_RUNDIR}/restart/*) - set test_data = \$file - end - - set baseline_data = $1/\$test_data:t - - if ( { cmp -s \$test_data \$baseline_data } ) then - set rc_valid = 0 - else - set rc_valid = 1 - endif -EOF3 -endif - -cat >> ${jobfile} << EOF4 - -if (\$rc_build == 0) then - echo "Build: PASS" -else - echo "Build: FAIL" -endif - -if (\$rc_run == 0) then - echo "Run: PASS" -else - echo "Run: FAIL" -endif -EOF4 - -if ($1 != "") then -cat >> ${jobfile} << EOF5 +else if (${CICE_MACHINE} =~ pinto*) then +cat >> ${jobfile} << EOFB +#SBATCH -J ${CICE_CASENAME} +#SBATCH -t 0:45:00 +#SBATCH -A ${acct} +#SBATCH -N ${nnodes} +#SBATCH -e slurm%j.err +#SBATCH -o slurm%j.out +###SBATCH --mail-type END,FAIL +###SBATCH --mail-user=eclare@lanl.gov +#SBATCH --qos=standby +EOFB -if (\$rc_valid == 0) then - echo "Validation: PASS" -else - echo "Validation: FAIL" endif -EOF5 -endif - -#========================================== - -chmod +x ${jobfile} - -#========================================== - -cat >! ${subfile} << EOFS -#!/bin/csh -f - -${CICE_MACHINE_SUBMIT} ${jobfile} -echo "\`date\` \${0}: ${CICE_CASENAME} job submitted" >> ${CICE_CASEDIR}/README.test - -EOFS - -chmod +x ${subfile} diff --git a/configuration/scripts/cice.launch.csh b/configuration/scripts/cice.launch.csh new file mode 100755 index 000000000..4ee2805af --- /dev/null +++ b/configuration/scripts/cice.launch.csh @@ -0,0 +1,53 @@ +#! /bin/csh -f + +echo ${0} + +source ./cice.settings + +set jobfile = $1 + +set ntasks = ${CICE_NTASKS} +set nthrds = ${CICE_NTHRDS} + +#========================================== + +if (${CICE_MACHINE} =~ yellowstone*) then +cat >> ${jobfile} << EOFR +setenv MP_TASK_AFFINITY core:\${OMP_NUM_THREADS} +mpirun.lsf ./cice >&! \$CICE_RUNLOG_FILE +EOFR + +elseif (${CICE_MACHINE} =~ cheyenne*) then +cat >> ${jobfile} << EOFR +mpiexec_mpt -n ${ntasks} ./cice >&! \$CICE_RUNLOG_FILE +EOFR + +else if (${CICE_MACHINE} =~ thunder*) then +cat >> ${jobfile} << EOFR +mpiexec_mpt -np ${ntasks} omplace ./cice >&! \$CICE_RUNLOG_FILE +EOFR + +else if (${CICE_MACHINE} =~ gordon* || ${CICE_MACHINE} =~ conrad*) then +cat >> ${jobfile} << EOFR +aprun -n ${ntasks} -N ${ntasks} -d ${nthrds} ./cice >&! \$CICE_RUNLOG_FILE +EOFR + +else if (${CICE_MACHINE} =~ cori*) then +cat >> ${jobfile} << EOFR +srun -n ${ntasks} -c ${nthrds} ./cice >&! \$CICE_RUNLOG_FILE +EOFR + +else if (${CICE_MACHINE} =~ wolf*) then +cat >> ${jobfile} << EOFR +mpirun -np ${ntasks} ./cice >&! \$CICE_RUNLOG_FILE +EOFR + +else if (${CICE_MACHINE} =~ pinto*) then +cat >> ${jobfile} << EOFR +mpirun -np ${ntasks} ./cice >&! \$CICE_RUNLOG_FILE +EOFR +#cat >> ${jobfile} << EOFR +#srun -n ${ntasks} -c ${nthrds} ./cice >&! \$CICE_RUNLOG_FILE +#EOFR + +endif diff --git a/configuration/scripts/cice.run.setup.csh b/configuration/scripts/cice.run.setup.csh index 9a5297823..08db5d956 100755 --- a/configuration/scripts/cice.run.setup.csh +++ b/configuration/scripts/cice.run.setup.csh @@ -8,111 +8,12 @@ source ${CICE_CASEDIR}/env.${CICE_MACHINE} || exit 2 set jobfile = cice.run set subfile = cice.submit -set ntasks = ${CICE_NTASKS} set nthrds = ${CICE_NTHRDS} -set maxtpn = ${CICE_MACHINE_TPNODE} -set acct = ${CICE_MACHINE_ACCT} - -@ taskpernode = ${maxtpn} / $nthrds -@ nnodes = ${ntasks} / ${taskpernode} -if (${nnodes} * ${taskpernode} < ${ntasks}) @ nnodes = $nnodes + 1 -set taskpernodelimit = ${taskpernode} -if (${taskpernodelimit} > ${ntasks}) set taskpernodelimit = ${ntasks} - -set ptile = $taskpernode -if ($ptile > ${maxtpn} / 2) @ ptile = ${maxtpn} / 2 #========================================== -cat >! ${jobfile} << EOF0 -#!/bin/csh -f -EOF0 - -#========================================== - -if (${CICE_MACHINE} =~ yellowstone*) then -cat >> ${jobfile} << EOFB -#BSUB -n ${ntasks} -#BSUB -R "span[ptile=${ptile}]" -#BSUB -q caldera -#BSUB -N -###BSUB -x -#BSUB -a poe -#BSUB -o poe.stdout.%J -#BSUB -e poe.stderr.%J -#BSUB -J ${CICE_CASENAME} -#BSUB -W 0:10 -#BSUB -P ${acct} -EOFB - -#========================================== - -elseif (${CICE_MACHINE} =~ cheyenne*) then -cat >> ${jobfile} << EOFB -#PBS -j oe -#PBS -m ae -#PBS -V -#PBS -q regular -#PBS -N ${CICE_CASENAME} -#PBS -A ${CICE_ACCT} -#PBS -l select=${nnodes}:ncpus=${ntasks}:mpiprocs=${ntasks} -#PBS -l walltime=02:00:00 -EOFB - -else if (${CICE_MACHINE} =~ thunder* || ${CICE_MACHINE} =~ gordon* || ${CICE_MACHINE} =~ conrad*) then -cat >> ${jobfile} << EOFB -#PBS -N ${CICE_CASENAME} -#PBS -q debug -#PBS -A ${acct} -#PBS -l select=${nnodes}:ncpus=${maxtpn}:mpiprocs=${taskpernode} -#PBS -l walltime=0:10:00 -#PBS -j oe -###PBS -M username@domain.com -###PBS -m be -EOFB - -else if (${CICE_MACHINE} =~ cori*) then -cat >> ${jobfile} << EOFB -#SBATCH -J ${CICE_CASENAME} -#SBATCH -p debug -###SBATCH -A ${acct} -#SBATCH -N ${nnodes} -#SBATCH -t 0:10:00 -#SBATCH -L SCRATCH -#SBATCH -C haswell -###SBATCH -e filename -###SBATCH -o filename -###SBATCH --mail-type FAIL -###SBATCH --mail-user username@domain.com -EOFB - -else if (${CICE_MACHINE} =~ wolf*) then -cat >> ${jobfile} << EOFB -#SBATCH -J ${CICE_CASENAME} -#SBATCH -t 0:45:00 -#SBATCH -A ${acct} -#SBATCH -N ${nnodes} -#SBATCH -e slurm%j.err -#SBATCH -o slurm%j.out -#SBATCH --mail-type END,FAIL -#SBATCH --mail-user=eclare@lanl.gov -#SBATCH --qos=low -EOFB - -else if (${CICE_MACHINE} =~ pinto*) then -cat >> ${jobfile} << EOFB -#SBATCH -J ${CICE_CASENAME} -#SBATCH -t 0:45:00 -#SBATCH -A ${acct} -#SBATCH -N ${nnodes} -#SBATCH -e slurm%j.err -#SBATCH -o slurm%j.out -###SBATCH --mail-type END,FAIL -###SBATCH --mail-user=eclare@lanl.gov -#SBATCH --qos=standby -EOFB - -endif +# Write the batch code into the job file +$1/cice.batch.csh ${jobfile} #========================================== @@ -153,46 +54,8 @@ EOF1 #========================================== -if (${CICE_MACHINE} =~ yellowstone*) then -cat >> ${jobfile} << EOFR -setenv MP_TASK_AFFINITY core:\${OMP_NUM_THREADS} -mpirun.lsf ./cice >&! \$CICE_RUNLOG_FILE -EOFR - -elseif (${CICE_MACHINE} =~ cheyenne*) then -cat >> ${jobfile} << EOFR -mpiexec_mpt -n ${ntasks} ./cice >&! \$CICE_RUNLOG_FILE -EOFR - -else if (${CICE_MACHINE} =~ thunder*) then -cat >> ${jobfile} << EOFR -mpiexec_mpt -np ${ntasks} omplace ./cice >&! \$CICE_RUNLOG_FILE -EOFR - -else if (${CICE_MACHINE} =~ gordon* || ${CICE_MACHINE} =~ conrad*) then -cat >> ${jobfile} << EOFR -aprun -n ${ntasks} -N ${ntasks} -d ${nthrds} ./cice >&! \$CICE_RUNLOG_FILE -EOFR - -else if (${CICE_MACHINE} =~ cori*) then -cat >> ${jobfile} << EOFR -srun -n ${ntasks} -c ${nthrds} ./cice >&! \$CICE_RUNLOG_FILE -EOFR - -else if (${CICE_MACHINE} =~ wolf*) then -cat >> ${jobfile} << EOFR -mpirun -np ${ntasks} ./cice >&! \$CICE_RUNLOG_FILE -EOFR - -else if (${CICE_MACHINE} =~ pinto*) then -cat >> ${jobfile} << EOFR -mpirun -np ${ntasks} ./cice >&! \$CICE_RUNLOG_FILE -EOFR -#cat >> ${jobfile} << EOFR -#srun -n ${ntasks} -c ${nthrds} ./cice >&! \$CICE_RUNLOG_FILE -#EOFR - -endif +# Write the job launching logic into the job file +$1/cice.launch.csh ${jobfile} #========================================== diff --git a/configuration/scripts/tests/cice.annual.csh b/configuration/scripts/tests/cice.annual.csh deleted file mode 100755 index 45717964e..000000000 --- a/configuration/scripts/tests/cice.annual.csh +++ /dev/null @@ -1,165 +0,0 @@ -#! /bin/csh -f - -echo ${0} - -source ./cice.settings -source ${CICE_CASEDIR}/env.${CICE_MACHINE} || exit 2 - -set jobfile = cice.annual -set subfile = cice.submit - -set ntasks = ${CICE_NTASKS} -set nthrds = ${CICE_NTHRDS} -set maxtpn = ${CICE_MACHINE_TPNODE} -set acct = ${CICE_MACHINE_ACCT} - -@ taskpernode = ${maxtpn} / $nthrds -@ nnodes = ${ntasks} / ${taskpernode} -if (${nnodes} * ${taskpernode} < ${ntasks}) @ nnodes = $nnodes + 1 -set taskpernodelimit = ${taskpernode} -if (${taskpernodelimit} > ${ntasks}) set taskpernodelimit = ${ntasks} - -set ptile = $taskpernode -if ($ptile > ${maxtpn} / 2) @ ptile = ${maxtpn} / 2 - -#========================================== - -# Create test script that runs cice.build, cice.run, and validates -#========================================== - -cat >! ${jobfile} << EOF0 -#!/bin/csh -f -EOF0 - -#========================================== - -if (${CICE_MACHINE} =~ yellowstone*) then -cat >> ${jobfile} << EOFB -#BSUB -n ${ntasks} -#BSUB -R "span[ptile=${ptile}]" -#BSUB -q caldera -#BSUB -N -###BSUB -x -#BSUB -a poe -#BSUB -o poe.stdout.%J -#BSUB -e poe.stderr.%J -#BSUB -J ${CICE_CASENAME} -#BSUB -W 0:10 -#BSUB -P ${acct} -EOFB - -else if (${CICE_MACHINE} =~ thunder* || ${CICE_MACHINE} =~ gordon* || ${CICE_MACHINE} =~ conrad*) then -cat >> ${jobfile} << EOFB -#PBS -N ${CICE_CASENAME} -#PBS -q debug -#PBS -A ${acct} -#PBS -l select=${nnodes}:ncpus=${maxtpn}:mpiprocs=${taskpernode} -#PBS -l walltime=0:10:00 -#PBS -j oe -###PBS -M username@domain.com -###PBS -m be -EOFB - -else if (${CICE_MACHINE} =~ cori*) then -cat >> ${jobfile} << EOFB -#SBATCH -J ${CICE_CASENAME} -#SBATCH -p debug -###SBATCH -A ${acct} -#SBATCH -N ${nnodes} -#SBATCH -t 0:10:00 -#SBATCH -L SCRATCH -#SBATCH -C haswell -###SBATCH -e filename -###SBATCH -o filename -###SBATCH --mail-type FAIL -###SBATCH --mail-user username@domain.com -EOFB - -else if (${CICE_MACHINE} =~ wolf*) then -cat >> ${jobfile} << EOFB -#SBATCH -J ${CICE_CASENAME} -#SBATCH -t 0:10:00 -#SBATCH -A ${acct} -#SBATCH -N ${nnodes} -#SBATCH -e slurm%j.err -#SBATCH -o slurm%j.out -#SBATCH --mail-type FAIL -#SBATCH --mail-user=eclare@lanl.gov -#SBATCH --qos=low -EOFB - -endif - -cat >> ${jobfile} << EOF2 -cd ${CICE_CASEDIR} -source ./cice.settings || exit 2 -source ./env.\${CICE_MACHINE} || exit 2 - -# Compile the CICE code -./cice.build -set rc_build = \$? - -# Run the CICE model -./cice.run -set rc_run = \$? - -EOF2 - -if ($1 != "") then -cat >> ${jobfile} << EOF3 - # Get the final output filename - foreach file (\${CICE_RUNDIR}/restart/*) - set test_data = \$file - end - - set baseline_data = $1/\$test_data:t - - if ( { cmp -s \$test_data \$baseline_data } ) then - set rc_valid = 0 - else - set rc_valid = 1 - endif -EOF3 -endif - -cat >> ${jobfile} << EOF4 - -if (\$rc_build == 0) then - echo "Build: PASS" -else - echo "Build: FAIL" -endif - -if (\$rc_run == 0) then - echo "Run: PASS" -else - echo "Run: FAIL" -endif -EOF4 - -if ($1 != "") then -cat >> ${jobfile} << EOF5 - -if (\$rc_valid == 0) then - echo "Validation: PASS" -else - echo "Validation: FAIL" -endif -EOF5 -endif - -#========================================== - -chmod +x ${jobfile} - -#========================================== - -cat >! ${subfile} << EOFS -#!/bin/csh -f - -${CICE_MACHINE_SUBMIT} ${jobfile} -echo "\`date\` \${0}: ${CICE_CASENAME} job submitted" >> ${CICE_CASEDIR}/README.test - -EOFS - -chmod +x ${subfile} diff --git a/configuration/scripts/tests/cice.test.csh b/configuration/scripts/tests/cice.test.csh index 1c35940e8..8319572cd 100755 --- a/configuration/scripts/tests/cice.test.csh +++ b/configuration/scripts/tests/cice.test.csh @@ -15,87 +15,15 @@ source ${CICE_CASEDIR}/env.${CICE_MACHINE} || exit 2 set jobfile = cice.test set subfile = cice.submit -set ntasks = ${CICE_NTASKS} set nthrds = ${CICE_NTHRDS} -set maxtpn = ${CICE_MACHINE_TPNODE} -set acct = ${CICE_MACHINE_ACCT} - -@ taskpernode = ${maxtpn} / $nthrds -@ nnodes = ${ntasks} / ${taskpernode} -if (${nnodes} * ${taskpernode} < ${ntasks}) @ nnodes = $nnodes + 1 -set taskpernodelimit = ${taskpernode} -if (${taskpernodelimit} > ${ntasks}) set taskpernodelimit = ${ntasks} - -set ptile = $taskpernode -if ($ptile > ${maxtpn} / 2) @ ptile = ${maxtpn} / 2 #========================================== # Create test script that runs cice.run, and validates #========================================== -cat >! ${jobfile} << EOF0 -#!/bin/csh -f -EOF0 - -#========================================== - -if (${CICE_MACHINE} =~ yellowstone*) then -cat >> ${jobfile} << EOFB -#BSUB -n ${ntasks} -#BSUB -R "span[ptile=${ptile}]" -#BSUB -q caldera -#BSUB -N -###BSUB -x -#BSUB -a poe -#BSUB -o poe.stdout.%J -#BSUB -e poe.stderr.%J -#BSUB -J ${CICE_CASENAME} -#BSUB -W 0:10 -#BSUB -P ${acct} -EOFB - -else if (${CICE_MACHINE} =~ thunder* || ${CICE_MACHINE} =~ gordon* || ${CICE_MACHINE} =~ conrad*) then -cat >> ${jobfile} << EOFB -#PBS -N ${CICE_CASENAME} -#PBS -q debug -#PBS -A ${acct} -#PBS -l select=${nnodes}:ncpus=${maxtpn}:mpiprocs=${taskpernode} -#PBS -l walltime=0:10:00 -#PBS -j oe -###PBS -M username@domain.com -###PBS -m be -EOFB - -else if (${CICE_MACHINE} =~ cori*) then -cat >> ${jobfile} << EOFB -#SBATCH -J ${CICE_CASENAME} -#SBATCH -p debug -###SBATCH -A ${acct} -#SBATCH -N ${nnodes} -#SBATCH -t 0:10:00 -#SBATCH -L SCRATCH -#SBATCH -C haswell -###SBATCH -e filename -###SBATCH -o filename -###SBATCH --mail-type FAIL -###SBATCH --mail-user username@domain.com -EOFB - -else if (${CICE_MACHINE} =~ wolf*) then -cat >> ${jobfile} << EOFB -#SBATCH -J ${CICE_CASENAME} -#SBATCH -t 0:10:00 -#SBATCH -A ${acct} -#SBATCH -N ${nnodes} -#SBATCH -e slurm%j.err -#SBATCH -o slurm%j.out -#SBATCH --mail-type FAIL -#SBATCH --mail-user=eclare@lanl.gov -#SBATCH --qos=low -EOFB - -endif +# Write the batch code into the job file +$1/cice.batch.csh ${jobfile} cat >> ${jobfile} << EOF2 cd ${CICE_CASEDIR} @@ -114,14 +42,14 @@ endif EOF2 -if ($1 != "") then +if ($2 != "") then cat >> ${jobfile} << EOF3 # Get the final output filename foreach file (\${CICE_RUNDIR}/restart/*) set test_data = \$file end - set baseline_data = $1/\$test_data:t + set baseline_data = $2/\$test_data:t echo "Performing binary comparison between files:" echo "baseline: \$baseline_data" diff --git a/create.case b/create.case index 7d723ecdb..ca9e96b66 100755 --- a/create.case +++ b/create.case @@ -320,7 +320,7 @@ ${casescr}/parse_namelist.sh ice_in ${fimods} source ./cice.settings source ./env.${mach} || exit 2 -${casescr}/cice.run.setup.csh +${casescr}/cice.run.setup.csh ${CICE_SCRDIR} #------------------------------------------------------------ @@ -330,10 +330,10 @@ if ($test != $spval) then source ./env.${mach} || exit 2 if ($baseline == 0) then - ${CICE_SCRDIR}/tests/cice.test.csh $bdir + ${CICE_SCRDIR}/tests/cice.test.csh ${CICE_SCRDIR} $bdir else # Generate baseline dataset - ${CICE_SCRDIR}/tests/cice.test.csh + ${CICE_SCRDIR}/tests/cice.test.csh ${CICE_SCRDIR} endif endif From 56686688998f0e272ad4ea4f8c08463951b73aba Mon Sep 17 00:00:00 2001 From: mattdturner Date: Mon, 12 Jun 2017 16:42:27 +0000 Subject: [PATCH 06/29] Remove the requirement for -b or -bd to be provided when using create.case to generate a test --- create.case | 5 ----- 1 file changed, 5 deletions(-) diff --git a/create.case b/create.case index ca9e96b66..ad42ce2d5 100755 --- a/create.case +++ b/create.case @@ -135,11 +135,6 @@ if ($case != $spval && $test != $spval) then exit -1 endif -if ($test != $spval && $baseline == 0 && $bdir == $spval) then - echo "${0}: ERROR in arguments, when using -t either -b or -bd required" - exit -1 -endif - set chck = `echo ${pesx} | sed 's/^[0-9]\+x[0-9]\+$/OK/'` if (${chck} == OK) then set task = `echo ${pesx} | sed s/x.\*//` From 17d722dff2defc108a8631b30d872e2cc3647098 Mon Sep 17 00:00:00 2001 From: mattdturner Date: Mon, 12 Jun 2017 16:47:56 +0000 Subject: [PATCH 07/29] Add the option to pass a test ID to create.case, which gets included in the case_dir name --- create.case | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/create.case b/create.case index ad42ce2d5..f0a2466cf 100755 --- a/create.case +++ b/create.case @@ -18,6 +18,7 @@ set pesx = 4x1 set sets = "" set baseline = 0 set bdir = $spval +set testid = $spval if ($#argv < 1) then set helpheader = 1 @@ -55,7 +56,8 @@ NAME - "annual": Compiles code and performs annual run - "restart": Compiles code and performs an exact restart test -b baseline, generate baseline data - -bd baseline dir, location of baseline dataset (required if -t is used without -b) + -bd baseline dir, location of baseline dataset + -testid test ID, user-defined indentifier for test EXAMPLES: create.case -h @@ -112,6 +114,9 @@ while (1) case "-bd": set bdir = $argv[1] breaksw + case "-testid": + set testid = $argv[1] + breaksw default: echo "${0}: ERROR unknown option $option, use -h for help" exit -1 @@ -155,15 +160,31 @@ else if ($sets != "") then set soptions = `echo $sets | sed 's/,/_/g'` if ($baseline == 1) then - set testname = "${test}_baseline_${grid}_${mach}_${pesx}_$soptions" + if ( $testid != $spval ) then + set testname = "${test}_baseline_${grid}_${mach}_${pesx}_${soptions}.${testid}" + else + set testname = "${test}_baseline_${grid}_${mach}_${pesx}_$soptions" + endif else - set testname = "${test}_${grid}_${mach}_${pesx}_$soptions" + if ( $testid != $spval ) then + set testname = "${test}_${grid}_${mach}_${pesx}_${soptions}.${testid}" + else + set testname = "${test}_${grid}_${mach}_${pesx}_$soptions" + endif endif else if ($baseline == 1) then - set testname = "${test}_baseline_${grid}_${mach}_$pesx" + if ( $testid != $spval ) then + set testname = "${test}_baseline_${grid}_${mach}_${pesx}.${testid}" + else + set testname = "${test}_baseline_${grid}_${mach}_$pesx" + endif else - set testname = "${test}_${grid}_${mach}_$pesx" + if ( $testid != $spval ) then + set testname = "${test}_${grid}_${mach}_${pesx}.${testid}" + else + set testname = "${test}_${grid}_${mach}_$pesx" + endif endif endif if (-d $testname) then From f52288db18732639234744901a901e7dc7f62f0a Mon Sep 17 00:00:00 2001 From: mattdturner Date: Mon, 12 Jun 2017 17:02:24 +0000 Subject: [PATCH 08/29] Modification to create.case to properly handle running tests where -b and -bd are not specified --- configuration/scripts/cice.batch.csh | 6 +++++- create.case | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/configuration/scripts/cice.batch.csh b/configuration/scripts/cice.batch.csh index 3aac1056f..eea17c863 100755 --- a/configuration/scripts/cice.batch.csh +++ b/configuration/scripts/cice.batch.csh @@ -1,6 +1,10 @@ #! /bin/csh -f -echo ${0} +if ( $1 != "" ) then + echo ${0} ${1} +else + echo ${0} +endif source ./cice.settings source ${CICE_CASEDIR}/env.${CICE_MACHINE} || exit 2 diff --git a/create.case b/create.case index f0a2466cf..621761a4d 100755 --- a/create.case +++ b/create.case @@ -345,10 +345,9 @@ if ($test != $spval) then source ./cice.settings source ./env.${mach} || exit 2 - if ($baseline == 0) then + if ($bdir != $spval) then ${CICE_SCRDIR}/tests/cice.test.csh ${CICE_SCRDIR} $bdir else - # Generate baseline dataset ${CICE_SCRDIR}/tests/cice.test.csh ${CICE_SCRDIR} endif endif From d2dbf285f8b83d5187c64c390c066a6fd3a10c6e Mon Sep 17 00:00:00 2001 From: mattdturner Date: Mon, 12 Jun 2017 17:07:38 +0000 Subject: [PATCH 09/29] Add a check in create.case to ensure that the test requested is one of smoke, 10day, annual, or restart --- create.case | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/create.case b/create.case index 621761a4d..13bd79576 100755 --- a/create.case +++ b/create.case @@ -140,6 +140,12 @@ if ($case != $spval && $test != $spval) then exit -1 endif +if ($test != $spval && $test != 'smoke' && $test != '10day' && $test != 'annual' \ + && $test != 'restart') then + echo "${0}: ERROR in arguments. $test is not a valid test" + exit -1 +endif + set chck = `echo ${pesx} | sed 's/^[0-9]\+x[0-9]\+$/OK/'` if (${chck} == OK) then set task = `echo ${pesx} | sed s/x.\*//` From 0db5c737a285bdb0293e35459601f0b076307c7e Mon Sep 17 00:00:00 2001 From: mattdturner Date: Tue, 13 Jun 2017 13:52:17 +0000 Subject: [PATCH 10/29] Update cice.run.setup.csh to not overwrite the ice.restart_file pointer file. This is necessary for the exact restart test --- configuration/scripts/cice.run.setup.csh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/scripts/cice.run.setup.csh b/configuration/scripts/cice.run.setup.csh index 08db5d956..3f341a24c 100755 --- a/configuration/scripts/cice.run.setup.csh +++ b/configuration/scripts/cice.run.setup.csh @@ -37,7 +37,7 @@ if !(-d \${CICE_RUNDIR}) mkdir -p \${CICE_RUNDIR} if !(-d \${CICE_HSTDIR}) mkdir -p \${CICE_HSTDIR} if !(-d \${CICE_RSTDIR}) mkdir -p \${CICE_RSTDIR} -if !(-e ice.restart_file) cp \${CICE_RSTPFILE} \${CICE_RUNDIR} +if !(-e \${CICE_RUNDIR}/ice.restart_file) cp \${CICE_RSTPFILE} \${CICE_RUNDIR} #-------------------------------------------- cd \${CICE_RUNDIR} From d224516479f79a3a358abd02afe4e1db2ea3a6bc Mon Sep 17 00:00:00 2001 From: mattdturner Date: Tue, 13 Jun 2017 13:53:32 +0000 Subject: [PATCH 11/29] Create new exact restart test case. --- .../scripts/options/test_nml.restart | 7 ++ configuration/scripts/tests/cice.restart.csh | 95 +++++++++++++++++++ create.case | 7 +- 3 files changed, 105 insertions(+), 4 deletions(-) create mode 100644 configuration/scripts/options/test_nml.restart create mode 100755 configuration/scripts/tests/cice.restart.csh diff --git a/configuration/scripts/options/test_nml.restart b/configuration/scripts/options/test_nml.restart new file mode 100644 index 000000000..0682417d2 --- /dev/null +++ b/configuration/scripts/options/test_nml.restart @@ -0,0 +1,7 @@ +npt = 48 +dumpfreq = 'd' +dumpfreq_n = 1 +bfbflag = .true. +diag_type = 'stdout' +print_global = .true. +histfreq = 'd','x','x','x','x' diff --git a/configuration/scripts/tests/cice.restart.csh b/configuration/scripts/tests/cice.restart.csh new file mode 100755 index 000000000..ab1e43d97 --- /dev/null +++ b/configuration/scripts/tests/cice.restart.csh @@ -0,0 +1,95 @@ +#! /bin/csh -f + +echo ${0} + +# Define this as a test case in the cice.settings file +cat >> ./cice.settings << EOF + +# Add variable defining this case_dir as a test +setenv CICE_TEST true +EOF + +source ./cice.settings +source ${CICE_CASEDIR}/env.${CICE_MACHINE} || exit 2 + +set jobfile = cice.test +set subfile = cice.submit + +set nthrds = ${CICE_NTHRDS} + +#========================================== + +# Create test script that runs cice.run, and validates +#========================================== + +# Write the batch code into the job file +$1/cice.batch.csh ${jobfile} + +cat >> ${jobfile} << EOF2 +cd ${CICE_CASEDIR} +source ./cice.settings || exit 2 +source ./env.\${CICE_MACHINE} || exit 2 + +# Check to see if executable exists in CICE_RUNDIR +if ( ! -f \${CICE_RUNDIR}/cice ) then + echo "cice executable does not exist in \${CICE_RUNDIR}. " + echo "Please run cice.build before this test." + exit 99 +endif + +# Run the CICE model for the 2-day simulation +./cice.run +if ( \$? != 0 ) then + exit 99 +endif + +# Prepend 'baseline_' to the final restart file to save for comparison +foreach file (\${CICE_RUNDIR}/restart/*) + set test_data = \$file +end +set baseline_data = \${CICE_RUNDIR}/restart/baseline_\$test_data:t +mv \$test_data \$baseline_data + +# Modify the contents of the pointer file for restart +perl -i -pe's/(\d{4})-(\d{2})-(\d{2})/sprintf("%04d-%02d-%02d",\$1,\$2,\$3-1)/e' \${CICE_RUNDIR}/ice.restart_file + +# Modify the namelist for the restart simulation +cp ice_in ice_in.restart_full +perl -i -pe"s/(npt\s+=)\s(\d+)/\1 24/" ice_in # replace npt = 48 with npt = 24 +perl -i -pe"s/(dumpfreq_n\s+=)\s(\d+)/\1 1/" ice_in # replace dump freq with 1 +perl -i -pe"s/(runtype\s+=)\s(\S+)/\1 'continue'/" ice_in # runtype with continuation + +# Run the CICE model for the restart simulation +./cice.run +if ( \$? != 0 ) then + exit 99 +endif + +EOF2 + +cat >> ${jobfile} << EOF3 +echo "Performing binary comparison between files:" +echo "baseline: \$baseline_data" +echo "test: \$test_data" +if ( { cmp -s \$test_data \$baseline_data } ) then + echo "PASS \${CICE_CASENAME} test" >> ${CICE_CASEDIR}/test_output +else + echo "FAIL \${CICE_CASENAME} test" >> ${CICE_CASEDIR}/test_output +endif +EOF3 + +#========================================== + +chmod +x ${jobfile} + +#========================================== + +cat >! ${subfile} << EOFS +#!/bin/csh -f + +${CICE_MACHINE_SUBMIT} ${jobfile} +echo "\`date\` \${0}: ${CICE_CASENAME} job submitted" >> ${CICE_CASEDIR}/README.case + +EOFS + +chmod +x ${subfile} diff --git a/create.case b/create.case index 13bd79576..e462ddbd7 100755 --- a/create.case +++ b/create.case @@ -348,10 +348,9 @@ ${casescr}/cice.run.setup.csh ${CICE_SCRDIR} if ($test != $spval) then # Generate test script - source ./cice.settings - source ./env.${mach} || exit 2 - - if ($bdir != $spval) then + if ($test == 'restart') then + ${CICE_SCRDIR}/tests/cice.restart.csh ${CICE_SCRDIR} + else if ($bdir != $spval) then ${CICE_SCRDIR}/tests/cice.test.csh ${CICE_SCRDIR} $bdir else ${CICE_SCRDIR}/tests/cice.test.csh ${CICE_SCRDIR} From 2ddbdd937e5c476eebe8d4ba83a91386e3864a36 Mon Sep 17 00:00:00 2001 From: mattdturner Date: Tue, 13 Jun 2017 14:24:42 +0000 Subject: [PATCH 12/29] Add new README.test file that gives instructions on running the test cases. Also add the testid field to README_v6 --- README.test | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ README_v6 | 1 + 2 files changed, 56 insertions(+) create mode 100644 README.test diff --git a/README.test b/README.test new file mode 100644 index 000000000..513caac9a --- /dev/null +++ b/README.test @@ -0,0 +1,55 @@ +CICE version 6 testing + June 2017 + +This README file documents how to use the testing suite developed for the +CICE Consortium sea ice model. The tests currently supported are: + 1. "Smoke" test - Ensures that the model compiles successfully and runs + to completion for a 1 day simulation. Validation is + determined by performing a binary comparison on restart + files to a baseline dataset. + 2. 10-day test - Ensures that the model compiles successfully and runs + to completion for a 10 day simulation. Validation is + determined by performing a binary comparison on restart + files to a baseline dataset. + 3. Exact restart - Ensures that the output from a cold-start simulation + and a restart simulation provide bit-for-bit identical + results. + 4. Annual test - Ensures that the model compiles successfully and runs + to completion for an annual simulation. Validation is + determined by performing a binary comparison on restart + files to a baseline dataset. + +--- To generate a baseline dataset for a test case --- + +Quickstart (example): + +./create.case -t smoke -m conrad -b +cd smoke_baseline_gx3_conrad_4x1 +./cice.build +./cice.submit +# After job finishes, check output +cat test_output + + +--- To run a test case and compare to a baseline dataset --- + +Quickstart (example): + +./create.case -t smoke -m conrad -bd /path/to/baseline/restart +cd smoke_gx3_conrad_4x1 +./cice.build +./cice.submit +# After job finishes, check output +cat test_output + + +--- To run a test case without comparing to a baseline --- + +Quickstart (example): + +./create.case -t smoke -m conrad +cd smoke_gx3_conrad_4x1 +./cice.build +./cice.submit +# After job finishes, check output +cat test_output diff --git a/README_v6 b/README_v6 index eb9efbea8..cee0f26fe 100644 --- a/README_v6 +++ b/README_v6 @@ -30,6 +30,7 @@ create.case generates a case, use "create.case -h" for help with the tool. -t is the test name and location (cannot be used with -c). -b is used to specify that a baseline dataset is to be generated (only used with -t) -bd is used to specify the location of the baseline datasets (only used with -t) + -testid is used to specify a test ID (used only with -t) Several files are placed in the case directory - env.${machine} defines the environment From 4b7b976f32f903146b185b63ac1015d07b1cb5ff Mon Sep 17 00:00:00 2001 From: mattdturner Date: Thu, 15 Jun 2017 15:26:22 +0000 Subject: [PATCH 13/29] add CICE_MACHINE_BASELINE default baseline directory to env. files --- configuration/scripts/machines/env.cheyenne | 1 + configuration/scripts/machines/env.conrad | 1 + configuration/scripts/machines/env.cori | 1 + configuration/scripts/machines/env.gordon | 1 + configuration/scripts/machines/env.pinto | 1 + configuration/scripts/machines/env.thunder | 1 + configuration/scripts/machines/env.wolf | 1 + configuration/scripts/machines/env.yellowstone | 1 + 8 files changed, 8 insertions(+) mode change 100644 => 100755 configuration/scripts/machines/env.cheyenne mode change 100644 => 100755 configuration/scripts/machines/env.cori mode change 100644 => 100755 configuration/scripts/machines/env.gordon mode change 100644 => 100755 configuration/scripts/machines/env.pinto mode change 100644 => 100755 configuration/scripts/machines/env.thunder mode change 100644 => 100755 configuration/scripts/machines/env.wolf mode change 100644 => 100755 configuration/scripts/machines/env.yellowstone diff --git a/configuration/scripts/machines/env.cheyenne b/configuration/scripts/machines/env.cheyenne old mode 100644 new mode 100755 index df082e551..ff4809d03 --- a/configuration/scripts/machines/env.cheyenne +++ b/configuration/scripts/machines/env.cheyenne @@ -12,6 +12,7 @@ module load pio/2.2.0 setenv CICE_MACHINE_ENVNAME cheyenne setenv CICE_MACHINE_WKDIR /glade/scratch/$user/CICE_RUNS setenv CICE_MACHINE_INPUTDATA /glade/p/work/dbailey/atm/gx3v2m/NCAR_bulk +setenv CICE_MACHINE_BASELINE /glade/scratch/$user/CICE_BASELINE setenv CICE_MACHINE_SUBMIT "qsub" setenv CICE_MACHINE_TPNODE 36 setenv CICE_MACHINE_ACCT P0000000 diff --git a/configuration/scripts/machines/env.conrad b/configuration/scripts/machines/env.conrad index 4b7064307..83f65c490 100755 --- a/configuration/scripts/machines/env.conrad +++ b/configuration/scripts/machines/env.conrad @@ -34,6 +34,7 @@ limit stacksize unlimited setenv CICE_MACHINE_ENVNAME conrad setenv CICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv CICE_MACHINE_INPUTDATA /p/home/turner/CICE/atm/ +setenv CICE_MACHINE_BASELINE $WORKDIR/CICE_BASELINE setenv CICE_MACHINE_SUBMIT "qsub " setenv CICE_MACHINE_ACCT ARLAP96070PET setenv CICE_MACHINE_TPNODE 32 # tasks per node diff --git a/configuration/scripts/machines/env.cori b/configuration/scripts/machines/env.cori old mode 100644 new mode 100755 index b639a5b20..83cb9ba4c --- a/configuration/scripts/machines/env.cori +++ b/configuration/scripts/machines/env.cori @@ -36,6 +36,7 @@ limit stacksize unlimited setenv CICE_MACHINE_ENVNAME cori setenv CICE_MACHINE_WKDIR $SCRATCH/CICE_RUNS setenv CICE_MACHINE_INPUTDATA /global/homes/t/tcraig/cice_data/ +setenv CICE_MACHINE_BASELINE $SCRATCH/CICE_BASELINE setenv CICE_MACHINE_SUBMIT "sbatch " setenv CICE_MACHINE_ACCT P00000000 setenv CICE_MACHINE_TPNODE 32 # tasks per node diff --git a/configuration/scripts/machines/env.gordon b/configuration/scripts/machines/env.gordon old mode 100644 new mode 100755 index 067e7210b..48412836d --- a/configuration/scripts/machines/env.gordon +++ b/configuration/scripts/machines/env.gordon @@ -34,6 +34,7 @@ limit stacksize unlimited setenv CICE_MACHINE_ENVNAME gordon setenv CICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv CICE_MACHINE_INPUTDATA /p/work1/RASM_data/cice_data/ +setenv CICE_MACHINE_BASELINE $WORKDIR/CICE_BASELINE setenv CICE_MACHINE_SUBMIT "qsub " setenv CICE_MACHINE_ACCT P00000000 setenv CICE_MACHINE_TPNODE 32 # tasks per node diff --git a/configuration/scripts/machines/env.pinto b/configuration/scripts/machines/env.pinto old mode 100644 new mode 100755 index 185b8c3e2..a2d17135c --- a/configuration/scripts/machines/env.pinto +++ b/configuration/scripts/machines/env.pinto @@ -20,6 +20,7 @@ setenv PNETCDF_PATH /usr/projects/climate/SHARED_CLIMATE/software/conejo/paralle setenv CICE_MACHINE_ENVNAME pinto setenv CICE_MACHINE_WKDIR /net/scratch3/$user/CICE_RUNS setenv CICE_MACHINE_INPUTDATA /usr/projects/climate/eclare/DATA/atm/gx3v2m/NCAR_bulk/ +setenv CICE_MACHINE_BASELINE /net/scratch3/$user/CICE_BASELINE setenv CICE_MACHINE_SUBMIT "sbatch " setenv CICE_MACHINE_ACCT climateacme setenv CICE_MACHINE_TPNODE 16 diff --git a/configuration/scripts/machines/env.thunder b/configuration/scripts/machines/env.thunder old mode 100644 new mode 100755 index a8b8f0ffc..915e6e379 --- a/configuration/scripts/machines/env.thunder +++ b/configuration/scripts/machines/env.thunder @@ -28,6 +28,7 @@ setenv NETCDF_PATH /app/COST/netcdf-fortran/4.4.2/intel setenv CICE_MACHINE_ENVNAME thunder setenv CICE_MACHINE_WKDIR $WORKDIR/CICE_RUNS setenv CICE_MACHINE_INPUTDATA /p/work2/projects/rasm/cice_data/ +setenv CICE_MACHINE_BASELINE $WORKDIR/CICE_BASELINE setenv CICE_MACHINE_SUBMIT "qsub " setenv CICE_MACHINE_ACCT P00000000 setenv CICE_MACHINE_TPNODE 36 # tasks per node diff --git a/configuration/scripts/machines/env.wolf b/configuration/scripts/machines/env.wolf old mode 100644 new mode 100755 index 5f63134ea..c0247722a --- a/configuration/scripts/machines/env.wolf +++ b/configuration/scripts/machines/env.wolf @@ -20,6 +20,7 @@ setenv PNETCDF_PATH /usr/projects/climate/SHARED_CLIMATE/software/conejo/paralle setenv CICE_MACHINE_ENVNAME wolf setenv CICE_MACHINE_WKDIR /net/scratch3/$user/CICE_RUNS setenv CICE_MACHINE_INPUTDATA /usr/projects/climate/eclare/DATA/atm/gx3v2m/NCAR_bulk/ +setenv CICE_MACHINE_BASELINE /net/scratch3/$user/CICE_BASELINE setenv CICE_MACHINE_SUBMIT "sbatch " setenv CICE_MACHINE_ACCT climateacme setenv CICE_MACHINE_TPNODE 16 diff --git a/configuration/scripts/machines/env.yellowstone b/configuration/scripts/machines/env.yellowstone old mode 100644 new mode 100755 index c93668966..d5dc9312b --- a/configuration/scripts/machines/env.yellowstone +++ b/configuration/scripts/machines/env.yellowstone @@ -24,6 +24,7 @@ setenv LAPACK_LIBDIR /glade/apps/opt/lapack/3.4.2/intel/12.1.5/lib setenv CICE_MACHINE_ENVNAME yellowstone setenv CICE_MACHINE_WKDIR /glade/scratch/$user/CICE_RUNS setenv CICE_MACHINE_INPUTDATA /glade/u/home/tcraig/cice_data/ +setenv CICE_MACHINE_BASELINE /glade/scratch/$user/CICE_BASELINE setenv CICE_MACHINE_SUBMIT "bsub < " setenv CICE_MACHINE_ACCT P00000000 setenv CICE_MACHINE_TPNODE 32 From a3c6c857785f7dbb9bb17e44160939b262259f41 Mon Sep 17 00:00:00 2001 From: mattdturner Date: Thu, 15 Jun 2017 15:27:08 +0000 Subject: [PATCH 14/29] bugfix for cheyenne machine. Also added error if using unknown machine --- configuration/scripts/cice.batch.csh | 5 ++++- configuration/scripts/cice.launch.csh | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/configuration/scripts/cice.batch.csh b/configuration/scripts/cice.batch.csh index eea17c863..38105cbfb 100755 --- a/configuration/scripts/cice.batch.csh +++ b/configuration/scripts/cice.batch.csh @@ -50,7 +50,7 @@ EOFB #========================================== -elseif (${CICE_MACHINE} =~ cheyenne*) then +else if (${CICE_MACHINE} =~ cheyenne*) then cat >> ${jobfile} << EOFB #PBS -j oe #PBS -m ae @@ -115,4 +115,7 @@ cat >> ${jobfile} << EOFB #SBATCH --qos=standby EOFB +else + echo "${0} ERROR ${CICE_MACHINE} unknown" + exit -1 endif diff --git a/configuration/scripts/cice.launch.csh b/configuration/scripts/cice.launch.csh index 4ee2805af..fbdeb9a02 100755 --- a/configuration/scripts/cice.launch.csh +++ b/configuration/scripts/cice.launch.csh @@ -17,7 +17,7 @@ setenv MP_TASK_AFFINITY core:\${OMP_NUM_THREADS} mpirun.lsf ./cice >&! \$CICE_RUNLOG_FILE EOFR -elseif (${CICE_MACHINE} =~ cheyenne*) then +else if (${CICE_MACHINE} =~ cheyenne*) then cat >> ${jobfile} << EOFR mpiexec_mpt -n ${ntasks} ./cice >&! \$CICE_RUNLOG_FILE EOFR @@ -50,4 +50,7 @@ EOFR #srun -n ${ntasks} -c ${nthrds} ./cice >&! \$CICE_RUNLOG_FILE #EOFR +else + echo "${0} ERROR ${CICE_MACHINE} unknown" + exit -1 endif From 473d158e478accc426d9d90390544caae616e10d Mon Sep 17 00:00:00 2001 From: mattdturner Date: Thu, 15 Jun 2017 15:27:52 +0000 Subject: [PATCH 15/29] Check return status of calls to cice.launch.csh and cice.batch.csh. Remove writing to test_output from cice.run.setup.csh --- configuration/scripts/cice.run.setup.csh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/configuration/scripts/cice.run.setup.csh b/configuration/scripts/cice.run.setup.csh index 3f341a24c..e189d7576 100755 --- a/configuration/scripts/cice.run.setup.csh +++ b/configuration/scripts/cice.run.setup.csh @@ -14,6 +14,9 @@ set nthrds = ${CICE_NTHRDS} # Write the batch code into the job file $1/cice.batch.csh ${jobfile} +if ($? == -1) then + exit -1 +endif #========================================== @@ -56,6 +59,9 @@ EOF1 # Write the job launching logic into the job file $1/cice.launch.csh ${jobfile} +if ($? == -1) then + exit -1 +endif #========================================== @@ -71,19 +77,12 @@ cp -p \${CICE_RUNLOG_FILE} \${CICE_LOGDIR} grep ' CICE COMPLETED SUCCESSFULLY' \${CICE_RUNLOG_FILE} if ( \$? != 0 ) then echo "CICE run did not complete - see \${CICE_LOGDIR}/\${CICE_RUNLOG_FILE}" - if ( \$?CICE_TEST ) then - echo "FAIL \${CICE_CASENAME} run" >> \${CICE_CASEDIR}/test_output - endif exit -1 endif echo "\`date\` \${0}: \${CICE_CASENAME} run completed \${CICE_RUNLOG_FILE}" >> \${CICE_CASEDIR}/README.case echo "done \${0}" -if ( \$?CICE_TEST ) then - echo "PASS \${CICE_CASENAME} run" >> \${CICE_CASEDIR}/test_output -endif - EOFE #========================================== From 91e432f317ab5a37838618968a8319935ee77356 Mon Sep 17 00:00:00 2001 From: mattdturner Date: Thu, 15 Jun 2017 15:28:25 +0000 Subject: [PATCH 16/29] Update the documentation for the recent modifications to create.case --- README_v6 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README_v6 b/README_v6 index cee0f26fe..1a6ad2440 100644 --- a/README_v6 +++ b/README_v6 @@ -22,7 +22,7 @@ cd ~/mycase1 A bit more information: create.case generates a case, use "create.case -h" for help with the tool. - -c is the case name and location (required) + -c is the case name and location -m is the machine name (required) -g is the resolution (default is gx3) -p is the task x thread/task values (default is 4x1) @@ -30,6 +30,8 @@ create.case generates a case, use "create.case -h" for help with the tool. -t is the test name and location (cannot be used with -c). -b is used to specify that a baseline dataset is to be generated (only used with -t) -bd is used to specify the location of the baseline datasets (only used with -t) + -bg is used to specify the cice version name for generating baseline datasets (only used with -t) + -bc is used to specify the cice versoin name for comparison. I.e., the version name for the baseline dataset (only used with -t) -testid is used to specify a test ID (used only with -t) Several files are placed in the case directory From 16b7c4b904eab4469c29a3cf983c85b68e42f973 Mon Sep 17 00:00:00 2001 From: mattdturner Date: Thu, 15 Jun 2017 15:30:42 +0000 Subject: [PATCH 17/29] Add output to beginning of cice.tests.csh that prints information about the test (baseline generating? baseline directory, etc.). Add output to test_output after call to cice.run. Add conditional to check for output data if the test is a baseline-generating test, and write PASS/FAIL to test_output --- configuration/scripts/tests/cice.test.csh | 51 +++++++++++++++++++---- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/configuration/scripts/tests/cice.test.csh b/configuration/scripts/tests/cice.test.csh index 8319572cd..1de419768 100755 --- a/configuration/scripts/tests/cice.test.csh +++ b/configuration/scripts/tests/cice.test.csh @@ -2,12 +2,9 @@ echo ${0} -# Define this as a test case in the cice.settings file -cat >> ./cice.settings << EOF - -# Add variable defining this case_dir as a test -setenv CICE_TEST true -EOF +# $1 = ${CICE_SCRDIR} +# $2 = $baseline +# $3 = baseline (compare) directory source ./cice.settings source ${CICE_CASEDIR}/env.${CICE_MACHINE} || exit 2 @@ -19,11 +16,27 @@ set nthrds = ${CICE_NTHRDS} #========================================== +# Print information about this test to stdout +echo "" +echo "Test case directory: ${CICE_CASEDIR}" +if ($2 == 1) then + # This is a baseline generating run + echo "This is a baseline-generating test." + echo "Baseline datasets will be stored in: ${CICE_RUNDIR}" +else + # This is not a baseline-generating run + echo "This is not a baseline-generating run." + echo "Test data will be compared to data in $3" +endif + # Create test script that runs cice.run, and validates #========================================== # Write the batch code into the job file $1/cice.batch.csh ${jobfile} +if ($? == -1) then + exit -1 +endif cat >> ${jobfile} << EOF2 cd ${CICE_CASEDIR} @@ -39,10 +52,19 @@ endif # Run the CICE model ./cice.run +if ( \$? != 0 ) then + # Run failed + echo "FAIL \${CICE_CASENAME} run" >> \${CICE_CASEDIR}/test_output + exit 99 +else + # Run succeeded + echo "PASS \${CICE_CASENAME} run" >> \${CICE_CASEDIR}/test_output +endif EOF2 -if ($2 != "") then +if ($2 == 0) then + # Not a baseline-generating test cat >> ${jobfile} << EOF3 # Get the final output filename foreach file (\${CICE_RUNDIR}/restart/*) @@ -60,6 +82,21 @@ cat >> ${jobfile} << EOF3 echo "FAIL \${CICE_CASENAME} test" >> ${CICE_CASEDIR}/test_output endif EOF3 +else + # Baseline generating run +cat >> ${jobfile} << EOF3 + # Get the final output filename + foreach file (\${CICE_RUNDIR}/restart/*) + set test_data = \$file + end + + if ( \$test_data != "" ) then + echo "PASS \${CICE_CASENAME} generate" >> ${CICE_CASEDIR}/test_output + else + echo "FAIL \${CICE_CASENAME} generate" >> ${CICE_CASEDIR}/test_output + endif +EOF3 + endif #========================================== From ff71bdbc72ba7c6a62a93ac56a3b2d047bcdbfb9 Mon Sep 17 00:00:00 2001 From: mattdturner Date: Thu, 15 Jun 2017 15:31:14 +0000 Subject: [PATCH 18/29] add default CICE_TEST and CICE_BASELINE variables to cice.settings file --- configuration/scripts/cice.settings | 2 ++ 1 file changed, 2 insertions(+) mode change 100644 => 100755 configuration/scripts/cice.settings diff --git a/configuration/scripts/cice.settings b/configuration/scripts/cice.settings old mode 100644 new mode 100755 index 6c0d080ba..e578cfa38 --- a/configuration/scripts/cice.settings +++ b/configuration/scripts/cice.settings @@ -24,6 +24,8 @@ setenv CICE_BLCKY 29 setenv CICE_MXBLCKS 4 setenv CICE_DECOMP cartesian setenv CICE_DSHAPE slenderX2 +setenv CICE_TEST false # Define if this is a test case +setenv CICE_BASELINE undefined #====================================================== From 5729c9506b4a5ffaf584aaffc60220d376ee09fe Mon Sep 17 00:00:00 2001 From: mattdturner Date: Thu, 15 Jun 2017 15:34:14 +0000 Subject: [PATCH 19/29] Assign a default testid. Add new baseCom (-bc) and baseGen (-bg) arguments. Remove 'baseline' from casename. Always add testid to casename if running a test and not generating a baseline dataset. Add new code to modify CICE_RUNDIR to the baseline directory if generating a baseline dataset. Add new code to modify CICE_BASELINE to the baseline directory if not generating a baseline dataset. Modification to how cice.test.csh is called. --- create.case | 100 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 31 deletions(-) diff --git a/create.case b/create.case index e462ddbd7..f686a28ab 100755 --- a/create.case +++ b/create.case @@ -18,7 +18,9 @@ set pesx = 4x1 set sets = "" set baseline = 0 set bdir = $spval -set testid = $spval +set testid = "t00" +set baseCom = $spval # Baseline compare +set baseGen = $spval # Baseline generate if ($#argv < 1) then set helpheader = 1 @@ -42,7 +44,7 @@ cat << EOF1 NAME create.case - creates a CICE case directory -h help - -c case, case directory/name (required) + -c case, case directory/name -m machine, machine name (required) -p tasks x threads, mxn (default is 4x1) -g grid, grid (default = gx3) @@ -55,15 +57,19 @@ NAME - "10day": Compiles code and performs 10 day run - "annual": Compiles code and performs annual run - "restart": Compiles code and performs an exact restart test - -b baseline, generate baseline data - -bd baseline dir, location of baseline dataset - -testid test ID, user-defined indentifier for test + -b generate baseline data (this does NOT take an argument) + -bd baseline directory, high level directory where baselines are stored + -bg cice version name for generate, directory under the baseline directory where baselines are stored + -bc cice version name for compare, directory under the baseline directory where baselines are stored + -testid test ID, user-defined indentifier for test (default = t00) EXAMPLES: create.case -h create.case -c ~/caseA -m yellowstone create.case -p 32x4 -g gx1 -m gordon -c caseB create.case -c ~/caseC -m spirit -s diag1,writeicf + + For testing instructions, please view README.test EOF1 exit -1 @@ -114,6 +120,12 @@ while (1) case "-bd": set bdir = $argv[1] breaksw + case "-bc": + set baseCom = $argv[1] + breaksw + case "-bg": + set baseGen = $argv[1] + breaksw case "-testid": set testid = $argv[1] breaksw @@ -165,32 +177,17 @@ if ($case != $spval) then else if ($sets != "") then set soptions = `echo $sets | sed 's/,/_/g'` - if ($baseline == 1) then - if ( $testid != $spval ) then - set testname = "${test}_baseline_${grid}_${mach}_${pesx}_${soptions}.${testid}" - else - set testname = "${test}_baseline_${grid}_${mach}_${pesx}_$soptions" - endif + # Only include $testid in testname if this is not a baseline-generating run + if ($baseline == 0) then + set testname = "${test}_${grid}_${mach}_${pesx}_${soptions}.${testid}" else - if ( $testid != $spval ) then - set testname = "${test}_${grid}_${mach}_${pesx}_${soptions}.${testid}" - else - set testname = "${test}_${grid}_${mach}_${pesx}_$soptions" - endif + set testname = "${test}_${grid}_${mach}_${pesx}_${soptions}" endif else - if ($baseline == 1) then - if ( $testid != $spval ) then - set testname = "${test}_baseline_${grid}_${mach}_${pesx}.${testid}" - else - set testname = "${test}_baseline_${grid}_${mach}_$pesx" - endif + if ($baseline == 0) then + set testname = "${test}_${grid}_${mach}_${pesx}.${testid}" else - if ( $testid != $spval ) then - set testname = "${test}_${grid}_${mach}_${pesx}.${testid}" - else - set testname = "${test}_${grid}_${mach}_$pesx" - endif + set testname = "${test}_${grid}_${mach}_${pesx}" endif endif if (-d $testname) then @@ -281,12 +278,48 @@ grid_file = '${CICE_DECOMP_GRIDFILE}' kmt_file = '${CICE_DECOMP_KMTFILE}' EOF1 +# If this is a baseline generating test, and baseGen is passed, modify CICE_RUNDIR +if ($test != $spval && $baseline == 1) then + if ($baseGen != $spval) then + if ($bdir != $spval) then + setenv rundir_tmp ${bdir}/$baseGen + else + setenv rundir_tmp ${CICE_MACHINE_BASELINE}/$baseGen + endif + else + if ($bdir != $spval) then + setenv rundir_tmp ${bdir} + else + setenv rundir_tmp ${CICE_MACHINE_BASELINE} + endif + endif +else + setenv rundir_tmp ${CICE_MACHINE_WKDIR} +endif + +# If this is a baseline-compare test, modify CICE_RUNDIR +if ($test != $spval && $baseline == 0) then + if ($baseCom != $spval)then + if ($bdir != $spval) then + setenv basedir_tmp ${bdir}/$baseCom + else + setenv basedir_tmp ${CICE_MACHINE_BASELINE}/$baseCom + endif + else + if ($bdir != $spval) then + setenv basedir_tmp ${bdir} + else + setenv basedir_tmp ${CICE_MACHINE_BASELINE} + endif + endif +endif + cat >! ${fsmods} << EOF1 setenv CICE_SANDBOX ${CICE_SANDBOX} setenv CICE_CASENAME ${casename} setenv CICE_CASEDIR ${casedir} setenv CICE_MACHINE ${mach} -setenv CICE_RUNDIR ${CICE_MACHINE_WKDIR}/${casename} +setenv CICE_RUNDIR ${rundir_tmp}/${casename} setenv CICE_GRID ${grid} setenv CICE_NXGLOB ${CICE_DECOMP_NXGLOB} setenv CICE_NYGLOB ${CICE_DECOMP_NYGLOB} @@ -298,6 +331,7 @@ setenv CICE_MXBLCKS ${CICE_DECOMP_MXBLCKS} setenv CICE_BLCKX ${CICE_DECOMP_BLCKX} setenv CICE_BLCKY ${CICE_DECOMP_BLCKY} setenv CICE_RSTPFILE ${CICE_DECOMP_RSTPFILE} +setenv CICE_BASELINE ${basedir_tmp} EOF1 if ($#sets > 0) then @@ -327,6 +361,8 @@ if ($test != $spval) then echo "adding namelist mods test_nml.${test}" set found = 1 endif + # Define this as a test case + echo "setenv CICE_TEST true" >> ${fsmods} if (${found} == 0) then echo "${0}: ERROR, ${CICE_SCRDIR}/options/test_nml.${name} not found" exit -1 @@ -347,16 +383,18 @@ ${casescr}/cice.run.setup.csh ${CICE_SCRDIR} #------------------------------------------------------------ if ($test != $spval) then + # Print information to stdout + echo "Creating scripts for $test test" + # Generate test script if ($test == 'restart') then ${CICE_SCRDIR}/tests/cice.restart.csh ${CICE_SCRDIR} - else if ($bdir != $spval) then - ${CICE_SCRDIR}/tests/cice.test.csh ${CICE_SCRDIR} $bdir else - ${CICE_SCRDIR}/tests/cice.test.csh ${CICE_SCRDIR} + ${CICE_SCRDIR}/tests/cice.test.csh ${CICE_SCRDIR} $baseline ${CICE_BASELINE}/$casename endif endif +echo " " echo "${0} done" echo " " From 648209034558f54b6fa6f321abcfa142fb618abf Mon Sep 17 00:00:00 2001 From: mattdturner Date: Thu, 15 Jun 2017 16:32:52 +0000 Subject: [PATCH 20/29] Add PASS/FAIL commands to cice.restart.csh after calls to cice.run. Replace calls to perl (when modifying namelists) with a call to parse_namelist.sh. Slight modifications to allow for the restart case to be re-run successfully. --- configuration/scripts/tests/cice.restart.csh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/configuration/scripts/tests/cice.restart.csh b/configuration/scripts/tests/cice.restart.csh index ab1e43d97..d1338db9c 100755 --- a/configuration/scripts/tests/cice.restart.csh +++ b/configuration/scripts/tests/cice.restart.csh @@ -40,7 +40,10 @@ endif # Run the CICE model for the 2-day simulation ./cice.run if ( \$? != 0 ) then + echo "FAIL \${CICE_CASENAME} 2-day-run" >> \${CICE_CASEDIR}/test_output exit 99 +else + echo "PASS \${CICE_CASENAME} 2-day-run" >> \${CICE_CASEDIR}/test_output endif # Prepend 'baseline_' to the final restart file to save for comparison @@ -54,15 +57,18 @@ mv \$test_data \$baseline_data perl -i -pe's/(\d{4})-(\d{2})-(\d{2})/sprintf("%04d-%02d-%02d",\$1,\$2,\$3-1)/e' \${CICE_RUNDIR}/ice.restart_file # Modify the namelist for the restart simulation -cp ice_in ice_in.restart_full -perl -i -pe"s/(npt\s+=)\s(\d+)/\1 24/" ice_in # replace npt = 48 with npt = 24 -perl -i -pe"s/(dumpfreq_n\s+=)\s(\d+)/\1 1/" ice_in # replace dump freq with 1 -perl -i -pe"s/(runtype\s+=)\s(\S+)/\1 'continue'/" ice_in # runtype with continuation +cp ice_in ice_in.2-day +\${CICE_CASEDIR}/casescripts/parse_namelist.sh ice_in \${CICE_CASEDIR}/casescripts/test_nml.restart2 # Run the CICE model for the restart simulation ./cice.run +cp ice_in ice_in.restart +cp ice_in.2-day ice_in if ( \$? != 0 ) then + echo "FAIL \${CICE_CASENAME} restart-run" >> \${CICE_CASEDIR}/test_output exit 99 +else + echo "PASS \${CICE_CASENAME} restart-run" >> \${CICE_CASEDIR}/test_output endif EOF2 @@ -72,9 +78,9 @@ echo "Performing binary comparison between files:" echo "baseline: \$baseline_data" echo "test: \$test_data" if ( { cmp -s \$test_data \$baseline_data } ) then - echo "PASS \${CICE_CASENAME} test" >> ${CICE_CASEDIR}/test_output + echo "PASS \${CICE_CASENAME} compare" >> ${CICE_CASEDIR}/test_output else - echo "FAIL \${CICE_CASENAME} test" >> ${CICE_CASEDIR}/test_output + echo "FAIL \${CICE_CASENAME} compare" >> ${CICE_CASEDIR}/test_output endif EOF3 From f5e45431775d55efc5b94e388b29e6f6439af05c Mon Sep 17 00:00:00 2001 From: mattdturner Date: Thu, 15 Jun 2017 16:40:25 +0000 Subject: [PATCH 21/29] For restart test case, create.case now copies new test_nml.restart2 file to casescripts directory --- create.case | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/create.case b/create.case index f686a28ab..1f88cbf4e 100755 --- a/create.case +++ b/create.case @@ -215,6 +215,15 @@ foreach file (cice.build cice.settings Makefile ice_in makdep.c) endif cp -f -p ${CICE_SCRDIR}/$file ${casedir} end +# For restart test case, copy extra namelist modification file to casedir +if ($test == 'restart') then + set file = "options/test_nml.restart2" + if !(-e ${CICE_SCRDIR}/$file) then + echo "${0}: ERROR, ${CICE_SCRDIR}/$file not found" + exit -1 + endif + cp -f -p ${CICE_SCRDIR}/$file ${casescr} +endif # from machines dir to case foreach file (env.${mach} Macros.${mach}) From 374955d3b7be3f52c524664e6671856ae8b2180b Mon Sep 17 00:00:00 2001 From: mattdturner Date: Thu, 15 Jun 2017 16:40:48 +0000 Subject: [PATCH 22/29] add new test_nml.restart2 options file --- configuration/scripts/options/test_nml.restart2 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 configuration/scripts/options/test_nml.restart2 diff --git a/configuration/scripts/options/test_nml.restart2 b/configuration/scripts/options/test_nml.restart2 new file mode 100644 index 000000000..4eefa9f10 --- /dev/null +++ b/configuration/scripts/options/test_nml.restart2 @@ -0,0 +1,8 @@ +npt = 24 +dumpfreq = 'd' +dumpfreq_n = 1 +bfbflag = .true. +diag_type = 'stdout' +print_global = .true. +histfreq = 'd','x','x','x','x' +runtype = 'continue' From 356f958c314dd07958ba0c5819ab6d1bea8e0dc3 Mon Sep 17 00:00:00 2001 From: mattdturner Date: Thu, 15 Jun 2017 20:50:49 +0000 Subject: [PATCH 23/29] Modify README.test to account for the recent updates to the testing suite --- README.test | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/README.test b/README.test index 513caac9a..f76619a59 100644 --- a/README.test +++ b/README.test @@ -35,7 +35,7 @@ cat test_output Quickstart (example): -./create.case -t smoke -m conrad -bd /path/to/baseline/restart +./create.case -t smoke -m conrad cd smoke_gx3_conrad_4x1 ./cice.build ./cice.submit @@ -43,13 +43,27 @@ cd smoke_gx3_conrad_4x1 cat test_output ---- To run a test case without comparing to a baseline --- +--- To run a regression test (compare cicev6.0.1 output to cicev6.0.0 output) --- Quickstart (example): -./create.case -t smoke -m conrad +./create.case -t smoke -m conrad -b -bg cicev6.0.1 -bc cicev6.0.0 cd smoke_gx3_conrad_4x1 ./cice.build ./cice.submit # After job finishes, check output cat test_output + + +Additional Details: +- The '-b' flag can be combined with '-bd' to specify the location where you + want the baseline dataset to be written. Without specifying '-bd', the + baseline dataset will be written to the default baseline directory found + in the env. file (CICE_MACHINE_BASELINE). +- If '-b' is not passed, the '-bd' option will specify the location of the + baseline dataset that you want to compare to. Without specifying '-bd', + the scripts will look for baseline datasets in the default baseline + directory found in the env. file (CICE_MACHINE_BASELINE). +- To generate a baseline dataset for a specific version (for regression testing), + use '-b' in conjunction to '-bg '. The scripts will then place + the baseline dataset in $CICE_MACHINE_BASELINE// From 77160325f96b29759091f7d608a2c1f5720690bd Mon Sep 17 00:00:00 2001 From: mattdturner Date: Thu, 15 Jun 2017 20:52:03 +0000 Subject: [PATCH 24/29] Add logic to handle cases where -bg and -bc are both passed. Bugfix for setting CICE_BASELINE, remove call to cice.restart.csh --- create.case | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/create.case b/create.case index 1f88cbf4e..2840ed192 100755 --- a/create.case +++ b/create.case @@ -158,6 +158,11 @@ if ($test != $spval && $test != 'smoke' && $test != '10day' && $test != 'annual' exit -1 endif +# If both -bg and -bc were used, set baseline to 2 (regression test) +if ($baseGen != $spval && $baseCom != $spval) then + set baseline = 2 +endif + set chck = `echo ${pesx} | sed 's/^[0-9]\+x[0-9]\+$/OK/'` if (${chck} == OK) then set task = `echo ${pesx} | sed s/x.\*//` @@ -180,14 +185,18 @@ else # Only include $testid in testname if this is not a baseline-generating run if ($baseline == 0) then set testname = "${test}_${grid}_${mach}_${pesx}_${soptions}.${testid}" + set testname_noid = "${test}_${grid}_${mach}_${pesx}_${soptions}" else set testname = "${test}_${grid}_${mach}_${pesx}_${soptions}" + set testname_noid = $testname endif else if ($baseline == 0) then set testname = "${test}_${grid}_${mach}_${pesx}.${testid}" + set testname_noid = "${test}_${grid}_${mach}_${pesx}" else set testname = "${test}_${grid}_${mach}_${pesx}" + set testname_noid = $testname endif endif if (-d $testname) then @@ -288,7 +297,7 @@ kmt_file = '${CICE_DECOMP_KMTFILE}' EOF1 # If this is a baseline generating test, and baseGen is passed, modify CICE_RUNDIR -if ($test != $spval && $baseline == 1) then +if ($test != $spval && $baseline != 0) then if ($baseGen != $spval) then if ($bdir != $spval) then setenv rundir_tmp ${bdir}/$baseGen @@ -307,7 +316,7 @@ else endif # If this is a baseline-compare test, modify CICE_RUNDIR -if ($test != $spval && $baseline == 0) then +if ($test != $spval) then if ($baseCom != $spval)then if ($bdir != $spval) then setenv basedir_tmp ${bdir}/$baseCom @@ -321,6 +330,8 @@ if ($test != $spval && $baseline == 0) then setenv basedir_tmp ${CICE_MACHINE_BASELINE} endif endif +else + setenv basedir_tmp ${CICE_MACHINE_BASELINE} endif cat >! ${fsmods} << EOF1 @@ -396,11 +407,7 @@ if ($test != $spval) then echo "Creating scripts for $test test" # Generate test script - if ($test == 'restart') then - ${CICE_SCRDIR}/tests/cice.restart.csh ${CICE_SCRDIR} - else - ${CICE_SCRDIR}/tests/cice.test.csh ${CICE_SCRDIR} $baseline ${CICE_BASELINE}/$casename - endif + ${CICE_SCRDIR}/tests/cice.test.csh ${CICE_SCRDIR} $baseline ${CICE_BASELINE}/$testname_noid $test endif echo " " From 39b3e56d7de4b321bd32f13183f6801999db1231 Mon Sep 17 00:00:00 2001 From: mattdturner Date: Thu, 15 Jun 2017 20:54:02 +0000 Subject: [PATCH 25/29] Add test name as an argument. Add logic to handle regression runs. Combine the cice.restart.csh and cice.test.csh scripts into a single cice.test.csh script. --- configuration/scripts/tests/cice.restart.csh | 101 --------------- configuration/scripts/tests/cice.test.csh | 126 ++++++++++++++++--- 2 files changed, 112 insertions(+), 115 deletions(-) delete mode 100755 configuration/scripts/tests/cice.restart.csh diff --git a/configuration/scripts/tests/cice.restart.csh b/configuration/scripts/tests/cice.restart.csh deleted file mode 100755 index d1338db9c..000000000 --- a/configuration/scripts/tests/cice.restart.csh +++ /dev/null @@ -1,101 +0,0 @@ -#! /bin/csh -f - -echo ${0} - -# Define this as a test case in the cice.settings file -cat >> ./cice.settings << EOF - -# Add variable defining this case_dir as a test -setenv CICE_TEST true -EOF - -source ./cice.settings -source ${CICE_CASEDIR}/env.${CICE_MACHINE} || exit 2 - -set jobfile = cice.test -set subfile = cice.submit - -set nthrds = ${CICE_NTHRDS} - -#========================================== - -# Create test script that runs cice.run, and validates -#========================================== - -# Write the batch code into the job file -$1/cice.batch.csh ${jobfile} - -cat >> ${jobfile} << EOF2 -cd ${CICE_CASEDIR} -source ./cice.settings || exit 2 -source ./env.\${CICE_MACHINE} || exit 2 - -# Check to see if executable exists in CICE_RUNDIR -if ( ! -f \${CICE_RUNDIR}/cice ) then - echo "cice executable does not exist in \${CICE_RUNDIR}. " - echo "Please run cice.build before this test." - exit 99 -endif - -# Run the CICE model for the 2-day simulation -./cice.run -if ( \$? != 0 ) then - echo "FAIL \${CICE_CASENAME} 2-day-run" >> \${CICE_CASEDIR}/test_output - exit 99 -else - echo "PASS \${CICE_CASENAME} 2-day-run" >> \${CICE_CASEDIR}/test_output -endif - -# Prepend 'baseline_' to the final restart file to save for comparison -foreach file (\${CICE_RUNDIR}/restart/*) - set test_data = \$file -end -set baseline_data = \${CICE_RUNDIR}/restart/baseline_\$test_data:t -mv \$test_data \$baseline_data - -# Modify the contents of the pointer file for restart -perl -i -pe's/(\d{4})-(\d{2})-(\d{2})/sprintf("%04d-%02d-%02d",\$1,\$2,\$3-1)/e' \${CICE_RUNDIR}/ice.restart_file - -# Modify the namelist for the restart simulation -cp ice_in ice_in.2-day -\${CICE_CASEDIR}/casescripts/parse_namelist.sh ice_in \${CICE_CASEDIR}/casescripts/test_nml.restart2 - -# Run the CICE model for the restart simulation -./cice.run -cp ice_in ice_in.restart -cp ice_in.2-day ice_in -if ( \$? != 0 ) then - echo "FAIL \${CICE_CASENAME} restart-run" >> \${CICE_CASEDIR}/test_output - exit 99 -else - echo "PASS \${CICE_CASENAME} restart-run" >> \${CICE_CASEDIR}/test_output -endif - -EOF2 - -cat >> ${jobfile} << EOF3 -echo "Performing binary comparison between files:" -echo "baseline: \$baseline_data" -echo "test: \$test_data" -if ( { cmp -s \$test_data \$baseline_data } ) then - echo "PASS \${CICE_CASENAME} compare" >> ${CICE_CASEDIR}/test_output -else - echo "FAIL \${CICE_CASENAME} compare" >> ${CICE_CASEDIR}/test_output -endif -EOF3 - -#========================================== - -chmod +x ${jobfile} - -#========================================== - -cat >! ${subfile} << EOFS -#!/bin/csh -f - -${CICE_MACHINE_SUBMIT} ${jobfile} -echo "\`date\` \${0}: ${CICE_CASENAME} job submitted" >> ${CICE_CASEDIR}/README.case - -EOFS - -chmod +x ${subfile} diff --git a/configuration/scripts/tests/cice.test.csh b/configuration/scripts/tests/cice.test.csh index 1de419768..ce1c4462f 100755 --- a/configuration/scripts/tests/cice.test.csh +++ b/configuration/scripts/tests/cice.test.csh @@ -5,6 +5,7 @@ echo ${0} # $1 = ${CICE_SCRDIR} # $2 = $baseline # $3 = baseline (compare) directory +# $4 = $test source ./cice.settings source ${CICE_CASEDIR}/env.${CICE_MACHINE} || exit 2 @@ -18,15 +19,22 @@ set nthrds = ${CICE_NTHRDS} # Print information about this test to stdout echo "" +echo "Test name: $4" echo "Test case directory: ${CICE_CASEDIR}" -if ($2 == 1) then - # This is a baseline generating run - echo "This is a baseline-generating test." - echo "Baseline datasets will be stored in: ${CICE_RUNDIR}" -else - # This is not a baseline-generating run - echo "This is not a baseline-generating run." - echo "Test data will be compared to data in $3" +if ($4 != 'restart') then + if ($2 == 2) then + echo "This is a regression run" + echo "Baseline datasets will be stored in: ${CICE_RUNDIR}" + echo "Data will be compared to data in $3" + else if ($2 == 1) then + # This is a baseline generating run + echo "This is a baseline-generating test." + echo "Baseline datasets will be stored in: ${CICE_RUNDIR}" + else + # This is not a baseline-generating run + echo "This is not a baseline-generating run." + echo "Test data will be compared to data in $3" + endif endif # Create test script that runs cice.run, and validates @@ -38,6 +46,10 @@ if ($? == -1) then exit -1 endif +if ($4 == 'restart') then + goto restart +endif + cat >> ${jobfile} << EOF2 cd ${CICE_CASEDIR} source ./cice.settings || exit 2 @@ -71,18 +83,18 @@ cat >> ${jobfile} << EOF3 set test_data = \$file end - set baseline_data = $2/\$test_data:t + set baseline_data = $3/restart/\$test_data:t echo "Performing binary comparison between files:" echo "baseline: \$baseline_data" echo "test: \$test_data" if ( { cmp -s \$test_data \$baseline_data } ) then - echo "PASS \${CICE_CASENAME} test" >> ${CICE_CASEDIR}/test_output + echo "PASS \${CICE_CASENAME} compare" >> ${CICE_CASEDIR}/test_output else - echo "FAIL \${CICE_CASENAME} test" >> ${CICE_CASEDIR}/test_output + echo "FAIL \${CICE_CASENAME} compare" >> ${CICE_CASEDIR}/test_output endif EOF3 -else +else if ($2 == 1) then # Baseline generating run cat >> ${jobfile} << EOF3 # Get the final output filename @@ -96,12 +108,98 @@ cat >> ${jobfile} << EOF3 echo "FAIL \${CICE_CASENAME} generate" >> ${CICE_CASEDIR}/test_output endif EOF3 +else + # Regression run +cat >> ${jobfile} << EOF3 + # Get the final output filename + foreach file (\${CICE_RUNDIR}/restart/*) + set test_data = \$file + end + + if ( \$test_data != "" ) then + echo "PASS \${CICE_CASENAME} generate" >> ${CICE_CASEDIR}/test_output + else + echo "FAIL \${CICE_CASENAME} generate" >> ${CICE_CASEDIR}/test_output + endif + set baseline_data = $3/restart/\$test_data:t + + echo "Performing binary comparison between files:" + echo "baseline: \$baseline_data" + echo "test: \$test_data" + if ( { cmp -s \$test_data \$baseline_data } ) then + echo "PASS \${CICE_CASENAME} compare" >> ${CICE_CASEDIR}/test_output + else + echo "FAIL \${CICE_CASENAME} compare" >> ${CICE_CASEDIR}/test_output + endif +EOF3 endif -#========================================== +goto chmod + +restart: +cat >> ${jobfile} << EOF2 +cd ${CICE_CASEDIR} +source ./cice.settings || exit 2 +source ./env.\${CICE_MACHINE} || exit 2 + +# Check to see if executable exists in CICE_RUNDIR +if ( ! -f \${CICE_RUNDIR}/cice ) then + echo "cice executable does not exist in \${CICE_RUNDIR}. " + echo "Please run cice.build before this test." + exit 99 +endif + +# Run the CICE model for the 2-day simulation +./cice.run +if ( \$? != 0 ) then + echo "FAIL \${CICE_CASENAME} 2-day-run" >> \${CICE_CASEDIR}/test_output + exit 99 +else + echo "PASS \${CICE_CASENAME} 2-day-run" >> \${CICE_CASEDIR}/test_output +endif + +# Prepend 'baseline_' to the final restart file to save for comparison +foreach file (\${CICE_RUNDIR}/restart/*) + set test_data = \$file +end +set baseline_data = \${CICE_RUNDIR}/restart/baseline_\$test_data:t +mv \$test_data \$baseline_data + +# Modify the contents of the pointer file for restart +perl -i -pe's/(\d{4})-(\d{2})-(\d{2})/sprintf("%04d-%02d-%02d",\$1,\$2,\$3-1)/e' \${CICE_RUNDIR}/ice.restart_file -chmod +x ${jobfile} +# Modify the namelist for the restart simulation +cp ice_in ice_in.2-day +\${CICE_CASEDIR}/casescripts/parse_namelist.sh ice_in \${CICE_CASEDIR}/casescripts/test_nml.restart2 + +# Run the CICE model for the restart simulation +./cice.run +cp ice_in ice_in.restart +cp ice_in.2-day ice_in +if ( \$? != 0 ) then + echo "FAIL \${CICE_CASENAME} restart-run" >> \${CICE_CASEDIR}/test_output + exit 99 +else + echo "PASS \${CICE_CASENAME} restart-run" >> \${CICE_CASEDIR}/test_output +endif + +EOF2 + +cat >> ${jobfile} << EOF3 +echo "Performing binary comparison between files:" +echo "baseline: \$baseline_data" +echo "test: \$test_data" +if ( { cmp -s \$test_data \$baseline_data } ) then + echo "PASS \${CICE_CASENAME} compare" >> ${CICE_CASEDIR}/test_output +else + echo "FAIL \${CICE_CASENAME} compare" >> ${CICE_CASEDIR}/test_output +endif +EOF3 + +#========================================== +chmod: + chmod +x ${jobfile} #========================================== From 204fd6ccbeeefb1c0e078002d0548f306c58533f Mon Sep 17 00:00:00 2001 From: mattdturner Date: Thu, 22 Jun 2017 14:17:23 +0000 Subject: [PATCH 26/29] A few corrections in README.test. Also added a few clarifying statements to the README.test file. --- README.test | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/README.test b/README.test index f76619a59..4b8aef28e 100644 --- a/README.test +++ b/README.test @@ -13,18 +13,22 @@ CICE Consortium sea ice model. The tests currently supported are: files to a baseline dataset. 3. Exact restart - Ensures that the output from a cold-start simulation and a restart simulation provide bit-for-bit identical - results. + results. No baseline dataset needs to be created for + this test, as the baseline and test datasets are computed + at the same time. 4. Annual test - Ensures that the model compiles successfully and runs to completion for an annual simulation. Validation is determined by performing a binary comparison on restart files to a baseline dataset. +Please run './create.case -h' for additional details. + --- To generate a baseline dataset for a test case --- Quickstart (example): ./create.case -t smoke -m conrad -b -cd smoke_baseline_gx3_conrad_4x1 +cd smoke_gx3_conrad_4x1 ./cice.build ./cice.submit # After job finishes, check output @@ -36,7 +40,7 @@ cat test_output Quickstart (example): ./create.case -t smoke -m conrad -cd smoke_gx3_conrad_4x1 +cd smoke_gx3_conrad_4x1.t00 ./cice.build ./cice.submit # After job finishes, check output @@ -56,14 +60,16 @@ cat test_output Additional Details: +- The available options for '-t' are 'smoke', '10day', 'annual', and 'restart'. +- For a 'restart' test, no baseline dataset needs to be generated or compared against. - The '-b' flag can be combined with '-bd' to specify the location where you want the baseline dataset to be written. Without specifying '-bd', the baseline dataset will be written to the default baseline directory found in the env. file (CICE_MACHINE_BASELINE). -- If '-b' is not passed, the '-bd' option will specify the location of the - baseline dataset that you want to compare to. Without specifying '-bd', - the scripts will look for baseline datasets in the default baseline - directory found in the env. file (CICE_MACHINE_BASELINE). +- If neither '-b' or '-bd' are passed, the scripts will look for baseline datasets + in the default baseline directory found in the env. file (CICE_MACHINE_BASELINE). + If the '-bd' option is passed, the scripts will look for baseline datasets in the + location passed to the -bd argument. - To generate a baseline dataset for a specific version (for regression testing), use '-b' in conjunction to '-bg '. The scripts will then place the baseline dataset in $CICE_MACHINE_BASELINE// From cb845efe77ededa6790524bac7e7c642925fb52d Mon Sep 17 00:00:00 2001 From: mattdturner Date: Thu, 22 Jun 2017 14:22:46 +0000 Subject: [PATCH 27/29] Change diagfreq from once per year to daily for annual test case --- configuration/scripts/options/test_nml.annual | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/scripts/options/test_nml.annual b/configuration/scripts/options/test_nml.annual index 43006c3cc..3b5850fa8 100644 --- a/configuration/scripts/options/test_nml.annual +++ b/configuration/scripts/options/test_nml.annual @@ -1,7 +1,7 @@ npt = 8760 dumpfreq = 'm' dumpfreq_n = 12 -diagfreq = 8760 +diagfreq = 24 bfbflag = .true. diag_type = 'stdout' print_global = .true. From 544567135b2b3d2b1d866402dc6c41cb75861f83 Mon Sep 17 00:00:00 2001 From: mattdturner Date: Thu, 22 Jun 2017 14:27:51 +0000 Subject: [PATCH 28/29] Update the list of available tests in README.test to also specify the argument passed to '-t' in order to create the test case --- README.test | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.test b/README.test index 4b8aef28e..c73f6eb20 100644 --- a/README.test +++ b/README.test @@ -6,20 +6,24 @@ CICE Consortium sea ice model. The tests currently supported are: 1. "Smoke" test - Ensures that the model compiles successfully and runs to completion for a 1 day simulation. Validation is determined by performing a binary comparison on restart - files to a baseline dataset. + files to a baseline dataset. This test is created by + passing 'smoke' to the '-t' argument. 2. 10-day test - Ensures that the model compiles successfully and runs to completion for a 10 day simulation. Validation is determined by performing a binary comparison on restart - files to a baseline dataset. + files to a baseline dataset. This test is created by + passing '10day' to the '-t' argument. 3. Exact restart - Ensures that the output from a cold-start simulation and a restart simulation provide bit-for-bit identical results. No baseline dataset needs to be created for this test, as the baseline and test datasets are computed - at the same time. + at the same time. This test is created by passing 'restart' + to the '-t' argument. 4. Annual test - Ensures that the model compiles successfully and runs to completion for an annual simulation. Validation is determined by performing a binary comparison on restart - files to a baseline dataset. + files to a baseline dataset. This test is created by + passing 'annual' to the '-t' argument. Please run './create.case -h' for additional details. From 3984d9970d6f7227c262321c0b25ff29c207a054 Mon Sep 17 00:00:00 2001 From: mattdturner Date: Tue, 27 Jun 2017 15:54:33 +0000 Subject: [PATCH 29/29] Add information about the -testid flag to README.test --- README.test | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/README.test b/README.test index c73f6eb20..248b23c38 100644 --- a/README.test +++ b/README.test @@ -67,13 +67,16 @@ Additional Details: - The available options for '-t' are 'smoke', '10day', 'annual', and 'restart'. - For a 'restart' test, no baseline dataset needs to be generated or compared against. - The '-b' flag can be combined with '-bd' to specify the location where you - want the baseline dataset to be written. Without specifying '-bd', the - baseline dataset will be written to the default baseline directory found - in the env. file (CICE_MACHINE_BASELINE). + want the baseline dataset to be written. Without specifying '-bd', the + baseline dataset will be written to the default baseline directory found + in the env. file (CICE_MACHINE_BASELINE). - If neither '-b' or '-bd' are passed, the scripts will look for baseline datasets - in the default baseline directory found in the env. file (CICE_MACHINE_BASELINE). - If the '-bd' option is passed, the scripts will look for baseline datasets in the - location passed to the -bd argument. + in the default baseline directory found in the env. file (CICE_MACHINE_BASELINE). + If the '-bd' option is passed, the scripts will look for baseline datasets in the + location passed to the -bd argument. - To generate a baseline dataset for a specific version (for regression testing), - use '-b' in conjunction to '-bg '. The scripts will then place - the baseline dataset in $CICE_MACHINE_BASELINE// + use '-b' in conjunction to '-bg '. The scripts will then place + the baseline dataset in $CICE_MACHINE_BASELINE// +- The '-testid' flag allows users to specify a testing id that will be added to the + end of the case directory. For example, "./create.case -m conrad -t smoke -testid t12" + creates the directory smoke_gx3_conrad_4x1.t12. The default test id is "t00".