/[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.14 - (hide annotations) (download)
Mon Oct 21 23:27:16 2019 UTC (5 years, 8 months ago) by jmc
Branch: MAIN
Changes since 1.13: +2 -2 lines
update some comments

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

  ViewVC Help
Powered by ViewVC 1.1.22