/[MITgcm]/MITgcm_contrib/test_scripts/nasa_ames/test_submit_pleiades
ViewVC logotype

Annotation of /MITgcm_contrib/test_scripts/nasa_ames/test_submit_pleiades

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


Revision 1.5 - (hide annotations) (download)
Fri Jun 2 22:51:03 2023 UTC (2 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +5 -2 lines
To avoid job "fast" to get killed for exceeding time limit, split this one
in 2 submissions, the first one only compiling first set of exp., then
submitted the second one which 1) compile the remaining, 2) run all exp
and 3) run test 2+2.

1 jmc 1.1 #! /usr/bin/env bash
2    
3 jmc 1.5 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/nasa_ames/test_submit_pleiades,v 1.4 2022/05/10 18:41:31 jmc Exp $
4 jmc 1.1 # $Name: $
5    
6     today=`date +%Y%m%d`
7     dInWeek=`date +%a`
8    
9     if test $# = 0
10     then
11 jmc 1.5 #TEST_LIST='ieee fast'
12     TEST_LIST='ieee fast1 fast2'
13 jmc 1.1 else
14     TEST_LIST=$*
15     fi
16    
17     headNode=`hostname -s`
18     QSUB="/PBS/bin/qsub"
19     QSTAT="/PBS/bin/qstat -u $USER"
20     #dNam=$headNode
21     #QSUB="/usr/bin/sbatch"
22     #QLIST="/usr/bin/squeue -u $USER"
23     dNam='pleiades'
24     HERE="$HOME/test_${dNam}"
25 jmc 1.4 TST_DISK="/nobackupp17/$USER"
26 jmc 1.1 TST_DIR="$TST_DISK/test_${dNam}"
27 jmc 1.2 tmpFil="/tmp/"`basename $0`".$$"
28     #- where local copy of code is (need to be consistent with run-job scripts):
29     srcDIR=$TST_DIR
30     srcCode="MITgcm_today"
31    
32 jmc 1.1 logPfix='test_submit'
33     SUB_DIR="$HERE/nasa_ames"
34     OUT_DIR="$HERE/output"
35     LOG_FIL="$OUT_DIR/$logPfix."`date +%m%d`".log"
36     #SUB_DIR="$HERE/temp"
37    
38     #-- clean up old log files and start a new one:
39     cd $OUT_DIR
40    
41     rm -f $logPfix.*.log_bak
42     if test -f $LOG_FIL ; then mv -f $LOG_FIL ${LOG_FIL}_bak ; fi
43     echo -n '-- Starting: ' | tee -a $LOG_FIL
44     date | tee -a $LOG_FIL
45    
46     n=$(( `ls $logPfix.*.log | wc -l` - 10 ))
47     if test $n -gt 0 ; then
48     echo ' remove old log files:' | tee -a $LOG_FIL
49     ls -lt $logPfix.*.log | tail -"$n" | tee -a $LOG_FIL
50     ls -t $logPfix.*.log | tail -"$n" | xargs rm -f
51     fi
52    
53     #-------------------------------------------------------------
54     # defaults
55     #export PATH="$PATH:/usr/local/bin"
56     if [ -d ~/bin ]; then export PATH=$PATH:~/bin ; fi
57     #- to get case insensitive "ls" (and order of tested experiments)
58     export LC_ALL="en_US.UTF-8"
59     # Turn off stack limit for FIZHI & AD-tests
60     #ulimit -s unlimited
61    
62     if test -f /etc/profile.d/modules.sh ; then . /etc/profile.d/modules.sh ; fi
63     #- load standard modules:
64     #module add fedora slurm maui svante
65     #module add slurm
66     module list >> $LOG_FIL 2>&1
67    
68     #- method to acces CVS:
69     cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q'
70 jmc 1.2 #- and which GitHub repository to use:
71     git_repo='MITgcm'; git_code='MITgcm'
72     #git_repo='altMITgcm'; #git_code='MITgcm66h'
73 jmc 1.1
74     checkOut=1
75 jmc 1.2 addExp=''
76 jmc 1.1 updFile='updated_code'
77    
78 jmc 1.2 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
79     if [ $checkOut -ge 1 ] ; then
80     #-- Download/Update reference version of MITgcm code:
81 jmc 1.1
82 jmc 1.2 if test $srcDIR = $TST_DIR ; then
83     echo "cd $TST_DISK ; pwd (x2)" | tee -a $LOG_FIL
84     cd $TST_DISK | tee -a $LOG_FIL 2>&1
85     pwd | tee -a $LOG_FIL
86     fi
87     if test ! -d $srcDIR ; then
88     echo -n "Creating a working dir: $srcDIR ..." | tee -a $LOG_FIL
89     #/bin/rm -rf $srcDIR
90     mkdir $srcDIR
91     retVal=$?
92     if test "x$retVal" != x0 ; then
93     echo "Error: unable to make dir: $srcDIR (err=$retVal ) --> Exit" | tee -a $LOG_FIL
94     exit 1
95     fi
96     fi
97     cd $srcDIR
98     pwd | tee -a $LOG_FIL
99 jmc 1.1
100 jmc 1.2 #- remove date/lock-file and old copy:
101     if test -f $updFile ; then rm -f $updFile ; sleep 2 ; fi
102     test -e $srcCode && rm -rf $srcCode
103    
104     if [ $checkOut -eq 1 ] ; then
105     if test -e $git_code/.git/config ; then
106     echo -n "Updating current clone ( $git_code ) ..." | tee -a $LOG_FIL
107     echo '' >> $LOG_FIL
108     ( cd $git_code ; git pull ) >> $LOG_FIL 2>&1
109     retVal=$?
110     if test "x$retVal" != x0 ; then echo ''
111     echo "'git pull' on '"`hostname`"' fail (return val=$retVal) => exit" | tee -a $LOG_FIL
112     exit
113     else echo " done" | tee -a $LOG_FIL
114     fi
115 jmc 1.3 echo " and checkout master:" | tee -a $LOG_FIL
116     ( cd $git_code ; git checkout master -- . ) | tee -a $LOG_FIL
117 jmc 1.2 else
118     echo "missing file: $git_code/.git/config => try a new clone" | tee -a $LOG_FIL
119     checkOut=2
120 jmc 1.1 fi
121     fi
122 jmc 1.2 if [ $checkOut -eq 2 ] ; then
123     if test -e $git_code ; then
124     echo -n " removing dir: $git_code ..." | tee -a $LOG_FIL
125     rm -rf $git_code
126     echo " done" | tee -a $LOG_FIL
127 jmc 1.1 fi
128 jmc 1.2 echo -n "Make a clone of $git_code from repo: $git_repo ..." | tee -a $LOG_FIL
129     git clone https://github.com/$git_repo/${git_code}.git 2> $tmpFil
130     retVal=$?
131     if test $retVal = 0 ; then
132     echo ' --> done!' | tee -a $LOG_FIL
133     rm -f $tmpFil
134     else echo '' | tee -a $LOG_FIL
135     echo " Error: 'git clone' returned: $retVal" | tee -a $LOG_FIL
136     cat $tmpFil ; rm -f $tmpFil
137     exit 2
138 jmc 1.1 fi
139 jmc 1.2 fi
140     #---- making a new working copy: MITgcm_today
141     rsync -a $git_code/ $srcCode --exclude '.git'
142     ls -ld $srcCode | tee -a $LOG_FIL
143     if test -d $srcCode/verification ; then
144     for exp2add in $addExp ; do
145     echo " add dir: $exp2add (from Contrib:verification_other)" | tee -a $LOG_FIL
146     ( cd $srcCode/verification ; $cmdCVS co -P -d $exp2add \
147     MITgcm_contrib/verification_other/$exp2add > /dev/null )
148     done
149     fi
150     /usr/bin/find $srcCode -type d | xargs chmod g+rxs
151     /usr/bin/find $srcCode -type f | xargs chmod g+r
152     #- update date/lock-file:
153     if test -d $srcCode/verification ; then
154     echo $today > $updFile ; sleep 2
155     ls -l $updFile | tee -a $LOG_FIL
156     echo '' | tee -a $LOG_FIL
157     fi
158 jmc 1.1
159 jmc 1.2 #-- Done with Download/Update of MITgcm code
160 jmc 1.1 fi
161 jmc 1.2 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
162 jmc 1.1
163 jmc 1.2 #-- leave srcDIR and go back to output dir
164 jmc 1.1 cd $OUT_DIR
165     #-- now really do something:
166    
167     JOB_LIST=$TEST_LIST
168     NB_SUB_JOBS=0
169     for i in $JOB_LIST
170     do
171     case $i in
172     'pgiAdm') sfx='pgi_adm' ;;
173     'pgiMth') sfx='pgi_mth' ;;
174     *) sfx=`echo ${i} | sed 's/MPI$/_mpi/'` ;;
175     esac
176     BATCH_SCRIPT="test_${dNam}_$sfx"
177     if test -f $SUB_DIR/$BATCH_SCRIPT ; then
178     #- job name ( $JOB ) & output-file name ( $JOB.std??? ) must match
179     # definition within $BATCH_SCRIPT slurm script
180     JOB="tst_${i}"
181     job_exist=`$QSTAT | grep $JOB | wc -l`
182     #sJob=`printf "%8.8s" $JOB` #- squeue truncate name to only 1rst 8c
183     #job_exist=`$QLIST | grep $sJob | wc -l`
184     if test "x_$job_exist" = x_0 ; then
185     #-- move previous output file
186     outList=`ls $JOB.std??? 2> /dev/null`
187     if test "x$outList" != x ; then
188     echo -n " moving job $JOB old output files:" | tee -a $LOG_FIL
189     if test -d $OUT_DIR/prev ; then
190     for xx in $outList ; do
191     pp=$OUT_DIR/prev/$xx ; echo -n " $xx" | tee -a $LOG_FIL
192     test -f $pp.sav && mv -f $pp.sav $pp.old
193     test -f $pp && mv -f $pp $pp.sav
194     chmod a+r $xx ; mv -f $xx $OUT_DIR/prev
195     done
196     echo " to dir ./prev" | tee -a $LOG_FIL
197     else
198     echo " <-- missing dir $OUT_DIR/prev" | tee -a $LOG_FIL
199     fi
200     else echo " no old output files from job '$JOB'" | tee -a $LOG_FIL
201     fi
202     #-- submit job
203 jmc 1.5 if test $sfx != 'fast2' ; then
204 jmc 1.1 echo -n "--> $JOB : " | tee -a $LOG_FIL
205     $QSUB $SUB_DIR/$BATCH_SCRIPT | tee -a $LOG_FIL
206     NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1`
207 jmc 1.5 fi
208 jmc 1.1 else
209     echo "--> $JOB :" | tee -a $LOG_FIL
210     $QSTAT | grep $JOB | tee -a $LOG_FIL
211     #$QLIST | grep $sJob | tee -a $LOG_FIL
212     echo ' job already exist => skip this test' | tee -a $LOG_FIL
213     fi
214     else
215     echo 'no file:' $BATCH_SCRIPT 'to submit' | tee -a $LOG_FIL
216     fi
217     done
218     echo "info-sub-list: NB_SUB_JOBS='$NB_SUB_JOBS'" >> $LOG_FIL
219     echo -n '-- Finished at: ' | tee -a $LOG_FIL
220     date | tee -a $LOG_FIL
221    
222     #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
223     exit 0

  ViewVC Help
Powered by ViewVC 1.1.22