Skip to content

Commit

Permalink
Merge branch 'CoLM-SYSU:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangsp8 authored Feb 24, 2025
2 parents 992c3e2 + 7d336cc commit 5461a3c
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 74 deletions.
14 changes: 14 additions & 0 deletions main/MOD_Thermal.F90
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,12 @@ SUBROUTINE THERMAL (ipatch ,patchtype,is_dry_lake,lb ,deltim ,
ldew = 0.
rstfacsun_out = 0.
rstfacsha_out = 0.
assimsun_out = 0.
assimsha_out = 0.
etrsun_out = 0.
etrsha_out = 0.
gssun_out = 0.
gssha_out = 0.
IF (DEF_USE_PLANTHYDRAULICS) THEN
vegwp = -2.5e4
ENDIF
Expand Down Expand Up @@ -894,6 +900,14 @@ SUBROUTINE THERMAL (ipatch ,patchtype,is_dry_lake,lb ,deltim ,
fevpl_p (ps:pe) = 0.
etr_p (ps:pe) = 0.
hprl_p (ps:pe) = 0.
assimsun_p (ps:pe) = 0.
assimsha_p (ps:pe) = 0.
etrsun_p (ps:pe) = 0.
etrsha_p (ps:pe) = 0.
gssun_p (ps:pe) = 0.
gssha_p (ps:pe) = 0.
rstfacsun_p(ps:pe) = 0.
rstfacsha_p(ps:pe) = 0.
z0m_p (ps:pe) = (1.-fsno)*zlnd + fsno*zsno
z0m = sum( z0m_p (ps:pe)*pftfrac(ps:pe) )

Expand Down
118 changes: 118 additions & 0 deletions run/scripts/SummaryTest.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#!/bin/bash

Help()
{
#DISPLAY help
echo "!----------------------- Usage ----------------------------------------------!"
echo "Descripion:Summarize Test results"

echo "!----------------------------------------------------------------------------!"
echo 'Syntax: ./SummaryTest.bash -n $TestPath/$TestName [-f $TestLists][-i $Varlist]'
echo "!----------------------------------------------------------------------------!"
echo options:
echo "-n The Path and Name of the test working folder"
echo '-f (Optional) The list of switches of all test cases, if $TestLists '
echo ' is absent, use $ROOT/run/script/TestLists as the default test list. '
echo '-i Specify the summary item of the test restuls:'
echo ' 1)CreateCase; 2)Compile; 3)Submit_Mksrfdata;'
echo ' 4)Submit_Mkinidata; 5)Submit_Case'
echo '-h display command information'
}

SummaryTest()
{
ROOT=`awk '/ROOT/ {print $2}' machine.config`
TestName=$(basename "$1")
TestPath=$(dirname "$1")

if [ -z $ROOT ];then
echo Error in reading ROOT from machine.config
exit
fi
if [ "$3" == "All" ];then
Varlist="CreateCase Compile Submit_Mksrfdata Submit_Mkinidata Submit_Case"
fi

TestCaseLists=$2
nfile=`cat $TestCaseLists|wc -l`
for CaseName in `awk '{print $1}' $TestCaseLists`
do
echo $CaseName
for Var in $Varlist
do
PASS=`cat $TestPath/$TestName/$CaseName/TestStatus|grep $Var|grep PASS`
if [ ! -z "$PASS" ];then
echo " "$PASS
else
FAIL=`cat $TestPath/$TestName/$CaseName/TestStatus|grep $Var|grep FAIL`
if [ ! -z "$FAIL" ];then
echo " "$FAIL
else
echo " "$Var PEND
fi
fi
if [ "$Var" == "Submit_Case" ];then
if [ -f $TestPath/$TestName/$CaseName/log ];then
NAN=`grep -i nan $TestPath/$TestName/$CaseName/log`
if [ -z "$NAN" ];then
echo " "NANCheck PASS
else
echo " "NANCheck FAIL
fi
else
echo " "NANCheck PEND
fi
if [ -f $TestPath/$TestName/$CaseName/log ];then
BALANCE=`grep -i balance $TestPath/$TestName/$CaseName/log`
if [ -z "$BALANCE" ];then
echo " "balance check PASS
else
echo " "balance error FAIL
fi
else
echo " "balance check PEND
fi
fi
done
done

}


while getopts ":hn:f:i:" options ;
do
case $options in
n) TestName="$OPTARG" ;;
f) TestCaseList="$OPTARG" ;;
i) Varlist="$OPTARG" ;;
h) Help; exit;;
*) echo "invalid option: $@";exit ;;
esac
done

if [ -z "${TestName}" ]; then
echo
echo 'Error: "-n" is missing, test name is absent'
echo
Help
exit
else
if [ -z $TestCaseList ];then
TestCaseList="TestLists"
fi
fi

