# $Id$ set -xv CONF=GYRE_LOBSTER # Variables changed by lance_batch.ksh script RUN=xxx NB_PROCS=xxx LAUNCH=xxx LEXE=xxx CPERF=xxx D_INPUT=xxx D_GET=xxx REF_TAG=xxx MYO_EXP=xxx TSYMB=xxx # Variables changed by ins_valid.ksh script MAINDIR=/workdir/rech/eee/reee534/AUTRE WORK=/workdir/rech/eee/reee534/AUTRE/modipsl/config/ REF_OD=/u/rech/eee/reee831/NEMO_VALIDATION # Arguments # type = 'long' or '1_short' or '2_short' type=$1 case ${type} in 'long' ) DIROUT='LONG' ITERATIONS=360 ;; '1_short' ) DIROUT='1_SHORT' ITERATIONS=180 ;; '2_short' ) DIROUT='2_SHORT' ITERATIONS=180 ;; 'gtime' ) DIROUT='GTIME' ITERATIONS=4320 ;; esac # Working directory cd ${TMPDIR} #-T- osxxlf mkdir -p ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/${MYO_EXP}/RUN #-T- osxxlf cd ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/${MYO_EXP}/RUN #-T- osxxlf zback=$? #-T- osxxlf if [ ${zback} = 0 ] ; then rm -rf namelist* *.nc memory* solver.stat ocean.output* mpp.output* mono.output* ; fi ############################################################## ############################################################## ############################################################## ### Input files ############################################################## ############################################################## ############################################################## # Local function to copy namelists files get_namelist () { if [ -a $1/$2_$3 ] ; then cp $1/$2_$3 $4 else echo ' ###############################################################' echo ' ######################## W A R N I N G ########################' echo ' ######################## W A R N I N G ########################' echo ' ######################## W A R N I N G ########################' echo ' ###############################################################' echo " $2_$3 file doesn't exist, we use the standard $2" echo ' ###############################################################' echo ' ######################## W A R N I N G ########################' echo ' ######################## W A R N I N G ########################' echo ' ######################## W A R N I N G ########################' echo ' ###############################################################' cp $1/$2 $4 fi } # Local function to find namelists parameters supergrep () { grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%" } # Ocean namelist LOC_NAM=${MAINDIR}/modipsl/config/${CONF}/EXP00 get_namelist ${LOC_NAM} namelist ${MYO_EXP} namelist # Biogeochemistry namelists get_namelist ${LOC_NAM} namelist_top ${MYO_EXP} namelist_top get_namelist ${LOC_NAM} namelist_lobster ${MYO_EXP} namelist_lobster # namelist modifications PAT_NIT000=$( supergrep nit000 namelist ) PAT_NITEND=$( supergrep nitend namelist ) PAT_NSTOCK=$( supergrep nstock namelist ) PAT_NWRITE=$( supergrep nwrite namelist ) PAT_NRSTDT=$( supergrep nrstdt namelist ) PAT_NBITCM=$( supergrep nbit_cmp namelist ) PAT_NSOLVV=$( supergrep nsolv namelist ) PAT_RESTAR=$( supergrep ln_rstart namelist ) PAT_RESMLD=$( supergrep ln_trdmld_restart namelist ) sed -e "s%$PAT_RESTAR% ln_rstart = .false.%" \ -e "s%$PAT_NIT000% nit000 = 1 %" \ -e "s%$PAT_NITEND% nitend = ${ITERATIONS} %" \ -e "s%$PAT_NSTOCK% nstock = ${ITERATIONS} %" \ -e "s%$PAT_NWRITE% nwrite = 60 %" \ -e "s%$PAT_NRSTDT% nrstdt = 0 %" \ -e "s%$PAT_NBITCM% nbit_cmp = 1%" \ -e "s%$PAT_NSOLVV% nsolv = 2%" \ -e "s%$PAT_RESMLD% ln_trdmld_restart = .false.%" namelist > nam.tmp mv nam.tmp namelist # namelist modifications PAT_NWRITRC=$( supergrep nwritetrc namelist_top ) PAT_NWRITRD=$( supergrep ntrd_trc namelist_top ) PAT_RESTTRD=$( supergrep ln_trdmld_trc_restart namelist_top ) PAT_LTRCRAD=$( supergrep ln_trcrad namelist_top ) sed -e "s%$PAT_NWRITRC% nwritetrc = ${ITERATIONS}%" \ -e "s%$PAT_NWRITRD% ntrd_trc = ${ITERATIONS}%" \ -e "s%$PAT_LTRCRAD% ln_trcrad = .false.%" \ -e "s%$PAT_RESTTRD% ln_trdmld_trc_restart = .false.%" namelist_top > nam.tmp mv nam.tmp namelist_top PAT_ADD=$( supergrep nwritedia namelist_lobster ) sed -e "s%$PAT_ADD% nwritedia = ${ITERATIONS}%" namelist_lobster > nam.tmp mv nam.tmp namelist_lobster # Analytical forcing # Get restarts files if needed if [ $type = '2_short' ] then if [ ${RUN} = 'mon' -o ${RUN} = 'omp' ] ; then cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/*_restart.nc restart.nc cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/*_restart_mld.nc restart_mld.nc cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/*_restart_trc.nc restart_trc.nc cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/*_restart_mld_trc.nc restart_mld_trc.nc fi if [ ${RUN} = 'mpi' ] ; then typeset -Z4 i=0 while [ $i -lt $NB_PROCS ] do cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/*_restart_${i}.nc restart_${i}.nc cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/*_restart_mld_${i}.nc restart_mld_${i}.nc cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/*_restart_trc_${i}.nc restart_trc_${i}.nc cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/*_restart_mld_trc_${i}.nc restart_mld_trc_${i}.nc let i=$i+1 done fi # Ocean namelist modifications PAT_NIT000=$( supergrep nit000 namelist ) PAT_NITEND=$( supergrep nitend namelist ) PAT_NRSTDT=$( supergrep nrstdt namelist ) PAT_RESTAR=$( supergrep ln_rstart namelist ) PAT_RESMLD=$( supergrep ln_trdmld_restart namelist ) ORCA_NIT000=$(( $ITERATIONS + 1 )) ORCA_NITEND=$(( $ITERATIONS*2 )) sed -e "s%$PAT_RESTAR% ln_rstart = .true.%" \ -e "s%$PAT_NIT000% nit000 = $ORCA_NIT000 %" \ -e "s%$PAT_NITEND% nitend = $ORCA_NITEND %" \ -e "s%$PAT_NRSTDT% nrstdt = 2%" \ -e "s%$PAT_RESMLD% ln_trdmld_restart = .true.%" namelist > nam.tmp mv nam.tmp namelist # Biogeochemistry namelist modifications PAT_RESTAR=$( supergrep ln_rsttr namelist_top ) PAT_RESTRD=$( supergrep ln_trdmld_trc_restart namelist_top ) sed -e "s%$PAT_RESTAR% ln_rsttr = .true. %" \ -e "s%$PAT_RESTRD% ln_trdmld_trc_restart = .true.%" namelist_top > nam.tmp mv nam.tmp namelist_top fi ############################################################## ############################################################## ############################################################## ### Launch run ############################################################## ############################################################## ############################################################## cp ${WORK}/NEMO_VALID/W${CONF}/opa_${CONF}_${RUN}_${MYO_EXP} opa_${CONF}_${RUN}_${MYO_EXP} cp ${WORK}/NEMO_VALID/W${CONF}/opa_${CONF}_memo_${MYO_EXP} opa_${CONF}_memo_${MYO_EXP} chmod 777 opa_${CONF}_${RUN}_${MYO_EXP} chmod 777 opa_${CONF}_memo_${MYO_EXP} # # Profiling & Executable memory size #################################### touch memory_size.txt case ${RUN} in 'mon' ) #-T- sx8brodie export F_PROGINF=detail #-T- sx8brodie echo "Stack memory: $( (size opa_${CONF}_${RUN}_${MYO_EXP}) )" >> memory_size.txt #-T- sx8brodie echo "Static memory: $( (size opa_${CONF}_memo_${MYO_EXP}) )" >> memory_size.txt ;; #-T- sx8mercure export F_PROGINF=detail #-T- sx8mercure echo "Stack memory: $( (size opa_${CONF}_${RUN}_${MYO_EXP}) )" >> memory_size.txt #-T- sx8mercure echo "Static memory: $( (size opa_${CONF}_memo_${MYO_EXP}) )" >> memory_size.txt ;; #-T- aix6 echo "Stack memory: $( (size opa_${CONF}_memo_${MYO_EXP}) )" >> memory_size.txt #-T- aix6 echo "Static memory: $( (size opa_${CONF}_${RUN}_${MYO_EXP}) )" >> memory_size.txt ;; #-T- osxxlf echo "Stack memory: $( (size opa_${CONF}_memo_${MYO_EXP}) )" >> memory_size.txt #-T- osxxlf echo "Static memory: $( (size opa_${CONF}_${RUN}_${MYO_EXP}) )" >> memory_size.txt ;; 'mpi' ) #-T- sx8brodie export MPIPROGINF=detail ;; #-T- sx8mercure export MPIPROGINF=detail ;; #-T- aix6 ;; #-T- osxxlf ;; 'omp' ) #-T- sx8brodie export F_PROGINF=detail #-T- sx8brodie export OMP_NUM_THREADS=${NB_PROCS} ;; #-T- sx8mercure export F_PROGINF=detail #-T- sx8mercure export OMP_NUM_THREADS=${NB_PROCS} ;; #-T- aix6 ;; #-T- osxxlf ;; esac # # >>>>>> EXECUTION < < < < ########################## case ${RUN} in 'mon' | 'omp' ) ${CPERF} ./opa_${CONF}_${RUN}_${MYO_EXP} ;; 'mpi' ) #-T- sx8brodie ${CPERF} ${LEXE} ./opa_${CONF}_${RUN}_${MYO_EXP} ;; #-T- sx8mercure ${CPERF} ${LEXE} ./opa_${CONF}_${RUN}_${MYO_EXP} ;; #-T- aix6 ${CPERF} ${LEXE} ./opa_${CONF}_${RUN}_${MYO_EXP} ;; #-T- osxxlf mpd& #-T- osxxlf sleep 5 #-T- osxxlf ${CPERF} ${LEXE} ./opa_${CONF}_${RUN}_${MYO_EXP} #-T- osxxlf mpdallexit ;; esac ls -l # ############################################################## ############################################################## ############################################################## ### Save output files ############################################################## ############################################################## ############################################################## case ${RUN} in 'mon' | 'omp' ) liste_files=' *abort* memory* namelist* perfs* solver.stat ocean.output layout* GYRE* restart* mono*' ;; 'mpi' ) liste_files=' *abort* namelist* solver.stat perfs* ocean.output* layout* GYRE* restart* mpp*' ;; esac # Ensure that all files saved are coming from the current run ind=1 for k in $liste_files do echo $k > temp var=$( ( awk '{printf("%-.4s", varin ) } ' varin=$k temp ) ) if [ ${ind} = 1 -a ${var} = 'perf' ] ; then kc='perf*' rm -f ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/${MYO_EXP}/${kc} ind=0 fi cp $k ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/${MYO_EXP}/$k done ############################################################## ############################################################## ############################################################## ### Retrieve some reference run files ############################################################## ############################################################## ############################################################## if [ ${REF_TAG} ] then STORE_DATA=${REF_OD}/${CONF}/${REF_TAG}/${RUN}/${DIROUT} LFILES="solver.stat memory_size.txt ocean.output ${RUN}${CONF}_err" for ref_file in ${LFILES} do ${D_GET} ${STORE_DATA}/${TSYMB}${ref_file} ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/REF/${ref_file} done fi ############################################################## ############################################################## ############################################################## ### Launch restart job ############################################################## ############################################################## ############################################################## if [ $type = '1_short' ] ; then cd ${WORK}/NEMO_VALID/W${CONF}/${RUN}/2_SHORT/${MYO_EXP} ${LAUNCH}job_${RUN}_2_short_${MYO_EXP}.ksh fi