diff --git a/README.test b/README.test new file mode 100644 index 000000000..248b23c38 --- /dev/null +++ b/README.test @@ -0,0 +1,82 @@ +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. 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. 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. 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. This test is created by + passing 'annual' to the '-t' argument. + +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_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 +cd smoke_gx3_conrad_4x1.t00 +./cice.build +./cice.submit +# After job finishes, check output +cat test_output + + +--- To run a regression test (compare cicev6.0.1 output to cicev6.0.0 output) --- + +Quickstart (example): + +./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 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 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// +- 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". diff --git a/README_v6 b/README_v6 index eb9efbea8..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,9 @@ 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 - env.${machine} defines the environment diff --git a/configuration/scripts/tests/cice.10day.csh b/configuration/scripts/cice.batch.csh similarity index 56% rename from configuration/scripts/tests/cice.10day.csh rename to configuration/scripts/cice.batch.csh index 6eafe7b90..38105cbfb 100755 --- a/configuration/scripts/tests/cice.10day.csh +++ b/configuration/scripts/cice.batch.csh @@ -1,12 +1,15 @@ #! /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 -set jobfile = cice.10day -set subfile = cice.submit +set jobfile = $1 set ntasks = ${CICE_NTASKS} set nthrds = ${CICE_NTHRDS} @@ -24,9 +27,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 +48,20 @@ cat >> ${jobfile} << EOFB #BSUB -P ${acct} EOFB +#========================================== + +else if (${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 +92,30 @@ 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 + echo "${0} ERROR ${CICE_MACHINE} unknown" + exit -1 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.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 diff --git a/configuration/scripts/cice.launch.csh b/configuration/scripts/cice.launch.csh new file mode 100755 index 000000000..fbdeb9a02 --- /dev/null +++ b/configuration/scripts/cice.launch.csh @@ -0,0 +1,56 @@ +#! /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 + +else if (${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 + +else + echo "${0} ERROR ${CICE_MACHINE} unknown" + exit -1 +endif diff --git a/configuration/scripts/cice.run.setup.csh b/configuration/scripts/cice.run.setup.csh index 1735720c7..e189d7576 100755 --- a/configuration/scripts/cice.run.setup.csh +++ b/configuration/scripts/cice.run.setup.csh @@ -8,110 +8,14 @@ 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 - +# Write the batch code into the job file +$1/cice.batch.csh ${jobfile} +if ($? == -1) then + exit -1 endif #========================================== @@ -136,7 +40,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} @@ -153,45 +57,10 @@ 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 - +# Write the job launching logic into the job file +$1/cice.launch.csh ${jobfile} +if ($? == -1) then + exit -1 endif #========================================== @@ -205,7 +74,11 @@ 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}" + exit -1 +endif echo "\`date\` \${0}: \${CICE_CASENAME} run completed \${CICE_RUNLOG_FILE}" >> \${CICE_CASEDIR}/README.case echo "done \${0}" 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 #====================================================== 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 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. 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/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' 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.smoke.csh b/configuration/scripts/tests/cice.smoke.csh deleted file mode 100755 index a4be7df39..000000000 --- a/configuration/scripts/tests/cice.smoke.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.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 -#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 new file mode 100755 index 000000000..ce1c4462f --- /dev/null +++ b/configuration/scripts/tests/cice.test.csh @@ -0,0 +1,214 @@ +#! /bin/csh -f + +echo ${0} + +# $1 = ${CICE_SCRDIR} +# $2 = $baseline +# $3 = baseline (compare) directory +# $4 = $test + +source ./cice.settings +source ${CICE_CASEDIR}/env.${CICE_MACHINE} || exit 2 + +set jobfile = cice.test +set subfile = cice.submit + +set nthrds = ${CICE_NTHRDS} + +#========================================== + +# Print information about this test to stdout +echo "" +echo "Test name: $4" +echo "Test case directory: ${CICE_CASEDIR}" +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 +#========================================== + +# Write the batch code into the job file +$1/cice.batch.csh ${jobfile} +if ($? == -1) then + exit -1 +endif + +if ($4 == 'restart') then + goto restart +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 +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 == 0) then + # Not a baseline-generating test +cat >> ${jobfile} << EOF3 + # Get the final output filename + foreach file (\${CICE_RUNDIR}/restart/*) + set test_data = \$file + end + + 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 +else if ($2 == 1) then + # 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 +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 + +# 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} + +#========================================== + +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 c8c1c7fa3..2840ed192 100755 --- a/create.case +++ b/create.case @@ -18,6 +18,9 @@ set pesx = 4x1 set sets = "" set baseline = 0 set bdir = $spval +set testid = "t00" +set baseCom = $spval # Baseline compare +set baseGen = $spval # Baseline generate if ($#argv < 1) then set helpheader = 1 @@ -41,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) @@ -54,14 +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 (required if -t is used without -b) + -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 @@ -112,6 +120,15 @@ 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 default: echo "${0}: ERROR unknown option $option, use -h for help" exit -1 @@ -135,11 +152,17 @@ 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" +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 +# 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.\*//` @@ -159,16 +182,21 @@ if ($case != $spval) then else if ($sets != "") then set soptions = `echo $sets | sed 's/,/_/g'` - if ($baseline == 1) then - set testname = "${test}_baseline_${grid}_${mach}_${pesx}_$soptions" + # 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 = "${test}_${grid}_${mach}_${pesx}_${soptions}" + set testname_noid = $testname endif else - if ($baseline == 1) then - set testname = "${test}_baseline_${grid}_${mach}_$pesx" + 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 = "${test}_${grid}_${mach}_${pesx}" + set testname_noid = $testname endif endif if (-d $testname) then @@ -176,7 +204,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 @@ -196,6 +224,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}) @@ -259,12 +296,50 @@ 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 != 0) 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) 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 +else + setenv basedir_tmp ${CICE_MACHINE_BASELINE} +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} @@ -276,6 +351,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 @@ -305,6 +381,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 @@ -320,23 +398,19 @@ ${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} #------------------------------------------------------------ if ($test != $spval) then - # Generate test script - source ./cice.settings - source ./env.${mach} || exit 2 + # Print information to stdout + echo "Creating scripts for $test test" - if ($baseline == 0) then - ${CICE_SCRDIR}/tests/cice.${test}.csh $bdir - else - # Generate baseline dataset - ${CICE_SCRDIR}/tests/cice.${test}.csh - endif + # Generate test script + ${CICE_SCRDIR}/tests/cice.test.csh ${CICE_SCRDIR} $baseline ${CICE_BASELINE}/$testname_noid $test endif +echo " " echo "${0} done" echo " "