if [ -z "$Varlist" ];then
Varlist="All"
else
case $Varlist in
CreateCase) ;;
Compile);;
Submit_Mksrfdata);;
Submit_Mkinidata);;
Submit_Case);;
*) echo "invalid Var option: $Varlist"; exit;;
esac
fi

SummaryTest $TestName $TestCaseList $Varlist
129 changes: 63 additions & 66 deletions run/scripts/create_test
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,46 @@ Help()

submitall()
{
JobSubmit=$1
BatchSystem=$1
Mode=$2
if [ ${JobSubmit: -1} == "<" ];then
if [ "$Mode" == "RunNoMkSrf" ];then
job1_id=`${JobSubmit: 0: -1}<wait.bash| awk '{print $2}' | cut -d'<' -f2 | cut -d'>' -f1`
else
job1_id=`${JobSubmit: 0: -1}<mksrf.submit| awk '{print $2}' | cut -d'<' -f2 | cut -d'>' -f1`
fi
job2_id=`${JobSubmit: 0: -1} -w "ended($job1_id)"<init.submit| awk '{print $2}' | cut -d'<' -f2 | cut -d'>' -f1`
job3_id=`${JobSubmit: 0: -1} -w "ended($job2_id)"<case.submit| awk '{print $2}' | cut -d'<' -f2 | cut -d'>' -f1`
if [ ! "$Mode" == "RunNoMkSrf" ];then
job4_id=`${JobSubmit: 0: -1} -w "ended($job1_id)"<check_mksrf.submit`
fi
job5_id=`${JobSubmit: 0: -1} -w "ended($job2_id)"<check_init.submit`
job6_id=`${JobSubmit: 0: -1} -w "ended($job3_id)"<check_case.submit`
else
if [ "$Mode" == "RunNoMkSrf" ];then
job1_id=`$JobSubmit wait.bash| awk '{print $2}' | cut -d'<' -f2 | cut -d'>' -f1`
else
job1_id=`$JobSubmit mksrf.submit| awk '{print $2}' | cut -d'<' -f2 | cut -d'>' -f1`
fi
job2_id=`${JobSubmit} -w "ended($job1_id)"<init.submit| awk '{print $2}' | cut -d'<' -f2 | cut -d'>' -f1`
job3_id=`${JobSubmit} -w "ended($job2_id)"<case.submit| awk '{print $2}' | cut -d'<' -f2 | cut -d'>' -f1`
if [ ! "$Mode" == "RunNoMkSrf" ];then
job4_id=`${JobSubmit} -w "ended($job1_id)"<check_mksrf.submit`
fi
job5_id=`${JobSubmit} -w "ended($job2_id)"<check_init.submit`
job6_id=`${JobSubmit} -w "ended($job3_id)"<check_case.submit`
fi
Queue=$3
# Dependency=`awk '/Dependency/ {print $2}' machine.config`
# Dependency=`echo $Dependency|sed 's|JOBID|$jobid_1|g'`
case $BatchSystem in
LSF)
JobSubmit="bsub"
if [ "$Mode" == "RunNoMkSrf" ];then
job1_id=`${JobSubmit}<wait.bash -q $Queue| grep -o '[0-9]*'`
else
job1_id=`${JobSubmit}<mksrf.submit| grep -o '[0-9]*'`
fi
job2_id=`${JobSubmit} -w "done($job1_id)"<case.submit| grep -o '[0-9]'`
job3_id=`${JobSubmit} -w "ended($job2_id)"<check_all.submit`
;;
SLURM)
JobSubmit="sbatch"
if [ "$Mode" == "RunNoMkSrf" ];then
job1_id=`$JobSubmit -p $Queue wait.bash| grep -o '[0-9]*'`
else
job1_id=`$JobSubmit mksrf.submit| grep -o '[0-9]*'`
fi
job2_id=`${JobSubmit} --dependency=afterok:${job1_id} case.submit| grep -o '[0-9]*'`
job3_id=`${JobSubmit} --dependency=afterany:${job2_id} check_all.submit`
;;
PBS)
JobSubmit="qsub"
if [ "$Mode" == "RunNoMkSrf" ];then
job1_id=`${JobSubmit} -q $Queue wait.bash| grep -o '[0-9]*'`
else
job1_id=`${JobSubmit} mksrf.submit| grep -o '[0-9]*'`
fi
job2_id=`${Jobsubmit} -W depend=afterok:${job1_id} case.submit| grep -o '[0-9]'`
job3_id=`${JobSubmit} -W depend=afterany:${job2_id} check_all.submit`
;;
*)
echo BatchSystem in machine.config is invalid or missing
exit
esac
}

