/[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.15 - (hide annotations) (download)
Wed Dec 23 15:48:53 2020 UTC (4 years, 6 months ago) by jmc
Branch: MAIN
Changes since 1.14: +3 -2 lines
break one "#SBATCH" instruction line to put "--constraint=centos6" on it's own line

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

  ViewVC Help
Powered by ViewVC 1.1.22