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

Annotation of /MITgcm_contrib/test_scripts/ollie/mitgcmtestreport_gfortran

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


Revision 1.1 - (hide annotations) (download)
Wed Jun 10 13:58:05 2020 UTC (5 years, 1 month ago) by mlosch
Branch: MAIN
CVS Tags: HEAD
update testreport scripts for ollie, add one for gfortran, add do_tst_2+2
script

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

  ViewVC Help
Powered by ViewVC 1.1.22