CompileCheck()
Expand Down Expand Up @@ -85,17 +96,21 @@ CreateTest()
TestCaseList=$2
Mode=$3
ROOT=`awk '/ROOT/ {print $2}' machine.config`
JobSubmit=`awk '/JobSubmit/ {print $2}' machine.config`
BatchSystem=`awk '/BatchSystem/ {print $2}' machine.config`
Queue=`awk '/Queue_case/ {print $2}' machine.config`

echo BatchSystem is $BatchSystem
case $BatchSystem in
LSF) Partition='#BSUB -q '$Queue;;
SLURM) Partition='#SBATCH -p '$Queue;;
PBS) Partition='#PBS -q '$Queue;;
*)echo BatchSystem $BatchSystem in machine.config is not supported or missing, only LSF,SLURM and PBS is supported;exit;;
esac
if [ -z $ROOT ];then
echo Error in reading ROOT from machine.config
exit
fi

if [ -z $JobSubmit ];then
echo Error in reading JobSubmit from machine.config
exit
fi
cd $ROOT/run/scripts
mkdir -p $TestPath/$TestName/
if [ "$Mode" == "Create" -o "$Mode" == "CreateNoComp" -o "$Mode" == "CreateNoMkSrf" ];then
Expand Down Expand Up @@ -282,65 +297,51 @@ CreateTest()
exit
fi
echo "CreateCase PEND">$TestPath/$TestName/$CaseName/TestStatus
Exe_command=`awk '/Exe_command/ {print $2}' machine.config`
sed -i "/cd/a `grep $Exe_command $TestPath/$TestName/$CaseName/init.submit`" $TestPath/$TestName/$CaseName/"case.submit"
rm $TestPath/$TestName/$CaseName/init.submit

LanddataPath=`awk '/RUNTIME/ {print $2}' machine.config`../CoLMlanddata/CoLM2024-release
if [ "$Mode" == "CreateNoMkSrf" ];then
LanddataPath=`awk '/RUNTIME/ {print $2}' machine.config`../CoLMlanddata/CoLM2024-release
rm -rf $TestPath/$TestName/$CaseName/landdata
ln -sf $LanddataPath/$LanddataFolder/ $TestPath/$TestName/$CaseName/landdata
fi
Success='"$Success"'
tailfile='`tail '$TestPath/$TestName/$CaseName/logmksrfdata'|grep'" 'Successful in surface data making'\`"
cat>$TestPath/$TestName/$CaseName/check_mksrf.submit<<EOF
#BSUB -J CheckMksrf
#BSUB -q normal
#BSUB -n 1
tailfilemksrf='`tail '$TestPath/$TestName/$CaseName/logmksrfdata'|grep'" 'Successful in surface data making'\`"
tailfileinit='`tail '$TestPath/$TestName/$CaseName/logini'|grep'" 'CoLM Initialization Execution Completed'\`"
tailfilecase='`tail '$TestPath/$TestName/$CaseName/log'|grep'" 'CoLM Execution Completed'\`"
cat>$TestPath/$TestName/$CaseName/check_all.submit<<EOF
#!/bin/bash
$Partition
Success=$tailfile
Success=$tailfilemksrf
if [ -z $Success ];then
sed -i "s/Submit_Mksrfdata PEND/Submit_Mksrfdata FAIL/g" TestStatus
sed -i "s/Submit_Mksrfdata PASS/Submit_Mksrfdata FAIL/g" TestStatus
echo FAIL comilation.
else
sed -i "s/Submit_Mksrfdata FAIL/Submit_Mksrfdata PASS/g" TestStatus
sed -i "s/Submit_Mksrfdata PEND/Submit_Mksrfdata PASS/g" TestStatus
echo PASS comilation.
fi
EOF
tailfile='`tail '$TestPath/$TestName/$CaseName/logini'|grep'" 'CoLM Initialization Execution Completed'\`"
cat>$TestPath/$TestName/$CaseName/check_init.submit<<EOF
#BSUB -J CheckInit
#BSUB -q normal
#BSUB -n 1
Success=$tailfile
Success=$tailfileinit
if [ -z $Success ];then
sed -i "s/Submit_Mkinidata PEND/Submit_Mkinidata FAIL/g" TestStatus
sed -i "s/Submit_Mkinidata PASS/Submit_Mkinidata FAIL/g" TestStatus
echo FAIL comilation.
else
sed -i "s/Submit_Mkinidata FAIL/Submit_Mkinidata PASS/g" TestStatus
sed -i "s/Submit_Mkinidata PEND/Submit_Mkinidata PASS/g" TestStatus
echo PASS comilation.
fi
EOF
tailfile='`tail '$TestPath/$TestName/$CaseName/log'|grep'" 'CoLM Execution Completed'\`"
cat>$TestPath/$TestName/$CaseName/check_case.submit<<EOF
#BSUB -J CheckCase
#BSUB -q normal
#BSUB -n 1
Success=$tailfile
Success=$tailfilecase
if [ -z $Success ];then
sed -i "s/Submit_Case PEND/Submit_Case FAIL/g" TestStatus
sed -i "s/Submit_Case PASS/Submit_Case FAIL/g" TestStatus
echo FAIL comilation.
else
sed -i "s/Submit_Case FAIL/Submit_Case PASS/g" TestStatus
sed -i "s/Submit_Case PEND/Submit_Case PASS/g" TestStatus
echo PASS comilation.
fi
EOF

