Skip to content

Commit

Permalink
Add support for .cice_set (CICE-Consortium#464)
Browse files Browse the repository at this point in the history
Add warning messages when multiple set options overlap (CICE-Consortium#243)
Fix namelist output diagnostic for atmbndy (CICE-Consortium#493)
Modify git clone in script to use --depth=1 (CICE-Consortium#492)
  • Loading branch information
apcraig committed Jul 23, 2020
1 parent b055c7f commit 1c644df
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 9 deletions.
19 changes: 18 additions & 1 deletion cice.setup
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ set suitebuild = true
set suitereuse = true
set suiterun = false
set suitesubmit = true
set ignoreuserset = false

if ($#argv < 1) then
set helpheader = 1
Expand Down Expand Up @@ -98,6 +99,7 @@ DESCRIPTION
--acct : account number for the batch submission
--grid, -g : grid, grid (default = ${grid})
--set, -s : case option setting(s), comma separated (default = " ")
--ignore-user-set: ignore ~/.cice_set if it exists
--queue : queue for the batch submission
For testing
Expand All @@ -112,7 +114,7 @@ DESCRIPTION
--diff : generate comparison against another case
--report : automatically post results when tests are complete
--coverage : generate and report test coverage metrics when tests are complete,
requires GNU compiler (ie. normally ``--env gnu``)
requires GNU compiler (ie. normally --env gnu)
--setup-only : for suite, setup testcases, no build, no submission
--setup-build : for suite, setup and build testcases, no submission
--setup-build-run : for suite, setup, build, and run interactively
Expand Down Expand Up @@ -263,6 +265,10 @@ while (1)
set suitesubmit = true
shift argv

else if ("$option" == "--ignore-user-set") then
set ignoreuserset = true
shift argv

# arguments with settings
else
shift argv
Expand Down Expand Up @@ -412,6 +418,17 @@ set vers = ${ICE_VERSION}
set shhash = `echo ${hash} | cut -c 1-10`
if ( ${dosuite} == 0 ) then
# grab user defined default sets
if ("${ignoreuserset}" == "false" && -e ~/.cice_set) then
set setsu1 = `cat ~/.cice_set`
# get rid of spaces if they exist!
set setsuser = `echo ${setsu1} | sed 's/ //g'`
if ( ${sets} == "" ) then
set sets = "${setsuser}"
else
set sets = "${setsuser},${sets}"
endif
endif
set teststring = "${test} ${grid} ${pesx} ${sets}"
if ( $bfbcomp != ${spval} ) then
if ( ${sets} == "" ) then
Expand Down
4 changes: 2 additions & 2 deletions cicecore/cicedynB/general/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1290,12 +1290,12 @@ subroutine input_data
write(nu_diag,1012) ' calc_strair = ', calc_strair,' calculate wind stress and speed'
write(nu_diag,1012) ' rotate_wind = ', rotate_wind,' rotate wind/stress to computational grid'
write(nu_diag,1012) ' formdrag = ', formdrag,' use form drag parameterization'
if (trim(atmbndy) == 'constant') then
if (trim(atmbndy) == 'default') then
tmpstr2 = ': stability-based boundary layer'
write(nu_diag,1012) ' highfreq = ', highfreq,' high-frequency atmospheric coupling'
write(nu_diag,1022) ' natmiter = ', natmiter,' number of atmo boundary layer iterations'
write(nu_diag,1006) ' atmiter_conv = ', atmiter_conv,' convergence criterion for ustar'
elseif (trim(atmbndy) == 'default') then
elseif (trim(atmbndy) == 'constant') then
tmpstr2 = ': boundary layer uses bulk transfer coefficients'
endif
write(nu_diag,*) 'atmbndy = ', trim(atmbndy),trim(tmpstr2)
Expand Down
27 changes: 26 additions & 1 deletion configuration/scripts/parse_namelist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ if [[ "$#" -ne 2 ]]; then
exit -1
fi

scriptname=`basename "$0"`
filename=$1
filemods=$2

#echo "$0 $1 $2"
echo "running parse_namelist.sh"
foundstring="FoundSTRING"
vnamearray=()
valuearray=()

while read -r line
do
Expand All @@ -24,17 +27,39 @@ do
value=`echo $line | sed "s|^[[:space:]]*\([^[:space:]]*\)[[:space:]]*=[[:space:]]*\([^[:space:]]*\).*$|\2|g"`
# echo "$line $vname $value"

found=${foundstring}
for i in "${!vnamearray[@]}"; do
if [[ "${found}" == "${foundstring}" ]]; then
vn=${vnamearray[$i]}
vv=${valuearray[$i]}
# echo "names/values $i ${vname} ${vn} ${value} ${vv}"
if [[ "$vname" == "$vn" ]]; then
found=$i
if [[ "$value" != "${vv}" ]]; then
# echo "names/values $i ${vname} ${vn} ${value} ${vv}"
echo "${scriptname} WARNING: re-overriding $vname from ${vv} to ${value}"
fi
fi
fi
done

#sed -i 's|\(^\s*'"$vname"'\s*\=\s*\)\(.*$\)|\1'"$value"'|g' $filename
cp ${filename} ${filename}.check
sed -i.sedbak -e 's|\(^[[:space:]]*'"$vname"'[[:space:]]*=[[:space:]]*\)\(.*$\)|\1'"$foundstring"'|g' ${filename}.check
grep -q ${foundstring} ${filename}.check
if [ $? -eq 0 ]; then
sed -i.sedbak -e 's|\(^[[:space:]]*'"$vname"'[[:space:]]*=[[:space:]]*\)\(.*$\)|\1'"$value"'|g' ${filename}
if [[ "${found}" == "${foundstring}" ]]; then
vnamearray+=($vname)
valuearray+=($value)
else
valuearray[$found]=${value}
fi
if [[ -e "${filename}.sedbak" ]]; then
rm ${filename}.sedbak
fi
else
echo "$0 ERROR: parsing error for ${vname}"
echo "${scriptname} ERROR: parsing error for ${vname}"
exit -99
fi
rm ${filename}.check ${filename}.check.sedbak
Expand Down
28 changes: 28 additions & 0 deletions configuration/scripts/parse_settings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ if [[ "$#" -ne 2 ]]; then
exit -1
fi

scriptname=`basename "$0"`
filename=$1
filemods=$2

#echo "$0 $1 $2"
echo "running parse_settings.sh"
foundstring="FoundSTRING"
vnamearray=()
valuearray=()

while read -r line
do
Expand All @@ -23,8 +27,32 @@ do
value=`echo $line | sed "s|\(^[[:space:]]*set[^[:space:]]*\)[[:space:]][[:space:]]*\([^[:space:]]*\)[[:space:]][[:space:]]*\([^[:space:]]*\).*$|\3|g"`
# echo "$line $vname $value"

found=${foundstring}
for i in "${!vnamearray[@]}"; do
if [[ "${found}" == "${foundstring}" ]]; then
vn=${vnamearray[$i]}
vv=${valuearray[$i]}
# echo "names/values $i ${vname} ${vn} ${value} ${vv}"
if [[ "$vname" == "$vn" ]]; then
found=$i
if [[ "$value" != "${vv}" ]]; then
# echo "names/values $i ${vname} ${vn} ${value} ${vv}"
echo "${scriptname} WARNING: re-overriding $vname from ${vv} to ${value}"
fi
fi
fi
done

#sed -i 's|\(^\s*set.* '"$vname"' \)[^#]*\(#*.*$\)|\1 '"$value"' \2|g' $filename
sed -i.sedbak -e 's|\(^[[:space:]]*set.* '"$vname"' \)[^#]*\(#*.*$\)|\1 '"$value"' \2|g' $filename

if [[ "${found}" == "${foundstring}" ]]; then
vnamearray+=($vname)
valuearray+=($value)
else
valuearray[$found]=${value}
fi

if [[ -e "${filename}.sedbak" ]]; then
rm ${filename}.sedbak
fi
Expand Down
2 changes: 1 addition & 1 deletion configuration/scripts/tests/cice.lcov.csh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set lcovhtmldir = lcov_cice_${report_name}
genhtml -o ./${lcovhtmldir} --precision 2 -t "${report_name}" total.info

rm -r -f ${lcovrepo}
git clone https://github.com/apcraig/${lcovrepo}
git clone --depth=1 https://github.com/apcraig/${lcovrepo}
cp -p -r ${lcovhtmldir} ${lcovrepo}/

cd ${lcovrepo}
Expand Down
4 changes: 2 additions & 2 deletions configuration/scripts/tests/cice_test_codecov.csh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ cd ${testdir}
# Check out current cice master
echo " "
echo "*** checkout current cice master ***"
git clone https://github.com/cice-consortium/cice cice.master.${date} --recursive
git clone --depth=1 https://github.com/cice-consortium/cice cice.master.${date} --recursive
cd cice.master.${date}
set hash = `git rev-parse --short HEAD `
cd ../
Expand All @@ -40,7 +40,7 @@ cd ../
# This also copies in all dot file at the root that do not start with .g (ie. .git*)
echo " "
echo "*** checkout current test_cice_master ***"
git clone https://github.com/apcraig/test_cice_icepack test_cice_icepack.${date}
git clone --depth=1 https://github.com/apcraig/test_cice_icepack test_cice_icepack.${date}
cd test_cice_icepack.${date}
echo " "
echo "*** remove current files and copy in cice master files ***"
Expand Down
2 changes: 1 addition & 1 deletion configuration/scripts/tests/report_results.csh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set wikirepo = "https://github.com/CICE-Consortium/Test-Results.wiki.git"
set wikiname = Test-Results.wiki

rm -r -f ${wikiname}
git clone ${wikirepo} ${wikiname}
git clone --depth=1 ${wikirepo} ${wikiname}
if ($status != 0) then
echo " "
echo "${0}: ERROR git clone failed"
Expand Down
7 changes: 6 additions & 1 deletion doc/source/user_guide/ug_running.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ specifies the compilation environment associated with the machine. This should
specifies the grid. This is a string and for the current CICE driver, gx1, gx3, and tx1 are supported. (default = gx3)

``--set``, ``-s`` SET1,SET2,SET3
specifies the optional settings for the case. The settings for ``--suite`` are defined in the suite file. Multiple settings can be specified by providing a comma deliminated set of values without spaces between settings. The available settings are in **configurations/scripts/options** and ``cice.setup --help`` will also list them. These settings files can change either the namelist values or overall case settings (such as the debug flag).
specifies the optional settings for the case. The settings for ``--suite`` are defined in the suite file. Multiple settings can be specified by providing a comma deliminated set of values without spaces between settings. The available settings are in **configurations/scripts/options** and ``cice.setup --help`` will also list them. These settings files can change either the namelist values or overall case settings (such as the debug flag). For cases and tests (not suites), settings defined in **~/.cice_set** will be included in the --set options. This behaviour can be overridden with the `--ignore-user-set`` command line option.

``--ignore-user-set``
ignores settings defined in **~/.cice.set** (if it exists) for cases and tests. **~/.cice_set** is always ignored for test suites.

For CICE, when setting up cases, the ``--case`` and ``--mach`` must be specified.
It's also recommended that ``--env`` be set explicitly as well.
Expand All @@ -229,6 +232,8 @@ change the defaults. This is done as part of the ``cice.setup`` and the
modifications are resolved in the **cice.settings** and **ice_in** file placed in
the case directory. If multiple options are chosen that conflict, then the last
option chosen takes precedent. Not all options are compatible with each other.
Settings on the command line will take precedent over serttings defined in
**~/.cice_set**.

Some of the options are

Expand Down
2 changes: 2 additions & 0 deletions doc/source/user_guide/ug_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ For individual tests, the following command line options can be set

``--set`` SET1,SET2,SET3 (see :ref:`case_options`)

``--ignore-user-set`` (see :ref:`case_options`)

``--acct`` ACCOUNT (see :ref:`case_options`)

``--grid`` GRID (see :ref:`case_options`)
Expand Down

0 comments on commit 1c644df

Please sign in to comment.