#!/bin/bash -e # new script for running testreport on ollie.awi.de # - compile and run on compute nodes # - use ssh to call mpack command from the head node ollie0 #$Header: /home/ubuntu/mnt/e9_copy/MITgcm_contrib/test_scripts/ollie/mitgcmtestreport_cray,v 1.5 2016/06/22 06:23:27 mlosch Exp $ #$Name: $ # needed for cron-job source /usr/Modules/3.2.10/init/bash source /etc/profile.d/cray_pe.sh source /etc/profile.d/AWI.sh # module purge module load slurm module load craype-broadwell module load PrgEnv-cray/1.0.0 module unload cudatoolkit module swap mvapich2_cce cray-impi module load intel/impi-5.1.3 export LD_LIBRARY_PATH=${CRAY_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}: dNam='ollie' TST_DIR="/work/ollie/mlosch/test_$dNam" echo "start from TST_DIR='$TST_DIR' at: "`date` umask 0022 sfx='cray' RUNIT="runit_"$sfx OPTFILE=../tools/build_options/linux_ia64_${sfx}_ollie options="-MPI 6" options="$options -odir ${dNam}-c" #options="$options -j 6" #options="$options -t global_ocean.cs32x15" #EXE='mpiexec.hydra -bootstrap slurm -n TR_NPROC ./mitgcmuv' EXE='srun --mpi=pmi2 -n TR_NPROC ./mitgcmuv' if [ -e $TST_DIR ]; then echo "$TST_DIR exists" else mkdir $TST_DIR fi cd $TST_DIR HERE=$TST_DIR/output if [ -e $HERE ]; then echo "$HERE" else mkdir $HERE fi OUTFILE=$HERE/slurm_${sfx}.out MYOUTPUT=$HERE/out_$sfx if [ -e $MYOUTPUT ]; then rm -rf $MYOUTPUT fi if [ -e $OUTFILE ]; then rm -r $OUTFILE fi gcmDIR="MITgcm_$sfx" checkOut=1 if [ $checkOut -eq 1 ] ; then if test -d $gcmDIR/CVS ; then /bin/rm -rf $gcmDIR/verification/??_${dNam}_????????_? ( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) echo "cvs update of dir $gcmDIR :" ( cd $gcmDIR ; cvs -q -d :pserver:cvsanon@mitgcm.org:/u/gcmpack update -P -d ) 2>&1 RETVAL=$? if test "x$RETVAL" != x0 ; then echo "cvs update on '"`hostname`"' failed (return val=$RETVAL) => exit" exit fi else echo "no dir: $gcmDIR/CVS => try a fresh check-out" checkOut=2 fi fi if [ $checkOut -eq 2 ] ; then if test -e $gcmDIR ; then rm -rf $gcmDIR fi # cvs co MITgcm cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack co -P -d $gcmDIR MITgcm > /dev/null 2>&1 /usr/bin/find $gcmDIR -type d | xargs chmod g+rxs /usr/bin/find $gcmDIR -type f | xargs chmod g+r fi cd ${gcmDIR}/verification cwd=`pwd` SENDCMD="ssh ollie0 ${TST_DIR}/${gcmDIR}/tools/mpack-1.6/mpack" runtestreport="./testreport $options -of $OPTFILE -command \"${EXE}\" -send \"${SENDCMD}\" -sd ${cwd}" if [ ! -e $MYOUTPUT ] then touch $MYOUTPUT fi # echo "running testreport like this:" # echo ${runtestreport} -norun # eval "${runtestreport} -norun >> $MYOUTPUT 2>&1" # create batch script # JOBNAME=tst$sfx echo "creating batch script $HERE/$RUNIT" cat << EOF >| $HERE/$RUNIT #!/bin/bash #SBATCH --job-name=${JOBNAME} #SBATCH -o ${OUTFILE} #SBATCH --time=12:00:00 #SBATCH --ntasks=6 # still need this to be able to run a few experiments: # cfc_example, fizhi, tutorial_deep_convection ulimit -s unlimited cd \${SLURM_SUBMIT_DIR} cwd=`pwd` echo "running testreport like this in \${cwd}:" echo "${runtestreport} -devel -match 10" ${runtestreport} -devel -match 10 -a jmc@mitgcm.org >> $MYOUTPUT 2>&1 echo "running testreport like this in \${cwd}:" echo "./testreport -clean" ./testreport -clean echo "running testreport like this in \${cwd}:" echo "${runtestreport} -fast -match 10" ${runtestreport} -fast -match 10 -a jmc@mitgcm.org >> $MYOUTPUT 2>&1 EOF chmod a+x $HERE/$RUNIT echo " " >> $MYOUTPUT echo "***********************************************************" >> $MYOUTPUT echo "Submitting this job script:" >> $MYOUTPUT echo "***********************************************************" >> $MYOUTPUT cat $HERE/$RUNIT >> $MYOUTPUT echo "***********************************************************" >> $MYOUTPUT echo "end of job script" >> $MYOUTPUT echo "***********************************************************" >> $MYOUTPUT echo " " >> $MYOUTPUT sbatch $HERE/$RUNIT # # keep looking for the job in the job queues and wait until it has disappeared # jobruns=somedummy # while [ "${jobruns}"x != x ] # do # sleep 200 # jobruns=`squeue --noheader -u mlosch | grep "$JOBNAME" | awk '{print $1}'` # echo "waiting for job ${jobruns%% *} ($JOBNAME) to complete" # currentexp=`grep Experiment $MYOUTPUT | tail -1` # echo "currently running $currentexp" # done # # workaround for mailing the stuff # echo "mail the stuff" # MPACKCMD=../tools/mpack-1.6/mpack # fn=`ls -dtr tr_$dNam* | grep -v tar.gz | tail -1` # echo "fname ${fn}" # tar cf - $fn | gzip > "${fn}.tar.gz" # $MPACKCMD -s MITgcm-test -m 3555000 ${fn}.tar.gz jmc@mitgcm.org # sleep 2 # rm -rf "${fn}.tar.gz" echo "end of mitgcmtestreport"