Expand Down Expand Up @@ -370,10 +371,6 @@ EOF
echo "CreateCase FAIL">$TestPath/$TestName/$CaseName/TestStatus
echo "mksrf.submit is missing">>$TestPath/$TestName/$CaseName/Testlog
fi
if [ ! -f $TestPath/$TestName/$CaseName/init.submit ];then
echo "CreateCase FAIL">$TestPath/$TestName/$CaseName/TestStatus
echo "init.submit is missing">>$TestPath/$TestName/$CaseName/Testlog
fi
if [ ! -f $TestPath/$TestName/$CaseName/case.submit ];then
echo "CreateCase FAIL">$TestPath/$TestName/$CaseName/TestStatus
echo "case.submit is missing">>$TestPath/$TestName/$CaseName/Testlog
Expand Down Expand Up @@ -416,7 +413,7 @@ EOF
do
cd $TestPath/$TestName/$CaseName/
if [ -n "`grep Compile TestStatus|grep PASS`" ];then
submitall $JobSubmit $Mode
submitall $BatchSystem $Mode $Queue
if [ ! "$Mode" == "RunNoMkSrf" ];then
echo "Submit_Mksrfdata PEND">>$TestPath/$TestName/$CaseName/TestStatus
fi
Expand Down Expand Up @@ -448,7 +445,7 @@ if [ -z "${TestName}" ]; then
Help
exit
else
if [ -z $TestCaseList ];then
if [ -z "${TestCaseList}" ];then
TestCaseList="TestLists"
fi
if [ -z $Mode ];then
Expand Down
2 changes: 1 addition & 1 deletion run/scripts/diffcasecode.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ROOT=/share/home/dq010/CoLM202X-pre-release/
ROOT=`awk '/ROOT/ {print $2}' machine.config`
if [ $# -eq 2 ];then
if [ "${1:0:1}" == '/' ];then
CASENAME1=`echo "${1##*/}"`
Expand Down
1 change: 1 addition & 0 deletions run/scripts/machine-baiduboat.config
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Walltime_case 24:00:00
Queue_case normal
Exe_command mpirun
Exe_opt -np
BatchSystem LSF !supported system: LSF; PBS; SLURM
ROOT /share/home/dq010//CoLM202X-pre-release/
RAWDATA /share/home/dq010/CoLM/data/rawdata/CROP-NITRIF/CLMrawdata_updating/
RUNTIME /share/home/dq010/CoLM/data/rawdata/CROP-NITRIF/CoLMruntime//
Expand Down
2 changes: 1 addition & 1 deletion run/scripts/machine-github.config
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Walltime_case 24:00:00
Queue_case normal
Exe_command mpirun
Exe_opt -np
JobSubmit bsub<
BatchSystem LSF !supported system: LSF; PBS; SLURM
ROOT /share/home/dq010//CoLM202X-pre-release/
RAWDATA /share/home/dq010/CoLM/data/rawdata/CROP-NITRIF/CLMrawdata_updating/
RUNTIME /share/home/dq010/CoLM/data/rawdata/CROP-NITRIF/CoLMruntime//
Expand Down
1 change: 1 addition & 0 deletions run/scripts/machine-tianhexy.config
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Walltime_case 24:00:00
Queue_case mars
Exe_command yhrun
Exe_opt -n
BatchSystem SLURM
ROOT /XYFS01/HDD_POOL/sysu_yjdai2/sysu_yjdai2xy_5/CoLM2024-pre-release/
RAWDATA /XYFS01/HDD_POOL/sysu_yjdai2/SHARE01/CoLMdata/CoLMrawdata/
RUNTIME /XYFS01/HDD_POOL/sysu_yjdai2/SHARE01/CoLMdata/CoLMruntime/
Expand Down
6 changes: 0 additions & 6 deletions run/scripts/wait.bash
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#!/bin/bash

#BSUB -J Wait
#BSUB -q normal
#BSUB -n 1
#BSUB -R rusage[mem=1G]
#BSUB -R span[ptile=1]

echo hello wait for 1 seconds
sleep 1

Expand Down

0 comments on commit 5461a3c

Please sign in to comment.