/[MITgcm]/MITgcm_contrib/test_scripts/svante/test_svante_pgi_mth
ViewVC logotype

Annotation of /MITgcm_contrib/test_scripts/svante/test_svante_pgi_mth

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


Revision 1.9 - (hide annotations) (download)
Tue Apr 28 14:33:36 2020 UTC (5 years, 2 months ago) by jmc
Branch: MAIN
Changes since 1.8: +82 -44 lines
Cleaning: remove all CVS command and put git command and add bits for partial
update (checkOut=1) and additional exp (addExp), even though not currently used

1 jmc 1.1 #!/bin/bash
2     #SBATCH -J pgiMth_tst
3     #SBATCH -p fdr
4 jmc 1.4 #SBATCH -t 18:00:00
5 jmc 1.1 #SBATCH --mem-per-cpu 4000
6     #SBATCH -N 1
7     #SBATCH --tasks-per-node 3
8 jmc 1.8 #SBATCH -x curly,larry,moe,shemp
9 jmc 1.1 #SBATCH -e /home/jm_c/test_svante/output/pgiMth_tst.stderr
10     #SBATCH -o /home/jm_c/test_svante/output/pgiMth_tst.stdout
11     #SBATCH --no-requeue
12    
13 jmc 1.9 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/svante/test_svante_pgi_mth,v 1.8 2018/06/12 21:42:22 jmc Exp $
14 jmc 1.1 # $Name: $
15    
16     if test -f /etc/profile.d/modules.sh ; then . /etc/profile.d/modules.sh ; fi
17     if test -f /etc/profile.d/zz_modules.sh ; then . /etc/profile.d/zz_modules.sh ; 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     headNode='svante-login'
26    
27     dNam='svante'
28     HERE="$HOME/test_${dNam}"
29     OUTP="$HERE/output"; SavD="$HERE/send"
30     SEND="ssh $headNode $SavD/mpack"
31 jmc 1.7 #TST_DISK="/net/fs09/d1/jm_c"
32     TST_DISK="/scratch/jm_c"
33 jmc 1.1 TST_DIR="$TST_DISK/test_${dNam}"
34 jmc 1.6 #- where local copy of code is (need to be consistent with "test_submit_svante"):
35 jmc 1.7 #srcDIR='.'
36     srcDIR=$HERE
37 jmc 1.6 srcCode="MITgcm_today"
38    
39 jmc 1.9 #- following lines are not used here:
40     cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q'
41     #- which GitHub repository to use and how to access it:
42     git_repo='MITgcm'; git_code='MITgcm' ; git_other='verification_other'
43     #git_repo='altMITgcm'; #git_code='MITgcm66h'
44     #--
45     git_repo="https://github.com/$git_repo"
46     #git_repo="git://github.com/$git_repo"
47     #git_repo="git@github.com:$git_repo"
48 jmc 1.1
49 jmc 1.2 typ='' ; addExp='' ; skipExp=''
50     sfx='pgiMth'
51     skipExp='internal_wave tutorial_advection_in_gyre'
52 jmc 1.1 module add pgi/16.9
53     #module add openmpi
54     module add netcdf
55     OPTFILE="../tools/build_options/linux_amd64_pgf77"
56     #- needed for DIVA with MPI:
57     #export MPI_INC_DIR="/home/software/pgi/16.9/linux86-64/2016/mpi/openmpi-1.10.2/include"
58     options="$typ -mth"
59     export OMP_NUM_THREADS=2
60     export OMP_STACKSIZE=400m
61     #- need this to get "staf":
62     #export PATH="$PATH:$HOME/bin"
63    
64 jmc 1.9 gcmDIR="MITgcm_$sfx"
65 jmc 1.1 dAlt=`date +%d` ; dAlt=`expr $dAlt % 3`
66     if [ $dAlt -eq 1 ] ; then options="$options -fast"
67     else options="$options -devel" ; fi
68    
69     checkOut=2 ; #options="$options -do"
70     #options="$options -nc" ; checkOut=1
71     #options="$options -q" ; checkOut=0
72    
73 jmc 1.9 echo "cd $TST_DISK ; pwd (x2)"
74     cd $TST_DISK
75     pwd
76     if test ! -d $TST_DIR ; then
77     echo -n "Creating a working dir: $TST_DIR ..."
78     #/bin/rm -rf $TST_DIR
79     mkdir $TST_DIR
80     retVal=$?
81     if test "x$retVal" != x0 ; then
82     echo "Error: unable to make dir: $TST_DIR (err=$retVal ) --> Exit"
83     exit 1
84     fi
85     fi
86     echo "start from TST_DIR='$TST_DIR' at: "`date`
87     cd $TST_DIR
88     pwd
89    
90 jmc 1.1 NSLOTS=$SLURM_NTASKS
91     THEDATE=`date`
92     echo '********************************************************************************'
93     echo 'Start job '$THEDATE
94     echo 'NSLOTS = '$NSLOTS
95     echo '======= NODELIST ==============================================================='
96     echo $SLURM_NODELIST
97     cat /etc/redhat-release
98     echo '======= env ===================================================================='
99     env | grep SLURM
100     echo '======= modules ================================================================'
101     module list 2>&1
102     echo '================================================================================'
103    
104     #- check for disk space: relative space (99%) or absolute (10.G):
105     dsp=`df -P . | tail -1 | awk '{print $5}' | sed 's/%$//'`
106     if [ $dsp -gt 99 ] ; then
107     #dsp=`df -P . | tail -1 | awk '{print $4}'`
108     #if [ $dsp -le 100000000 ] ; then
109     echo 'Not enough space on this disk => do not run testreport.'
110     df .
111     exit
112     fi
113 jmc 1.9
114 jmc 1.1 if [ $checkOut -eq 1 ] ; then
115     echo "cleaning output from $gcmDIR/verification :"
116     #- remove previous output tar files and tar & remove previous output-dir
117     /bin/rm -f $gcmDIR/verification/??_${dNam}-${sfx}_????????_?.tar.gz
118     ( cd $gcmDIR/verification
119     listD=`ls -1 -d ??_${dNam}-${sfx}_????????_? 2> /dev/null`
120     for dd in $listD
121     do
122     if test -d $dd ; then
123     tar -cf ${dd}".tar" $dd > /dev/null 2>&1 && gzip ${dd}".tar" && /bin/rm -rf $dd
124 jmc 1.6 retVal=$?
125     if test "x$retVal" != x0 ; then
126 jmc 1.1 echo "ERROR in tar+gzip prev outp-dir: $dd"
127 jmc 1.6 echo " on '"`hostname`"' (return val=$retVal) but continue"
128 jmc 1.1 fi
129     fi
130     done )
131 jmc 1.9 echo "clean tst_2+2 + testreport output"
132 jmc 1.1 ( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean )
133     ( cd $gcmDIR/verification ; ./testreport $typ -clean )
134 jmc 1.9 if test "x$addExp" != x ; then
135     ( cd $gcmDIR/verification
136     listD=`ls -o | grep '^l' | awk '{print $8}' 2> /dev/null`
137     echo " + remove local links: $listD"
138     /bin/rm -f $listD
139     )
140     fi
141     echo "Update $git_code code in dir $gcmDIR :"
142     ( cd $gcmDIR ; git pull ) 2>&1
143 jmc 1.6 retVal=$?
144     if test "x$retVal" != x0 ; then
145 jmc 1.9 echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit"
146 jmc 1.1 exit
147     fi
148 jmc 1.9 echo " and checkout master:"
149     ( cd $gcmDIR ; git checkout master -- . ) 2>&1
150     if test "x$addExp" != x ; then
151     echo "Update $git_other code in dir $gcmDIR/$git_other :"
152     ( cd $gcmDIR/$git_other ; git pull ) 2>&1
153     retVal=$?
154     if test "x$retVal" != x0 ; then
155     echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit"
156     exit
157     fi
158     echo " and checkout master:"
159     ( cd $gcmDIR/$git_other ; git checkout master -- . ) 2>&1
160 jmc 1.1 fi
161     fi
162 jmc 1.9
163 jmc 1.1 if [ $checkOut -eq 2 ] ; then
164     if test -e $gcmDIR ; then
165     echo -n "Removing working copy: $gcmDIR ..."
166     rm -rf $gcmDIR
167     echo " done"
168     fi
169 jmc 1.9 # make a local copy (instead of making a new clone):
170 jmc 1.1 today=`date +%Y%m%d`
171 jmc 1.6 nCount=0; updFile="${srcDIR}/updated_code"
172 jmc 1.1 updDate=0 ; test -f $updFile && updDate=`cat $updFile`
173     while [ $today -gt $updDate ] ; do
174     nCount=`expr $nCount + 1`
175     if [ $nCount -gt 40 ] ; then
176     echo " waiting too long (nCount=$nCount) for updated code"
177     echo " today=$today , updDate=$updDate "
178     ls -l $updFile
179     exit
180     fi
181     sleep 60
182     updDate=0 ; test -f $updFile && updDate=`cat $updFile`
183     done
184     ls -l $updFile
185     echo " waited nCount=$nCount for updated code ($updDate) to copy"
186 jmc 1.6 if test -d $srcDIR/$srcCode ; then
187     echo -n "Make local copy of dir '$srcDIR/$srcCode' to: $gcmDIR ..."
188     cp -pra $srcDIR/$srcCode $gcmDIR
189 jmc 1.1 echo " done"
190 jmc 1.6 else echo " dir: $srcDIR/$srcCode missing => exit" ; exit ; fi
191 jmc 1.1 fi
192    
193     #- change dir to $gcmDIR/verification dir:
194     if test -e $gcmDIR/verification ; then
195     if [ $checkOut -lt 2 ] ; then
196     echo " dir $gcmDIR/verification exist" ; fi
197     cd $gcmDIR/verification
198 jmc 1.9 for exp2add in $addExp ; do
199     test -r $exp2add && /bin/rm -rf $exp2add
200     if test -d ../$git_other/$exp2add ; then
201     echo " add $exp2add link from $git_other"
202     ln -s ../$git_other/$exp2add .
203     if test $exp2add = 'global_oce_cs32' ; then
204     echo " link dir 'other_input/core2_cnyf' in here"
205     ( cd ../${git_other}/${exp2add}
206     test -L core2_cnyf && /bin/rm -f core2_cnyf
207     ln -s ../../../other_input/core2_cnyf . )
208     fi
209     if test $exp2add = 'global_oce_llc90' ; then
210     echo " link dir 'other_input/gael_oce_llc90_input' to 'input_fields'"
211     ( cd ../${git_other}/${exp2add}
212     test -L input_fields && /bin/rm -f input_fields
213     ln -s ../../../other_input/gael_oce_llc90_input input_fields
214     echo " link dirs: 'core2_cnyf' & 'global_oce_input_fields/*' in input_verifs"
215     test ! -e input_verifs && mkdir input_verifs
216     ( cd input_verifs ; /bin/rm -f *
217     ln -s ../../../../other_input/core2_cnyf .
218     ln -s ../../../../other_input/global_oce_input_fields/* . )
219     )
220     fi
221     else
222     echo " missing dir: $git_other/$exp2add"
223     continue
224     fi
225     done
226 jmc 1.1 else
227     echo "no dir: $gcmDIR/verification => exit"
228     exit
229     fi
230    
231     echo ''
232 jmc 1.2 echo ./testreport $options -of $OPTFILE -skd \'$skipExp\' \
233 jmc 1.5 -odir ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org
234 jmc 1.2 ./testreport $options -of $OPTFILE -skd "$skipExp" \
235 jmc 1.5 -odir ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org
236 jmc 1.1
237     echo ''
238 jmc 1.2 echo ../tools/do_tst_2+2 \
239 jmc 1.5 -o ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org
240 jmc 1.2 ../tools/do_tst_2+2 \
241 jmc 1.5 -o ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org
242 jmc 1.1

  ViewVC Help
Powered by ViewVC 1.1.22