/[MITgcm]/MITgcm_contrib/test_scripts/ollie/mitgcmtestreport_cray
ViewVC logotype

Contents of /MITgcm_contrib/test_scripts/ollie/mitgcmtestreport_cray

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


Revision 1.10 - (show annotations) (download)
Wed Jun 10 13:58:05 2020 UTC (5 years, 1 month ago) by mlosch
Branch: MAIN
Changes since 1.9: +25 -17 lines
update testreport scripts for ollie, add one for gfortran, add do_tst_2+2
script

1 #!/bin/bash -e
2 # new script for running testreport on ollie.awi.de
3 # - compile and run on compute nodes
4 # - use ssh to call mpack command from the head node ollie0
5 #$Header: /u/gcmpack/MITgcm_contrib/test_scripts/ollie/mitgcmtestreport_cray,v 1.9 2018/04/16 08:35:39 mlosch Exp $
6 #$Name: $
7
8 # needed for cron-job
9 #source /usr/Modules/current/init/bash
10 source /etc/profile.d/cray_pe.sh
11 # this seems to be enough to make the module cmd work
12 source /etc/profile.d/modules.sh
13 #
14 module purge
15 module load PrgEnv-cray
16 module load netcdf
17 # set the netcdf root directory here, because the definitions always
18 # change with different "default" netcdf modules
19 export NETCDF_ROOT=`nc-config --prefix`
20 # not sure why I have to set these paths here again
21 export MPI_ROOT=$(dirname $(dirname `which mpicc`))
22 # $(dirname `echo $LD_LIBRARY_PATH | awk -F: '{print $1}'`)
23 export MPI_INC_DIR=${MPI_ROOT}/include
24
25 # there is no slurm module anymore and this is the current recommendation to
26 # have sbatch in your path (rather than running /etc/profile.d./slurm.sh)
27 export PATH=${PATH}:/global/opt/slurm/default/bin
28
29 dNam='ollie'
30 TST_DIR="/work/ollie/mlosch/test_$dNam"
31 echo "start from TST_DIR='$TST_DIR' at: "`date`
32
33 umask 0022
34
35 sfx='cray'
36 RUNIT="runit_"$sfx
37
38 OPTFILE=../tools/build_options/linux_ia64_${sfx}_ollie
39 options="-MPI 6"
40 options="$options -odir ${dNam}-c"
41 options="$options -j 6"
42 #options="$options -t global_ocean.cs32x15"
43
44 #EXE='srun --mpi=pmi2 -n TR_NPROC ./mitgcmuv'
45 #EXE='srun -n TR_NPROC ./mitgcmuv'
46 EXE='srun -n TR_NPROC --cpu_bind=cores ./mitgcmuv'
47
48 if [ -e $TST_DIR ]; then
49 echo "$TST_DIR exists"
50 else
51 mkdir $TST_DIR
52 fi
53 cd $TST_DIR
54 HERE=$TST_DIR/output
55 if [ -e $HERE ]; then
56 echo "$HERE"
57 else
58 mkdir $HERE
59 fi
60 OUTFILE=$HERE/slurm_${sfx}.out
61 MYOUTPUT=$HERE/out_$sfx
62 if [ -e $MYOUTPUT ]; then
63 rm -rf $MYOUTPUT
64 fi
65 if [ -e $OUTFILE ]; then
66 rm -r $OUTFILE
67 fi
68 gcmDIR="MITgcm_${sfx}"
69 git_repo='MITgcm'
70 git_code='MITgcm'
71
72 # checkOut determines how much checking out is being done
73 # checkOut = 3: new clone from GitHub and make a new copy
74 # checkOut = 2: update (git pull) existing repo and make a new copy
75 # checkOut = 1: skip update
76 # checkOut = 0: use existing test code (if available otherwise switch to 1)
77
78 checkOut=2
79 tdir=${TST_DIR}
80 today=`date +%Y%m%d`
81 TODAY=`date +%d`
82 #tmpFil="/tmp/"`basename $0`".$$"
83 tmpFil=$TST_DIR/error.out
84
85 if [ $checkOut -le 1 ] ; then
86 if test -e $TST_DIR/${gcmDIR}/doc ; then
87 echo $TST_DIR/${gcmDIR}/doc 'exist'
88 else
89 echo -n "$TST_DIR/${gcmDIR} missing ; "
90 checkOut=2
91 echo "will make a new copy ( checkOut=$checkOut )"
92 fi
93 fi
94
95 if [ $checkOut -ge 2 ] ; then
96 #---- cleaning:
97 cd $TST_DIR
98
99 #---- Make a new clone or update existing one:
100 if test -e ${gcmDIR}/.git/config ; then
101 echo "${gcmDIR}/.git/config exist"
102 else
103 echo -n "${gcmDIR}/.git/config missing ; "
104 checkOut=3
105 echo "will get new clone ( checkOut=$checkOut )"
106 fi
107 if [ $checkOut -eq 3 ] ; then
108 echo -n "Removing old clone: $TST_DIR/${gcmDIR} ..."
109 test -e $TST_DIR/${gcmDIR} && rm -rf $TST_DIR/${gcmDIR}
110 echo " done"
111 echo -n "Make a new clone of $git_code from repo: $git_repo ..."
112 git clone https://github.com/$git_repo/${git_code}.git ${gcmDIR} 2> $tmpFil
113 retVal=$?
114 if test $retVal = 0 ; then
115 echo ' --> done!'
116 rm -f $tmpFil
117 else
118 echo " Error: 'git clone' returned: $retVal"
119 cat $tmpFil
120 rm -f $tmpFil
121 exit 2
122 fi
123 else
124 # echo "clean tst_2+2 + testreport output"
125 ( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean )
126 ( cd $gcmDIR/verification ; ./testreport -clean )
127 echo "Updating current clone ( $git_code ) ..."
128 ( cd ${gcmDIR}; git checkout master ; git pull ; git ls-files -d | xargs git checkout -- )
129 echo ' --> done!'
130 fi
131 else
132 cd $TST_DIR
133 fi
134
135 cd ${TST_DIR}/${gcmDIR}/verification
136
137 cwd=\`pwd\`
138 SENDCMD="ssh ollie0 ${TST_DIR}/${gcmDIR}/tools/mpack-1.6/mpack"
139 runtestreport="./testreport $options -of $OPTFILE -command \"${EXE}\" -send \"${SENDCMD}\" -sd ${cwd}"
140 emailaddress="-a jm_c@mitgcm.org"
141 testrestart="../tools/do_tst_2+2 -mpi -exe \"${EXE}\" -o ${dNam}-c -send \"${SENDCMD}\" -sd ${cwd}"
142
143 if [ ! -e $MYOUTPUT ]
144 then
145 touch $MYOUTPUT
146 fi
147
148 # echo "running testreport like this:"
149 # echo ${runtestreport} -norun
150 # eval "${runtestreport} -norun >> $MYOUTPUT 2>&1"
151
152 # create batch script
153 #
154 JOBNAME=tst$sfx
155 echo "creating batch script $HERE/$RUNIT"
156 cat << EOF >| $HERE/$RUNIT
157 #!/bin/bash
158 #SBATCH --job-name=${JOBNAME}
159 #SBATCH -o ${OUTFILE}
160 #SBATCH --time=12:00:00
161 #SBATCH --ntasks=6
162
163 # still need this to be able to run a few experiments:
164 # cfc_example, fizhi, tutorial_deep_convection
165 ulimit -s unlimited
166
167 # binds OpenMP task to given cores
168 export OMP_PROC_BIND=TRUE
169
170 # for debugging
171 # export FLEXLM_DIAGNOSTICS=2
172 # export FNP_IP_ENV=1
173 # export LM_A_CONN_TIMEOUT=99
174
175 cd \${SLURM_SUBMIT_DIR}
176
177 cwd=`pwd`
178 echo "running testreport like this in \${cwd}:"
179 echo "${runtestreport} -devel -match 10"
180 ${runtestreport} -devel -match 10 ${emailaddress} >> $MYOUTPUT 2>&1
181
182 echo "running testreport like this in \${cwd}:"
183 echo "./testreport -clean"
184 ./testreport -clean
185
186 # Hack,hack,hack to avoid running dome:
187 rm -f dome/results/output.txt
188 echo "running testreport like this in \${cwd}:"
189 echo "${runtestreport} -fast -match 10"
190 ${runtestreport} -fast -match 10 ${emailaddress} >> $MYOUTPUT 2>&1
191
192 echo "running restart test like this in \${cwd}:"
193 echo "${testrestart}"
194 ${testrestart} ${emailaddress} >> $MYOUTPUT 2>&1
195
196 EOF
197
198 chmod a+x $HERE/$RUNIT
199
200 echo " " >> $MYOUTPUT
201 echo "***********************************************************" >> $MYOUTPUT
202 echo "Submitting this job script:" >> $MYOUTPUT
203 echo "***********************************************************" >> $MYOUTPUT
204 cat $HERE/$RUNIT >> $MYOUTPUT
205 echo "***********************************************************" >> $MYOUTPUT
206 echo "end of job script" >> $MYOUTPUT
207 echo "***********************************************************" >> $MYOUTPUT
208 echo " " >> $MYOUTPUT
209
210 echo "sbatch $HERE/$RUNIT"
211 sbatch $HERE/$RUNIT
212
213 # # keep looking for the job in the job queues and wait until it has disappeared
214 # jobruns=somedummy
215 # while [ "${jobruns}"x != x ]
216 # do
217 # sleep 200
218 # jobruns=`squeue --noheader -u mlosch | grep "$JOBNAME" | awk '{print $1}'`
219 # echo "waiting for job ${jobruns%% *} ($JOBNAME) to complete"
220 # currentexp=`grep Experiment $MYOUTPUT | tail -1`
221 # echo "currently running $currentexp"
222 # done
223
224 # # workaround for mailing the stuff
225 # echo "mail the stuff"
226
227 # MPACKCMD=../tools/mpack-1.6/mpack
228 # fn=`ls -dtr tr_$dNam* | grep -v tar.gz | tail -1`
229 # echo "fname ${fn}"
230 # tar cf - $fn | gzip > "${fn}.tar.gz"
231 # $MPACKCMD -s MITgcm-test -m 3555000 ${fn}.tar.gz jm_c@mitgcm.org
232 # sleep 2
233 # rm -rf "${fn}.tar.gz"
234
235 echo "end of mitgcmtestreport"

  ViewVC Help
Powered by ViewVC 1.1.22