/[MITgcm]/MITgcm_contrib/test_scripts/svante/test_svante_ifc_adm
ViewVC logotype

Annotation of /MITgcm_contrib/test_scripts/svante/test_svante_ifc_adm

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (hide annotations) (download)
Fri Mar 12 15:07:18 2021 UTC (4 years, 4 months ago) by jmc
Branch: MAIN
Changes since 1.2: +6 -4 lines
Test RS=real*4 (-ur4) once every 3 day

1 jmc 1.1 #!/bin/bash
2     #SBATCH -J ifcAdm_tst
3     #SBATCH -p fdr
4     #SBATCH -t 23:30:00
5     #SBATCH --mem-per-cpu 4000
6     #SBATCH -N 1
7     #SBATCH --tasks-per-node 6
8     #SBATCH -x curly,larry,moe,shemp
9     #SBATCH -e /home/jm_c/test_svante/output/ifcAdm_tst.stderr
10     #SBATCH -o /home/jm_c/test_svante/output/ifcAdm_tst.stdout
11     #SBATCH --no-requeue
12    
13 jmc 1.3 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/svante/test_svante_ifc_adm,v 1.2 2020/09/21 20:34:31 jmc Exp $
14 jmc 1.1 # $Name: $
15    
16     if test -f /etc/profile.d/modules.sh ; then . /etc/profile.d/modules.sh ; fi
17     if test -f /etc/profile.d/zz_modules.sh ; then . /etc/profile.d/zz_modules.sh ; fi
18     # Note: added "ulimit -s unlimited" in file "~/.bashrc"
19     # to pass big test (the 2 fizhi-cs-* test & adjoint tests) with MPI
20    
21     umask 0022
22     #- to get case insensitive "ls" (and order of tested experiments)
23     export LC_ALL="en_US.UTF-8"
24     echo " running on: "`hostname`
25     headNode='svante-login'
26    
27     dNam='svante'
28     HERE="$HOME/test_${dNam}"
29     OUTP="$HERE/output"; SavD="$HERE/send"
30     SEND="ssh $headNode $SavD/mpack"
31     #TST_DISK="/net/fs09/d1/jm_c"
32     TST_DISK="/scratch/jm_c"
33 jmc 1.2 #TST_DIR="$TST_DISK/test_${dNam}"
34     TST_DIR="test_${dNam}"
35 jmc 1.1 #- where local copy of code is (need to be consistent with "test_submit_svante"):
36     #srcDIR='.'
37     srcDIR=$HERE
38     srcCode="MITgcm_today"
39    
40     #- following lines are not used here:
41     cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q'
42     #- which GitHub repository to use and how to access it:
43     git_repo='MITgcm'; git_code='MITgcm' ; git_other='verification_other'
44     #git_repo='altMITgcm'; #git_code='MITgcm66h'
45     #--
46     git_repo="https://github.com/$git_repo"
47     #git_repo="git://github.com/$git_repo"
48     #git_repo="git@github.com:$git_repo"
49    
50     typ='' ; addExp='' ; skipExp=''
51     sfx='ifcAdm'; typ='-adm'
52     module add intel/2017.0.1
53     module add openmpi
54     #module add netcdf
55     OPTFILE="../tools/build_options/linux_amd64_ifort11"
56     export GENERIC='on' # <-- to prevent the use of "-xHost" option
57     #- needed for DIVA with MPI:
58     export MPI_INC_DIR=$INC_MPI
59     options="$typ -ncad -MPI 6"
60 jmc 1.3 #options="-j 4 $options"
61 jmc 1.1 #- need this to get "staf":
62     export PATH="$PATH:$HOME/bin"
63    
64     gcmDIR="MITgcm_$sfx"
65     dAlt=`date +%d` ; dAlt=`expr $dAlt % 3`
66 jmc 1.3 if [ $dAlt -eq 2 ] ; then options="$options -ur4" ; fi
67 jmc 1.1 if [ $dAlt -eq 1 ] ; then options="$options -fast"
68     else options="$options -devel" ; fi
69    
70     checkOut=2 ; #options="$options -do"
71     #options="$options -nc" ; checkOut=1
72     #options="$options -q" ; checkOut=0
73    
74 jmc 1.2 echo "cd $TST_DISK ; pwd (x1)"
75 jmc 1.1 cd $TST_DISK
76 jmc 1.2 pwd ; ls -l
77     if test ! -d $TST_DIR ; then sleep 5 ; pwd ; ls -l ; fi
78 jmc 1.1 if test ! -d $TST_DIR ; then
79     echo -n "Creating a working dir: $TST_DIR ..."
80     #/bin/rm -rf $TST_DIR
81     mkdir $TST_DIR
82     retVal=$?
83     if test "x$retVal" != x0 ; then
84 jmc 1.2 echo " FAIL"
85     echo "Error: unable to make dir: $TST_DIR (err=$retVal ) from $TST_DISK --> Exit"
86 jmc 1.1 exit 1
87 jmc 1.2 else echo " done"
88 jmc 1.1 fi
89     fi
90 jmc 1.2 echo "start from DIR='$TST_DISK/$TST_DIR' at: "`date`
91 jmc 1.1 cd $TST_DIR
92     pwd
93    
94     NSLOTS=$SLURM_NTASKS
95     THEDATE=`date`
96     echo '********************************************************************************'
97     echo 'Start job '$THEDATE
98     echo 'NSLOTS = '$NSLOTS
99     echo '======= NODELIST ==============================================================='
100     echo $SLURM_NODELIST
101     cat /etc/redhat-release
102     echo '======= env ===================================================================='
103     env | grep SLURM
104     echo '======= modules ================================================================'
105     module list 2>&1
106     echo '================================================================================'
107    
108     #- check for disk space: relative space (99%) or absolute (10.G):
109     dsp=`df -P . | tail -1 | awk '{print $5}' | sed 's/%$//'`
110     if [ $dsp -gt 99 ] ; then
111     #dsp=`df -P . | tail -1 | awk '{print $4}'`
112     #if [ $dsp -le 100000000 ] ; then
113     echo 'Not enough space on this disk => do not run testreport.'
114     df .
115     exit
116     fi
117    
118     if [ $checkOut -eq 1 ] ; then
119     echo "cleaning output from $gcmDIR/verification :"
120     #- remove previous output tar files and tar & remove previous output-dir
121     /bin/rm -f $gcmDIR/verification/??_${dNam}-${sfx}_????????_?.tar.gz
122     ( cd $gcmDIR/verification
123     listD=`ls -1 -d ??_${dNam}-${sfx}_????????_? 2> /dev/null`
124     for dd in $listD
125     do
126     if test -d $dd ; then
127     tar -cf ${dd}".tar" $dd > /dev/null 2>&1 && gzip ${dd}".tar" && /bin/rm -rf $dd
128     retVal=$?
129     if test "x$retVal" != x0 ; then
130     echo "ERROR in tar+gzip prev outp-dir: $dd"
131     echo " on '"`hostname`"' (return val=$retVal) but continue"
132     fi
133     fi
134     done )
135     echo "clean testreport output (+ Makefile_syntax files)"
136     # ( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean )
137     ( cd $gcmDIR/verification ; ./testreport $typ -clean )
138     ( cd $gcmDIR/verification ; rm -f */build/Makefile_syntax )
139     ( cd $gcmDIR/verification ; rm -f */build/port_rand.i */build/ptracers_set_iolabel.i )
140     if test "x$addExp" != x ; then
141     ( cd $gcmDIR/verification
142     listD=`ls -o | grep '^l' | awk '{print $8}' 2> /dev/null`
143     echo " + remove local links: $listD"
144     /bin/rm -f $listD
145     )
146     fi
147     echo "Update $git_code code in dir $gcmDIR :"
148     ( cd $gcmDIR ; git pull ) 2>&1
149     retVal=$?
150     if test "x$retVal" != x0 ; then
151     echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit"
152     exit
153     fi
154     echo " and checkout master:"
155     ( cd $gcmDIR ; git checkout master -- . ) 2>&1
156     if test "x$addExp" != x ; then
157     echo "Update $git_other code in dir $gcmDIR/$git_other :"
158     ( cd $gcmDIR/$git_other ; git pull ) 2>&1
159     retVal=$?
160     if test "x$retVal" != x0 ; then
161     echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit"
162     exit
163     fi
164     echo " and checkout master:"
165     ( cd $gcmDIR/$git_other ; git checkout master -- . ) 2>&1
166     fi
167     fi
168    
169     if [ $checkOut -eq 2 ] ; then
170     if test -e $gcmDIR ; then
171     echo -n "Removing working copy: $gcmDIR ..."
172     rm -rf $gcmDIR
173     echo " done"
174     fi
175     # make a local copy (instead of making a new clone):
176     today=`date +%Y%m%d`
177     nCount=0; updFile="${srcDIR}/updated_code"
178     updDate=0 ; test -f $updFile && updDate=`cat $updFile`
179     while [ $today -gt $updDate ] ; do
180     nCount=`expr $nCount + 1`
181     if [ $nCount -gt 40 ] ; then
182     echo " waiting too long (nCount=$nCount) for updated code"
183     echo " today=$today , updDate=$updDate "
184     ls -l $updFile
185     exit
186     fi
187     sleep 60
188     updDate=0 ; test -f $updFile && updDate=`cat $updFile`
189     done
190     ls -l $updFile
191     echo " waited nCount=$nCount for updated code ($updDate) to copy"
192     if test -d $srcDIR/$srcCode ; then
193     echo -n "Make local copy of dir '$srcDIR/$srcCode' to: $gcmDIR ..."
194     cp -pra $srcDIR/$srcCode $gcmDIR
195     echo " done"
196     else echo " dir: $srcDIR/$srcCode missing => exit" ; exit ; fi
197     fi
198    
199     #- change dir to $gcmDIR/verification dir:
200     if test -e $gcmDIR/verification ; then
201     if [ $checkOut -lt 2 ] ; then
202     echo " dir $gcmDIR/verification exist" ; fi
203     cd $gcmDIR/verification
204     for exp2add in $addExp ; do
205     test -r $exp2add && /bin/rm -rf $exp2add
206     if test -d ../$git_other/$exp2add ; then
207     echo " add $exp2add link from $git_other"
208     ln -s ../$git_other/$exp2add .
209     if test $exp2add = 'global_oce_cs32' ; then
210     echo " link dir 'other_input/core2_cnyf' in here"
211     ( cd ../${git_other}/${exp2add}
212     test -L core2_cnyf && /bin/rm -f core2_cnyf
213     ln -s ../../../other_input/core2_cnyf . )
214     fi
215     if test $exp2add = 'global_oce_llc90' ; then
216     echo " link dir 'other_input/gael_oce_llc90_input' to 'input_fields'"
217     ( cd ../${git_other}/${exp2add}
218     test -L input_fields && /bin/rm -f input_fields
219     ln -s ../../../other_input/gael_oce_llc90_input input_fields
220     echo " link dirs: 'core2_cnyf' & 'global_oce_input_fields/*' in input_verifs"
221     test ! -e input_verifs && mkdir input_verifs
222     ( cd input_verifs ; /bin/rm -f *
223     ln -s ../../../../other_input/core2_cnyf .
224     ln -s ../../../../other_input/global_oce_input_fields/* . )
225     )
226     fi
227     else
228     echo " missing dir: $git_other/$exp2add"
229     continue
230     fi
231     done
232     else
233     echo "no dir: $gcmDIR/verification => exit"
234     exit
235     fi
236    
237     if [ $checkOut -ge 1 ] ; then
238     if [ $dAlt -eq 1 ] ; then
239     echo ''
240 jmc 1.3 #- 1) just compile ("-nr"), using "-j 4" to speed up
241 jmc 1.1 echo ./testreport $options -of $OPTFILE -skd \'$skipExp\' \
242     -j 4 -nr -odir ${dNam}-$sfx
243     ./testreport $options -of $OPTFILE -skd "$skipExp" \
244     -j 4 -nr -odir ${dNam}-$sfx
245     nFc=`grep -c '^Y . N N ' tr_out.txt`
246     echo " <= fail to compile $nFc experiments"
247     else
248     echo ''
249     #- 0) just make all module header ( *__genmod.mod files) using modified Makefile
250     echo ./testreport $options -of $OPTFILE -skd \'$skipExp\' \
251     -j 4 -repl_mk do_make_syntax.sh -obj -dd
252     ./testreport $options -of $OPTFILE -skd "$skipExp" \
253     -j 4 -repl_mk do_make_syntax.sh -obj -dd 2>&1
254     echo ''
255 jmc 1.3 #- 1) just compile ("-nr"), using "-j 4" to speed up
256 jmc 1.1 echo ./testreport $options -of $OPTFILE -skd \'$skipExp\' \
257     -j 4 -nr -q -odir ${dNam}-$sfx
258     ./testreport $options -of $OPTFILE -skd "$skipExp" \
259     -j 4 -nr -q -odir ${dNam}-$sfx
260     nFc=`grep -c '^Y . N N ' tr_out.txt`
261     echo " <= fail to compile $nFc experiments"
262     fi
263     fi
264    
265 jmc 1.3 if [ $dAlt -eq 2 ] ; then options="$options -match 5" ; fi
266 jmc 1.1 echo ''
267     #- 2) run and report results ; also finish to compile those who failed with "-j"
268     echo ./testreport $options -of $OPTFILE -skd \'$skipExp\' \
269     -q -odir ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org
270     ./testreport $options -of $OPTFILE -skd "$skipExp" \
271     -q -odir ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org
272     # echo ''
273     # #- 3) test restart and report results
274     # echo ../tools/do_tst_2+2 -mpi \
275     # -o ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org
276     # ../tools/do_tst_2+2 -mpi \
277     # -o ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org
278    

  ViewVC Help
Powered by ViewVC 1.1.22