#@$-r GYRE.1 # name of job #@$-me # sends a mail at the end of execution #@$-eo # merge standard error and output # in one file #@$-o sortie_GYRE.1 # name of the output file (listing) #@$-lT 2:00:00 # Max total CPU time #@$-lt 1:59:00 # Max CPU time per process #@$-lM 2Gb # Max memory #-Q- sxnec ## NEC #-Q- sxnec #@$-jo # print a short performance analysis #-Q- sxnec # at the end of the listing ## Temporary comments ###-Q- sxnec #@$-c 4 # Max number of simultaneous procs used (here=4) ###-Q- sxnec #@$-q multi # Use more than 1 proc ## End of Temporary comments #-Q- fjvpp ## VPP #-Q- fjvpp #@$-ko # Keep the output listing on disk #-Q- fjvpp #@$-s /bin/ksh # Name of the shell used for this script #-Q- fjvpp #@$-lP 3 # Number of procs (here=3) # # # ######################################################################## ## ## Script to run the GYRE configuration ## ## Claire Levy ## ## Original Script: ## Coupled IPSL experiment Eric MAISONNAVE / Marie-Alice FOUJOLS ## ######################################################################### ##-- print echo of commands before and after shell interpretation date set -vx ## ## ##-- Name of the experiment ##-- CEXPER=GYRE # - Directory for executables # # ! Attention ! The executables are to be copied from the modipsl/bin # directory # R_EXE=$WORKDIR/${CEXPER}/Exe # # JOB=${CEXPER} ##-- First day of the experiment JOUR_DEBUT_EXP=1 ; MOIS_DEBUT_EXP=1 ; AN_DEBUT_EXP=1 ##-- ##-- Last day of the experiment JOUR_FINAL_EXP=31 ; MOIS_FINAL_EXP=12 ; AN_FINAL_EXP=1 ##-- ##-- Duration of the experiment JOURS=0; MOIS=0 ; ANS=1 ## ######################################################################### ## ## 1. Unix Variables definition ## ######################################################################### ## ##-- Get the submisson directory echo $QSUB_WORKDIR ##-- Get the directory controlling the chaining of the jobs R_EXPER=${QSUB_WORKDIR} ## ## MKDIR="mkdir" #-Q- fjvpp MKDIR="/usr/X11R6/bin/mkdirhier" # ##--- Variables used by the ocean model # ----------------- GYRE -------------- # JOB=$( echo ${CEXPER} | tr '[a-z]' '[A-Z]' ) # # # ######################################################################### ## ## 2. Directories definition ## ######################################################################### # - Data directory for input/output of the model # #-Q- sxnec R_DONNEES=${WORKDIR}/EXPER/${CEXPER} #-Q- fjvpp R_DONNEES=${WORKDIR}/EXPER/${CEXPER} # # # ----------------- GYRE -------------------- # R_ENTREE_OCE=${R_DONNEES}/Entree/Oce R_SORTIE_OCE=${R_DONNEES}/Sortie/Oce # # if [ ! -d ${R_DONNEES} ]; then mkdir -p ${R_ENTREE_OCE} mkdir -p ${R_SORTIE_OCE} mkdir -p ${R_DONNEES}/SortieTest/Oce fi # # - Get the tarfile containing all the usefull files # # #-- Directory definition for the data storage computer (where the tarfile is) #-Q- sxnec R_STOCKAGE="gaya:/u/DODS/pub/reee055/ORCA2_LIM" #-Q- fjvpp R_STOCKAGE="/G/nymphea0/dmnfs/" #-- #-- Test if the tarfile is already there before geting it from the data storage #-- #-Q- sxnec Rapatrie () { [ -f $1/$3 ] || ( rcp ${R_STOCKAGE}/$2/$3 $1 ; cd $1; tar xvf $3 ;) } #-Q- fjvpp Rapatrie () { [ -f $1/$3 ] || ( cp ${R_STOCKAGE}/$2/$3 $1 ; cd $1; tar xvf $3 ;) } # Rapatrie ${R_ENTREE_OCE} ENTREE Entree_Oce.tar Rapatrie ${R_DONNEES}/SortieTest/Oce VERIF SortieTest_Oce.tar # # - Temporary working directory # #-Q- sxnec TMP=${TMPDIR}/${CEXPER} #-Q- fjvpp TMP=${SCRATCHDIR}/${CEXPER} # #-- Create this directory if needed [ -d ${TMP} ] || ${MKDIR} ${TMP} # # ######################################################################### ## ## 3. Pre-processing ## ######################################################################### # # ============================================================================= # Time control # ============================================================================= cd ${R_EXPER} ## ##- Create ${JOB}.suivi containing the date of the run going on or the date ##- of the first waiting job, and ${JOB}.log containing execution log ## if [ ! -f "${JOB}.suivi" ] then JOUR_DEB_JOB=${JOUR_DEBUT_EXP} ; MOIS_DEB_JOB=${MOIS_DEBUT_EXP} ; AN_DEB_JOB=${AN_DEBUT_EXP} NUMERO=1 cat <${JOB}.suivi $AN_DEB_JOB $MOIS_DEB_JOB $JOUR_DEB_JOB $NUMERO EOF echo `date` " Begining of Experience : " ${JOB} " in directory :" ${R_EXPER} > ${JOB}.log fi cat ${JOB}.suivi | read AN_DEB_JOB MOIS_DEB_JOB JOUR_DEB_JOB NUMERO echo $AN_DEB_JOB $MOIS_DEB_JOB $JOUR_DEB_JOB echo "`date` $AN_DEB_JOB $MOIS_DEB_JOB $JOUR_DEB_JOB begin" >> ${JOB}.log # ============================================================================== # Copy executables # ============================================================================== if [ -z ${TMP} ]; then echo " The TMP variable is empty !!!" exit fi cd ${TMP} || exit #- Clear working directory rm -f * #- Get executables # ----------------- GYRE ----------------------- cp ${R_EXE}/opa opa.xx # # #-Q- sxnec # ----------------- GYRE ----------------------- #-Q- sxnec # Reminder for the cpp keys used #-Q- sxnec # #-Q- sxnec OPT_COMPIL_ORCA=` mcs -p opa.xx | grep key_orca | head -1 ` #-Q- sxnec # #-Q- sxnec echo ${OPT_COMPIL_ORCA} #-Q- sxnec # #-Q- sxnec #-- Check ocean model resolution #-Q- sxnec RESOL_ORCA=` echo ${OPT_COMPIL_ORCA} | sed s/.*key_orca_r// | sed s/-Wp.*// ` #-Q- sxnec if [ ${RESOL_ORCA} -ne "2" ] ; then #-Q- sxnec echo " Resolution of the executable for the ocean model is not correct : " ${RESOL_ORCA} #-Q- sxnec fi # #-Q- sxnec #-- Ckeck for real and integer size #-Q- sxnec #-- in the ocean executable #-Q- sxnec IR_ORCA=` echo ${OPT_COMPIL_ORCA} | grep "-ew" ` #-Q- sxnec if [ -n ${IR_ORCA} ]; then #-Q- sxnec echo 'Taille des reels : 8 ' #-Q- sxnec echo 'Taille des entiers : 8 ' #-Q- sxnec else #-Q- sxnec echo ' ATTENTION: ocean executable has not been compiled in I8R8 ' #-Q- sxnec exit #-Q- sxnec fi # ============================================================================== # Update the namelist # ============================================================================== # # ----------------- GYRE --------------------- # # # change namelist from fortran 77 to fortran 90 sed -e /:/d -e s/" \&END"/"\/"/ -e s/" \&"/"\&"/ ${R_ENTREE_OCE}/namelist > namelist # PAT_NO=$( grep 'no' namelist | grep -v off ) PAT_CEXPER=$( grep 'cexper' namelist ) PAT_RESTAR=$( grep 'lrstar' namelist ) PAT_NRSTAR=$( grep 'nrstdt' namelist ) PAT_NMSH=$( grep 'nmsh' namelist ) PAT_NDATE0=$( grep 'ndate0' namelist ) if [ ${NUMERO} -eq 1 ] then #- At the beginning of the experiment: #- No check of the date of restart (since there is no restart) #- Create the meshmask file (usefull for graphics) sed -e "s/$PAT_CEXPER/ cexper=\"$CEXPER\"/" \ -e "s/$PAT_NMSH/ nmsh=1/" \ namelist > nam.tmp else #- Check the date of restart for all the following job submission sed -e "s/$PAT_CEXPER/ cexper=\"$CEXPER\"/" \ -e "s/$PAT_RESTAR/ lrstar=.TRUE./" \ -e "s/$PAT_NMSH/ nmsh=0/" \ -e "s/$PAT_NRSTAR/ nrstdt=1/" \ -e "s/$PAT_NDATE0/ ndate0=$DATE_DEB_JOB/" \ namelist > nam.tmp fi mv nam.tmp namelist # # ============================================================================== # Copy input files # ============================================================================== # # ----------------- GYRE --------------------- # # - Copy auxilliary files # # WARNING: No input data files for the GYRE configuration # # - Copy of the restart file # if [ ${NUMERO} -ne 1 ] then cp ${R_SORTIE_OCE}/${CEXPER}_${DATE_RESTART}_restart.nc restart.nc fi # # ls -alF # ######################################################################### ## ## 4. Launching the experiment ## ######################################################################### # ##-Q- sxnec export F_PROGINF=detail F_FTRACE=yes F_ERRCNT=500 ##-Q- sxnec mpirun -np 1 -max_np 3 opa.xx #-Q- sxnec opa.xx #-Q- fjvpp opa.xx -np 1 #-Q- fjvpp ##-- Accounting #-Q- fjvpp ja ls -alF NIT_FINAL=$( cat time.step ) # ######################################################################### ## ## 5. Post-processing ## ######################################################################### # # ============================================================================== # Save output files # ==============================================================================# i_ERR_SAUV=0 # # # # ----------------- GYRE --------------------- # if [ -f date.file ] then DATE=$(cat date.file | sed 's/ //g' | sed 's/_output//g' ) fi ## Print the last time step: cat time.step # ##-Q- sxnec cp ftrace.out ${R_SORTIE_OCE}/${DATE}.ftrace.out ##-Q- sxnec cp mon.out ${R_SORTIE_OCE}/${DATE}.mon.out # # Save ocean output files # if [ ${NUMERO} -eq 1 ] then mv meshmask* ${R_SORTIE_OCE} fi mv ocean.output ${R_SORTIE_OCE}/${DATE}.oceout mv solver.stat ${R_SORTIE_OCE}/${DATE}.solver.stat # for file_netcdf in *_grid_[TUVW].nc do mv $file_netcdf ${R_SORTIE_OCE}/ || i_ERR_SAUV=1 done # # Save ocean restart file mv ${CEXPER}_*_restart.nc ${R_SORTIE_OCE}/${CEXPER}_${DATE_FIN_JOB}_restart.nc if [ ! -f ${R_SORTIE_OCE}/${CEXPER}_${DATE_FIN_JOB}_restart.nc ]; then echo " Attention: The backup of the restart file was UNSUCCESSFULL" i_ERR_SAUV=1 fi # #- #- Test on backups #- if [ ${i_ERR_SAUV} -ne "0" ] ; then echo "Error in at least one of the restarts backups!" exit fi # # Tar all outputs in one tarfile cd ${R_SORTIE_OCE} if [ ! -f ${R_DONNEES}/SortieTest/Oce/SortieTest_Oce.tar ] then tar cvf ${R_DONNEES}/SortieTest/Oce/SortieTest_Oce.tar . else tar rvf ${R_DONNEES}/SortieTest/Oce/SortieTest_Oce.tar . fi rcp ${R_DONNEES}/SortieTest/Oce/SortieTest_Oce.tar ${R_STOCKAGE}/VERIF/SortieTest_Oce.tar cd ${TMP}