/[MITgcm]/MITgcm_contrib/test_scripts/engaging/test_engag_ifc_mpi
ViewVC logotype

Annotation of /MITgcm_contrib/test_scripts/engaging/test_engag_ifc_mpi

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


Revision 1.24 - (hide annotations) (download)
Mon Nov 6 14:23:01 2023 UTC (20 months, 1 week ago) by jmc
Branch: MAIN
Changes since 1.23: +4 -1 lines
easier for running only restart test

1 jmc 1.1 #!/bin/bash
2 jmc 1.9 #SBATCH -J ifcMpi_tst
3 jmc 1.1 #SBATCH -p sched_mit_hill
4 jmc 1.21 #SBATCH -t 10:00:00
5 jmc 1.1 #SBATCH --mem-per-cpu 4000
6     #SBATCH -N 2
7     #SBATCH --tasks-per-node 4
8 jmc 1.23 # #SBATCH -x node122
9     # #SBATCH -x node[051,052,065,066]
10 jmc 1.9 #SBATCH -e /home/jm_c/test_engaging/output/ifcMpi_tst.stderr
11     #SBATCH -o /home/jm_c/test_engaging/output/ifcMpi_tst.stdout
12 jmc 1.15 #SBATCH --no-requeue
13 jmc 1.1
14 jmc 1.24 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/engaging/test_engag_ifc_mpi,v 1.23 2023/10/19 14:43:00 jmc Exp $
15 jmc 1.1 # $Name: $
16    
17 jmc 1.22 if test -f /etc/profile.d/modules.sh ; then . /etc/profile.d/modules.sh ; fi
18 jmc 1.1 # 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 jmc 1.22 headNode='eofe8'
26 jmc 1.1
27     dNam='engaging'
28 jmc 1.22 HERE="$HOME/test_${dNam}"
29 jmc 1.1 OUTP="$HERE/output"; SavD="$HERE/send"
30 jmc 1.22 SEND="ssh $headNode $SavD/mpack"
31 jmc 1.1 TST_DIR="/pool001/jm_c/test_$dNam"
32 jmc 1.7 tmpFil="/tmp/"`basename $0`".$$"
33     cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q'
34 jmc 1.9 #- which GitHub repository to use and how to access it:
35 jmc 1.10 git_repo='MITgcm'; git_code='MITgcm' ; git_other='verification_other'
36 jmc 1.7 #git_repo='altMITgcm'; #git_code='MITgcm66h'
37 jmc 1.9 #--
38     git_repo="https://github.com/$git_repo"
39     #git_repo="git://github.com/$git_repo"
40     #git_repo="git@github.com:$git_repo"
41 jmc 1.1
42 jmc 1.18 dblTr=0 ; typ='' ; addExp='' ; skipExp=''
43     sfx='ifcMpi'; dblTr=1
44 jmc 1.1 addExp='global_oce_cs32 global_oce_llc90'
45     module add slurm
46     module add gcc
47     module add engaging/intel/2013.1.046
48     #export MPI_INC_DIR="$MPI_HOME/include"
49     OPTFILE="../tools/build_options/linux_amd64_ifort+impi"
50     mpiCMD="mpirun -env I_MPI_DEBUG 2 -n TR_NPROC ./mitgcmuv" #- currently not used
51 jmc 1.4 options="$typ -MPI 8"
52 jmc 1.5 #options="-j 4 $options"
53 jmc 1.1 #export OMP_NUM_THREADS=2
54     #export KMP_SLAVE_STACK_SIZE=400m
55     #options="$options -gsl"
56     #export GSL_IEEE_MODE=double-precision,mask-underflow,mask-denormalized
57     ulimit -s unlimited
58     #- need this to get "staf" & "do_make_syntax.sh":
59     export PATH="$PATH:$HOME/bin"
60    
61 jmc 1.7 gcmDIR="MITgcm_$sfx"
62 jmc 1.1 dAlt=`date +%d` ; dAlt=`expr $dAlt % 3`
63     if [ $dAlt -eq 1 ] ; then options="$options -ur4 -match 5" ; fi
64     options="$options -devel"
65 jmc 1.22 if test "x$skipExp" != x ; then skipExp=`echo $skipExp | sed 's/^ *//'` ; fi
66 jmc 1.1
67     checkOut=1 ; #options="$options -do"
68 jmc 1.18 #options="$options -nc" ; checkOut=1 ; dblTr=0
69     #options="$options -q" ; checkOut=0 ; dblTr=0
70 jmc 1.24 # dblTr=-1 #- skip testreport completely (only run "do_tst_2+2")
71 jmc 1.1
72 jmc 1.7 if test -d $TST_DIR ; then
73     echo "start from TST_DIR='$TST_DIR' at: "`date`
74     else
75     #if test ! -d $TST_DIR ; then mkdir $TST_DIR ; fi
76     #if test ! -d $TST_DIR ; then
77     # echo "ERROR: Can't create directory \"$TST_DIR\""
78     # exit 1
79     #fi
80     #echo "start in new dir TST_DIR='$TST_DIR' at: "`date`
81     echo "ERROR: missing directory \"$TST_DIR\""
82     exit 1
83     fi
84     cd $TST_DIR
85     pwd
86 jmc 1.16 df .
87 jmc 1.7
88 jmc 1.1 NSLOTS=$SLURM_NTASKS
89     THEDATE=`date`
90     echo '********************************************************************************'
91     echo 'Start job '$THEDATE
92     echo 'NSLOTS = '$NSLOTS
93     echo '======= NODELIST ==============================================================='
94     echo $SLURM_NODELIST
95     cat /etc/redhat-release
96     echo '======= env ===================================================================='
97     env | grep SLURM
98     echo '======= modules ================================================================'
99     module list 2>&1
100     echo '================================================================================'
101    
102     #-
103     MPI_MFile="${OUTP}/mf_${sfx}" #- currently not used
104     #mpiCMD="mpirun -hostfile TR_MFILE -n TR_NPROC ./mitgcmuv"
105     #- make the testreport MPI_MFILE:
106     listNODES=`echo $SLURM_NODELIST | sed -e 's/\[/ /' -e 's/\]//' -e 's/,/ /' -e 's/-/ /'`
107     # duplicate the 2 listed nodes into a 6 list file:
108     /bin/rm -f $MPI_MFile ; touch $MPI_MFile
109     for nc in `seq 1 4` ; do pfx=''
110     for nd in $listNODES ; do
111     if test "x$pfx" = x ; then pfx=$nd ; else
112     echo "${pfx}${nd}" >> $MPI_MFile
113     fi
114     done
115     done
116    
117     #- check for disk space: relative space (99%) or absolute (10.G):
118     dsp=`df -P . | tail -1 | awk '{print $5}' | sed 's/%$//'`
119     if [ $dsp -gt 99 ] ; then
120     #dsp=`df -P . | tail -1 | awk '{print $4}'`
121     #if [ $dsp -le 100000000 ] ; then
122     echo 'Not enough space on this disk => do not run testreport.'
123     df .
124     exit
125     fi
126 jmc 1.10
127     if [ $checkOut -eq 1 ] ; then
128     if test ! -e $gcmDIR/.git/config ; then
129     echo "no file: $gcmDIR/.git/config => try to download a fresh clone"
130     checkOut=2
131     fi
132     if test "x$addExp" != x ; then
133     if test ! -e $gcmDIR/$git_other/.git/config ; then
134     echo "no file: $gcmDIR/$git_other/.git/config => try a fresh clone"
135     checkOut=2
136     fi
137     fi
138     fi
139 jmc 1.1 if [ $checkOut -eq 1 ] ; then
140     echo "cleaning output from $gcmDIR/verification :"
141     #- remove previous output tar files and tar & remove previous output-dir
142     /bin/rm -f $gcmDIR/verification/??_${dNam}-${sfx}_????????_?.tar.gz
143     ( cd $gcmDIR/verification
144     listD=`ls -1 -d ??_${dNam}-${sfx}_????????_? 2> /dev/null`
145     for dd in $listD
146     do
147     if test -d $dd ; then
148     tar -cf ${dd}".tar" $dd > /dev/null 2>&1 && gzip ${dd}".tar" && /bin/rm -rf $dd
149 jmc 1.7 retVal=$?
150     if test "x$retVal" != x0 ; then
151 jmc 1.1 echo "ERROR in tar+gzip prev outp-dir: $dd"
152 jmc 1.7 echo " on '"`hostname`"' (return val=$retVal) but continue"
153 jmc 1.1 fi
154     fi
155     done )
156     echo "clean tst_2+2 + testreport output (+ Makefile_syntax files)"
157     ( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean )
158     ( cd $gcmDIR/verification ; ./testreport $typ -clean )
159     ( cd $gcmDIR/verification ; rm -f */build/Makefile_syntax )
160     ( cd $gcmDIR/verification ; rm -f */build/port_rand.i */build/ptracers_set_iolabel.i )
161 jmc 1.22 if test "x$addExp" != x ; then
162     ( cd $gcmDIR/verification
163     listD=`ls -o | grep '^l' | awk '{print $8}' 2> /dev/null`
164     echo " + remove local links: $listD"
165     /bin/rm -f $listD
166     )
167     fi
168 jmc 1.10 echo "Update $git_code code in dir $gcmDIR :"
169 jmc 1.12 ( cd $gcmDIR ; git pull ) 2>&1
170 jmc 1.7 retVal=$?
171     if test "x$retVal" != x0 ; then
172     echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit"
173 jmc 1.1 exit
174     fi
175 jmc 1.12 echo " and checkout master:"
176     ( cd $gcmDIR ; git checkout master -- . ) 2>&1
177 jmc 1.10 if test "x$addExp" != x ; then
178     echo "Update $git_other code in dir $gcmDIR/$git_other :"
179 jmc 1.12 ( cd $gcmDIR/$git_other ; git pull ) 2>&1
180 jmc 1.10 retVal=$?
181     if test "x$retVal" != x0 ; then
182     echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit"
183     exit
184     fi
185 jmc 1.12 echo " and checkout master:"
186     ( cd $gcmDIR/$git_other ; git checkout master -- . ) 2>&1
187 jmc 1.1 fi
188     fi
189 jmc 1.10
190 jmc 1.1 if [ $checkOut -eq 2 ] ; then
191     if test -e $gcmDIR ; then
192     echo -n "Removing working copy: $gcmDIR ..."
193     rm -rf $gcmDIR
194     echo " done"
195     fi
196 jmc 1.10 echo "Make a clone of $git_code from repo: $git_repo ..."
197 jmc 1.9 git clone $git_repo/${git_code}.git $gcmDIR 2> $tmpFil
198 jmc 1.7 retVal=$?
199     if test $retVal = 0 ; then
200     echo ' done' ; rm -f $tmpFil
201     else
202     echo " Error: 'git clone' returned: $retVal"
203     cat $tmpFil ; rm -f $tmpFil
204 jmc 1.1 exit
205 jmc 1.7 fi
206 jmc 1.10 if test "x$addExp" != x ; then
207     echo "Make a clone of $git_other from repo: $git_repo ..."
208     ( cd $gcmDIR ; git clone $git_repo/${git_other}.git 2> $tmpFil )
209     retVal=$?
210     if test $retVal = 0 ; then
211     echo ' done' ; rm -f $tmpFil
212     else
213     echo " Error: 'git clone' returned: $retVal"
214     cat $tmpFil ; rm -f $tmpFil
215     exit
216     fi
217     fi
218 jmc 1.1 if test -d $gcmDIR/verification ; then
219     /usr/bin/find $gcmDIR -type d | xargs chmod g+rxs
220     /usr/bin/find $gcmDIR -type f | xargs chmod g+r
221     fi
222     fi
223    
224 jmc 1.14 #- change dir to $gcmDIR/verification + add link for additional experiments:
225 jmc 1.1 if test -e $gcmDIR/verification ; then
226     if [ $checkOut -lt 2 ] ; then
227     echo " dir $gcmDIR/verification exist" ; fi
228     cd $gcmDIR/verification
229     for exp2add in $addExp ; do
230 jmc 1.10 test -r $exp2add && /bin/rm -rf $exp2add
231     if test -d ../$git_other/$exp2add ; then
232     echo " add $exp2add link from $git_other"
233     ln -s ../$git_other/$exp2add .
234 jmc 1.1 if test $exp2add = 'global_oce_cs32' ; then
235 jmc 1.10 echo " link dir 'other_input/core2_cnyf' in here"
236 jmc 1.11 ( cd ../${git_other}/${exp2add}
237     test -L core2_cnyf && /bin/rm -f core2_cnyf
238     ln -s ../../../other_input/core2_cnyf . )
239 jmc 1.1 fi
240     if test $exp2add = 'global_oce_llc90' ; then
241 jmc 1.10 echo " link dir 'other_input/gael_oce_llc90_input' to 'input_fields'"
242     ( cd ../${git_other}/${exp2add}
243 jmc 1.11 test -L input_fields && /bin/rm -f input_fields
244 jmc 1.10 ln -s ../../../other_input/gael_oce_llc90_input input_fields
245     echo " link dirs: 'core2_cnyf' & 'global_oce_input_fields/*' in input_verifs"
246 jmc 1.12 test ! -e input_verifs && mkdir input_verifs
247     ( cd input_verifs ; /bin/rm -f *
248 jmc 1.10 ln -s ../../../../other_input/core2_cnyf .
249     ln -s ../../../../other_input/global_oce_input_fields/* . )
250     )
251 jmc 1.1 fi
252 jmc 1.10 else
253     echo " missing dir: $git_other/$exp2add"
254     continue
255 jmc 1.1 fi
256     done
257     else
258     echo "no dir: $gcmDIR/verification => exit"
259     exit
260     fi
261    
262 jmc 1.18 if [ $dblTr -eq 1 ] ; then
263 jmc 1.1 echo ''
264 jmc 1.5 #- 0) just make all module header ( *__genmod.mod files) using modified Makefile
265 jmc 1.22 echo ./testreport $options -of $OPTFILE -skd \'$skipExp\' \
266 jmc 1.16 -j 4 -nc -repl_mk do_make_syntax.sh -obj -dd
267 jmc 1.22 ./testreport $options -of $OPTFILE -skd "$skipExp" \
268 jmc 1.16 -j 4 -nc -repl_mk do_make_syntax.sh -obj -dd
269 jmc 1.22 options="$options -q"
270 jmc 1.1
271     echo ''
272 jmc 1.5 #- 1) just compile ("-nr"), using "-j 4" to speed up
273 jmc 1.22 echo ./testreport $options -of $OPTFILE -skd \'$skipExp\' \
274     -j 4 -nr -odir ${dNam}-$sfx
275     ./testreport $options -of $OPTFILE -skd "$skipExp" \
276     -j 4 -nr -odir ${dNam}-$sfx
277 jmc 1.5 nFc=`grep -c '^Y . N N ' tr_out.txt`
278     echo " <= fail to compile $nFc experiments"
279 jmc 1.6 fi
280 jmc 1.5
281 jmc 1.24 if [ $dblTr -ge 0 ] ; then
282 jmc 1.5 echo ''
283     #- 2) run and report results ; also finish to compile those who failed with "-j"
284 jmc 1.2 #echo ./testreport $options -of $OPTFILE -command \'$mpiCMD\' -mf $MPI_MFile \
285 jmc 1.22 echo ./testreport $options -of $OPTFILE -skd \'$skipExp\' \
286 jmc 1.18 -odir ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org
287 jmc 1.2 #./testreport $options -of $OPTFILE -command "$mpiCMD" -mf $MPI_MFile \
288 jmc 1.22 ./testreport $options -of $OPTFILE -skd "$skipExp" \
289 jmc 1.18 -odir ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org
290 jmc 1.23 retVal=$?
291 jmc 1.24 else retVal=0 ; fi
292 jmc 1.1
293 jmc 1.23 if test "x$retVal" != x0 ; then
294     echo "<== testreport returned retVal=${retVal}, expecting 0"
295     echo " -> skip restart test 'do_tst_2+2'"
296     else
297 jmc 1.1 echo ''
298 jmc 1.5 #- 3) test restart and report results
299 jmc 1.2 #echo ../tools/do_tst_2+2 -mpi -exe \'$mpiCMD\' -mf $MPI_MFile \
300     echo ../tools/do_tst_2+2 -mpi \
301 jmc 1.6 -o ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org
302 jmc 1.2 #../tools/do_tst_2+2 -mpi -exe "$mpiCMD" -mf $MPI_MFile \
303     ../tools/do_tst_2+2 -mpi \
304 jmc 1.6 -o ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org
305 jmc 1.23 fi

  ViewVC Help
Powered by ViewVC 1.1.22