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

Annotation of /MITgcm_contrib/test_scripts/svante/test_svante_ifc_mpi

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


Revision 1.18 - (hide annotations) (download)
Mon Apr 4 04:34:38 2022 UTC (3 years, 3 months ago) by jmc
Branch: MAIN
Changes since 1.17: +3 -3 lines
switch to newer Intel compiler (module: intel/2021.4.0)

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

  ViewVC Help
Powered by ViewVC 1.1.22