From 10bb5ea4f20b4633d2c41d72027b8ad9d1887b29 Mon Sep 17 00:00:00 2001 From: sysu_yjdai2xy_5 Date: Fri, 21 Feb 2025 00:27:36 +0800 Subject: [PATCH 1/6] test --- test | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test diff --git a/test b/test new file mode 100644 index 00000000..e69de29b From 27b8e1d3d508384a64d030d077dcd11be8957ac5 Mon Sep 17 00:00:00 2001 From: sysu_yjdai2xy_5 Date: Fri, 21 Feb 2025 00:33:18 +0800 Subject: [PATCH 2/6] configure file updates for create_test --- run/scripts/machine-baiduboat.config | 1 + run/scripts/machine-tianhexy.config | 1 + test | 0 3 files changed, 2 insertions(+) delete mode 100644 test diff --git a/run/scripts/machine-baiduboat.config b/run/scripts/machine-baiduboat.config index 81013aad..c95d3d46 100644 --- a/run/scripts/machine-baiduboat.config +++ b/run/scripts/machine-baiduboat.config @@ -18,6 +18,7 @@ Walltime_case 24:00:00 Queue_case normal Exe_command mpirun Exe_opt -np +JobSubmit bsub< 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// diff --git a/run/scripts/machine-tianhexy.config b/run/scripts/machine-tianhexy.config index b610e7e4..dcd72fe6 100644 --- a/run/scripts/machine-tianhexy.config +++ b/run/scripts/machine-tianhexy.config @@ -18,6 +18,7 @@ Walltime_case 24:00:00 Queue_case mars Exe_command yhrun Exe_opt -n +JobSubmit sbatch 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/ diff --git a/test b/test deleted file mode 100644 index e69de29b..00000000 From 3f68ab17910891675bbf3134da430705343c6c18 Mon Sep 17 00:00:00 2001 From: sysu_yjdai2xy_5 Date: Fri, 21 Feb 2025 18:27:56 +0800 Subject: [PATCH 3/6] create_test now compatible with tianhe --- run/scripts/create_test | 126 +++++++++++++-------------- run/scripts/diffcasecode.bash | 2 +- run/scripts/machine-baiduboat.config | 2 +- run/scripts/machine-github.config | 2 +- run/scripts/machine-tianhexy.config | 2 +- run/scripts/wait.bash | 6 -- 6 files changed, 65 insertions(+), 75 deletions(-) diff --git a/run/scripts/create_test b/run/scripts/create_test index 2015ea95..e93b6c0f 100755 --- a/run/scripts/create_test +++ b/run/scripts/create_test @@ -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}' -f1` - else - job1_id=`${JobSubmit: 0: -1}' -f1` - fi - job2_id=`${JobSubmit: 0: -1} -w "ended($job1_id)"' -f1` - job3_id=`${JobSubmit: 0: -1} -w "ended($job2_id)"' -f1` - if [ ! "$Mode" == "RunNoMkSrf" ];then - job4_id=`${JobSubmit: 0: -1} -w "ended($job1_id)"' -f1` - else - job1_id=`$JobSubmit mksrf.submit| awk '{print $2}' | cut -d'<' -f2 | cut -d'>' -f1` - fi - job2_id=`${JobSubmit} -w "ended($job1_id)"' -f1` - job3_id=`${JobSubmit} -w "ended($job2_id)"' -f1` - if [ ! "$Mode" == "RunNoMkSrf" ];then - job4_id=`${JobSubmit} -w "ended($job1_id)"$TestPath/$TestName/$CaseName/TestStatus + sed -i "/cd/a `grep yhrun $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<$TestPath/$TestName/$CaseName/check_all.submit<$TestPath/$TestName/$CaseName/check_init.submit<$TestPath/$TestName/$CaseName/check_case.submit<$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 @@ -416,7 +412,7 @@ EOF do cd $TestPath/$TestName/$CaseName/ if [ -n "`grep Compile TestStatus|grep PASS`" ];then - submitall $JobSubmit $Mode + submitall $BatchSystem $Mode if [ ! "$Mode" == "RunNoMkSrf" ];then echo "Submit_Mksrfdata PEND">>$TestPath/$TestName/$CaseName/TestStatus fi diff --git a/run/scripts/diffcasecode.bash b/run/scripts/diffcasecode.bash index 0166bb23..5c71c8c8 100755 --- a/run/scripts/diffcasecode.bash +++ b/run/scripts/diffcasecode.bash @@ -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##*/}"` diff --git a/run/scripts/machine-baiduboat.config b/run/scripts/machine-baiduboat.config index c95d3d46..b135d209 100644 --- a/run/scripts/machine-baiduboat.config +++ b/run/scripts/machine-baiduboat.config @@ -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// diff --git a/run/scripts/machine-github.config b/run/scripts/machine-github.config index c95d3d46..b135d209 100644 --- a/run/scripts/machine-github.config +++ b/run/scripts/machine-github.config @@ -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// diff --git a/run/scripts/machine-tianhexy.config b/run/scripts/machine-tianhexy.config index dcd72fe6..90f17dc7 100644 --- a/run/scripts/machine-tianhexy.config +++ b/run/scripts/machine-tianhexy.config @@ -18,7 +18,7 @@ Walltime_case 24:00:00 Queue_case mars Exe_command yhrun Exe_opt -n -JobSubmit sbatch +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/ diff --git a/run/scripts/wait.bash b/run/scripts/wait.bash index 26d86f67..c7b51267 100644 --- a/run/scripts/wait.bash +++ b/run/scripts/wait.bash @@ -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 From 1097865db7c8e13780e729dc8053b85dc892ec85 Mon Sep 17 00:00:00 2001 From: sysu_yjdai2xy_5 Date: Fri, 21 Feb 2025 19:27:45 +0800 Subject: [PATCH 4/6] add summarytest.bash --- run/scripts/SummaryTest.bash | 118 +++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100755 run/scripts/SummaryTest.bash diff --git a/run/scripts/SummaryTest.bash b/run/scripts/SummaryTest.bash new file mode 100755 index 00000000..8222724e --- /dev/null +++ b/run/scripts/SummaryTest.bash @@ -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 From c3ea9df07c343a6164e9a98e7a946fd84bc213a9 Mon Sep 17 00:00:00 2001 From: chrislxj Date: Fri, 21 Feb 2025 20:35:34 +0800 Subject: [PATCH 5/6] fix a bug in create_test --- run/scripts/create_test | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/run/scripts/create_test b/run/scripts/create_test index e93b6c0f..1d0b68f7 100755 --- a/run/scripts/create_test +++ b/run/scripts/create_test @@ -29,7 +29,7 @@ submitall() { BatchSystem=$1 Mode=$2 - Queue=`awk '/Queue_case/ {print $2}' machine.config + Queue=$3 # Dependency=`awk '/Dependency/ {print $2}' machine.config` # Dependency=`echo $Dependency|sed 's|JOBID|$jobid_1|g'` case $BatchSystem in @@ -40,7 +40,7 @@ submitall() else job1_id=`${JobSubmit}$TestPath/$TestName/$CaseName/TestStatus - sed -i "/cd/a `grep yhrun $TestPath/$TestName/$CaseName/init.submit`" $TestPath/$TestName/$CaseName/case.submit + 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 if [ "$Mode" == "CreateNoMkSrf" ];then @@ -412,7 +413,7 @@ EOF do cd $TestPath/$TestName/$CaseName/ if [ -n "`grep Compile TestStatus|grep PASS`" ];then - submitall $BatchSystem $Mode + submitall $BatchSystem $Mode $Queue if [ ! "$Mode" == "RunNoMkSrf" ];then echo "Submit_Mksrfdata PEND">>$TestPath/$TestName/$CaseName/TestStatus fi @@ -444,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 From b1c17a0c61e3a7778ddb9de22e727761e7843b9f Mon Sep 17 00:00:00 2001 From: sysu_yjdai2xy_5 Date: Sat, 22 Feb 2025 02:44:00 +0800 Subject: [PATCH 6/6] fix two bugs: 1) restart inconsistent in assimsun,assimsha,etrsun,etrsha,gssun,gssha, 2) create_test typo in Queue --- main/MOD_Thermal.F90 | 14 ++++++++++++++ run/scripts/create_test | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/main/MOD_Thermal.F90 b/main/MOD_Thermal.F90 index 3f72fca4..e211e5c2 100644 --- a/main/MOD_Thermal.F90 +++ b/main/MOD_Thermal.F90 @@ -705,6 +705,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 @@ -896,6 +902,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) ) diff --git a/run/scripts/create_test b/run/scripts/create_test index 1d0b68f7..f150ad1c 100755 --- a/run/scripts/create_test +++ b/run/scripts/create_test @@ -46,7 +46,7 @@ submitall() SLURM) JobSubmit="sbatch" if [ "$Mode" == "RunNoMkSrf" ];then - job1_id=`$JobSubmit -p $QUEUE wait.bash| grep -o '[0-9]*'` + job1_id=`$JobSubmit -p $Queue wait.bash| grep -o '[0-9]*'` else job1_id=`$JobSubmit mksrf.submit| grep -o '[0-9]*'` fi