#!/bin/ksh ###################################################### # Original : C. Talandier for ESOPA # Contact : opatlod@locean-ipsl.upmc.fr # # This script aims to (for each standard configuration) : # - I. Take into account specific files changes # - ./modipsl/util/ins_make # - ./modipsl/config/NAME_CONFIG/AA_make* # - ./modipsl/config/NAME_CONFIG/scripts/BB_make.ldef # - II. Build configuration's environment & dependencies # - ./modipsl/config/NAME_CONFIG/WORK # - ./modipsl/config/NAME_CONFIG/MY_SRC # - ./modipsl/config/NAME_CONFIG/scripts/BB_make # - III. Build results sub-directories in the OUTDIR # directory specified by user just below # NEMO_VALID/WNAME_CONFIG/ # |-- mon --> MONO run # | |-- 1_SHORT # | |-- 2_SHORT # | |-- LONG # | `-- GTIME # |-- mpi --> MPI run # | |-- 1_SHORT # | |-- 2_SHORT # | |-- LONG # | `-- GTIME # `-- omp --> Open-MP run # |-- 1_SHORT # |-- 2_SHORT # |-- LONG # `-- GTIME # # - IV. Modify lance_batch.ksh & assessment.ksh scripts # - V. Preliminary compilations ###################################################### #set -xv ########################################################## ##### Begin Users modifications ########################################################## # OUTDIR : working directory from which jobs will be launched # & results stored # INPUTD : directory where to get ORCA2_LIM_nemo_v2.tar # REFDAT : directory where to get results from reference tags # DECOMP : total number of processors which will be used # MAIL : give your e-mail # UAGRIF : one of the standard configurations is based on AGRIF yes/no ########################################################## OUTDIR=/Users/ctlod/WORK/AZE/modipsl/config INPUTD=/u/rech/eee/reee831/IO_NEMO_ORCA2_LIM REFDAT=/u/rech/eee/reee831/NEMO_VALIDATION DECOMP=8 MAIL="ctlod@locean-ipsl.upmc.fr" UAGRIF=yes ########################################################## ##### End Users modifications ########################################################## # Standard configurations NBCFG=4 CONF[0]=ORCA2_LIM CONF[1]=GYRE CONF[2]=GYRE_LOBSTER CONF[3]=ZAGRIF LCLDIR=`pwd` # Use a modified modipsl script: ins_make # which allows to build Makefiles of a specific configuration # using the following syntax: ins_make -w NAME_CONF cp ./MODIPSL_FILES/ins_make ../../../util/. # Set following variable in AA_make.ldef script # - WWDIR = directory where to store results and jobs CAR_WORK_tmp=$( grep 'WWDIR=' ./CONFIG_FILES/AA_make.ldef ) CAR_WORK=`echo $CAR_WORK_tmp | cut -f 1 -d " " ` sed -e "s?${CAR_WORK}?WWDIR=${OUTDIR}?" ./CONFIG_FILES/AA_make.ldef > ./CONFIG_FILES/AA_make.ldef.$$ mv ./CONFIG_FILES/AA_make.ldef.$$ ./CONFIG_FILES/AA_make.ldef && rm -f ./CONFIG_FILES/AA_make.ldef.$$ # Get the current target name LOCTARG=`../../../util/w_i_h` # Loop over each standard configuration # ##################################### ind=0 while [ $ind -lt ${NBCFG} ] do # I. Take into account specific changes # ##################################### # Set following variables in job_NAME_CONF.ksh script # - MAINDIR = directory where to get namelist input files # - WORK = directory where to store results # - REF_OD = directory where Are stored results from previous tags cd ../../../.. ; NAME_ARCH=$( pwd ) ; cd ${LCLDIR} echo ${NAME_ARCH} CAR_MAIN_tmp=$( grep 'MAINDIR=' ./JOBS/job_${CONF[${ind}]}.ksh ) CAR_MAIN=`echo $CAR_MAIN_tmp | cut -f 1 -d " " ` CAR_WORK_tmp=$( grep 'WORK=' ./JOBS/job_${CONF[${ind}]}.ksh ) CAR_WORK=`echo $CAR_WORK_tmp | cut -f 1 -d " " ` CAR_REFO_tmp=$( grep 'REF_OD=' ./JOBS/job_${CONF[${ind}]}.ksh | head -1 ) CAR_REFO=`echo $CAR_REFO_tmp | cut -f 1 -d " " ` sed -e "s?${CAR_MAIN}?MAINDIR=${NAME_ARCH}?" -e "s?${CAR_WORK}?WORK=${OUTDIR}?" \ -e "s?${CAR_REFO}?REF_OD=${REFDAT}?" ./JOBS/job_${CONF[${ind}]}.ksh > ./JOBS/job_tmp.$$ mv ./JOBS/job_tmp.$$ ./JOBS/job_${CONF[${ind}]}.ksh && rm -f ./JOBS/job_tmp.$$ # II. Build configuration environment # ################################### (cd ../ ; ./use_cfg -n ${CONF[${ind}]} ;) echo ' ' echo ' >>>>>>>> Configuration directories have been built:' echo " ./config/${CONF[${ind}]}/WORK" echo " ./config/${CONF[${ind}]}/MY_SRC" echo ' ' cp ./CONFIG_FILES/AA_make* ../../${CONF[${ind}]}/. cp ./CONFIG_FILES/BB_make.ldef_${CONF[${ind}]} ../../${CONF[${ind}]}/scripts/BB_make.ldef # Configuration dependencies (cd ../../${CONF[${ind}]} ; ../NVTK/fait_AA_make ; ) echo ' ' echo " >>>>>>>> Dependencies file ./config/${CONF[${ind}]}/BB_make have been re-built" echo ' ' # III. Build output sub-directories # ################################# # Directories from where Jobs will be launched # and where results will be stored before analysed cd ${OUTDIR} if [ ! -d 'NEMO_VALID' ] ; then mkdir NEMO_VALID fi cd NEMO_VALID if [ ! -d W${CONF[${ind}]} ] ; then mkdir W${CONF[${ind}]} fi if [ ! -d W${CONF[${ind}]}/mon ] ; then mkdir W${CONF[${ind}]}/mon fi if [ ! -d W${CONF[${ind}]}/mon/LONG ] ; then mkdir W${CONF[${ind}]}/mon/LONG mkdir W${CONF[${ind}]}/mon/LONG/REF if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mon/LONG/RUN ; fi fi if [ ! -d W${CONF[${ind}]}/mon/GTIME ] ; then mkdir W${CONF[${ind}]}/mon/GTIME mkdir W${CONF[${ind}]}/mon/GTIME/REF if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mon/GTIME/RUN ; fi fi if [ ! -d W${CONF[${ind}]}/mon/1_SHORT ] ; then mkdir W${CONF[${ind}]}/mon/1_SHORT mkdir W${CONF[${ind}]}/mon/1_SHORT/REF if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mon/1_SHORT/RUN ; fi fi if [ ! -d W${CONF[${ind}]}/mon/2_SHORT ] ; then mkdir W${CONF[${ind}]}/mon/2_SHORT mkdir W${CONF[${ind}]}/mon/2_SHORT/REF if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mon/2_SHORT/RUN ; fi fi if [ ! -d W${CONF[${ind}]}/mpi ] ; then mkdir W${CONF[${ind}]}/mpi fi if [ ! -d W${CONF[${ind}]}/mpi/LONG ] ; then mkdir W${CONF[${ind}]}/mpi/LONG mkdir W${CONF[${ind}]}/mpi/LONG/REF if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mpi/LONG/RUN ; fi fi if [ ! -d W${CONF[${ind}]}/mpi/GTIME ] ; then mkdir W${CONF[${ind}]}/mpi/GTIME mkdir W${CONF[${ind}]}/mpi/GTIME/REF if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mpi/GTIME/RUN ; fi fi if [ ! -d W${CONF[${ind}]}/mpi/1_SHORT ] ; then mkdir W${CONF[${ind}]}/mpi/1_SHORT mkdir W${CONF[${ind}]}/mpi/1_SHORT/REF if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mpi/1_SHORT/RUN ; fi fi if [ ! -d W${CONF[${ind}]}/mpi/2_SHORT ] ; then mkdir W${CONF[${ind}]}/mpi/2_SHORT mkdir W${CONF[${ind}]}/mpi/2_SHORT/REF if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mpi/2_SHORT/RUN ; fi fi if [ ! -d W${CONF[${ind}]}/omp ] ; then mkdir W${CONF[${ind}]}/omp fi if [ ! -d W${CONF[${ind}]}/omp/LONG ] ; then mkdir W${CONF[${ind}]}/omp/LONG mkdir W${CONF[${ind}]}/omp/LONG/REF fi if [ ! -d W${CONF[${ind}]}/omp/GTIME ] ; then mkdir W${CONF[${ind}]}/omp/GTIME mkdir W${CONF[${ind}]}/omp/GTIME/REF fi if [ ! -d W${CONF[${ind}]}/omp/1_SHORT ] ; then mkdir W${CONF[${ind}]}/omp/1_SHORT mkdir W${CONF[${ind}]}/omp/1_SHORT/REF fi if [ ! -d W${CONF[${ind}]}/omp/2_SHORT ] ; then mkdir W${CONF[${ind}]}/omp/2_SHORT mkdir W${CONF[${ind}]}/omp/2_SHORT/REF fi echo ' ' echo ' >>>>>>>> The following sub-directories have been built ' echo ' under main directory '$( pwd ) echo ' They are dedicated to store results' tree W${CONF[${ind}]} echo ' ' cd ${LCLDIR} let ind=$ind+1 done # IV. Modify lance_batch.ksh & assessment.ksh scripts # ################################################### # Set following variables in lance_batch.ksh script # - IODIR = directory where to get ORCA2_LIM_nemo_v2.tar # - PRC = total number of processors which will be used CAR_INPU_tmp=$( grep 'IODIR=' ./JOBS/lance_batch.ksh ) CAR_INPU=`echo $CAR_INPU_tmp | cut -f 1 -d " " ` CAR_PROC_tmp=$( grep 'PRC=' ./JOBS/lance_batch.ksh ) CAR_PROC=`echo $CAR_PROC_tmp | cut -f 1 -d " " ` CAR_TARG_tmp=$( grep 'TARGET=' ./JOBS/lance_batch.ksh | head -1) CAR_TARG=`echo $CAR_TARG_tmp | cut -f 1 -d " " ` sed -e "s?${CAR_INPU}?IODIR=${INPUTD}?" -e "s?${CAR_PROC}?PRC=${DECOMP}?" \ -e "s/${CAR_TARG}/TARGET=${LOCTARG}/" ./JOBS/lance_batch.ksh > ./JOBS/lance_batch.$$ mv ./JOBS/lance_batch.$$ ./JOBS/lance_batch.ksh && rm -f ./JOBS/lance_batch.$$ chmod 744 ./JOBS/lance_batch.ksh # Set following variables in assessment.ksh script # - TARGET = the current plateform # - MAIL = your e-mail CAR_TARG_tmp=$( grep 'TARGET=' ./JOBS/assessment.ksh ) CAR_TARG=`echo $CAR_TARG_tmp | cut -f 1 -d " " ` CAR_MAIL_tmp=$( grep 'EMAIL=' ./JOBS/assessment.ksh ) CAR_MAIL=`echo $CAR_MAIL_tmp | cut -f 1 -d " " ` sed -e "s/${CAR_TARG}/TARGET=${LOCTARG}/" -e "s/${CAR_MAIL}/EMAIL='${MAIL}'/" \ ./JOBS/assessment.ksh > ./JOBS/assessment.$$ mv ./JOBS/assessment.$$ ./JOBS/assessment.ksh && rm -f ./JOBS/assessment.$$ chmod 744 ./JOBS/assessment.ksh # V. Preliminary compilations # ########################### # IOIPSL compilation ../../../util/ins_make -w IOIPSL if [ ${LOCTARG} = 'sx8brodie' ] ; then (cd ../../../modeles/IOIPSL/src ; sxgmake ;) else (cd ../../../modeles/IOIPSL/src ; gmake ;) fi echo ' ' echo ' >>>>>>>> IOIPSL Makefile and compilation done' echo ' ' # AGRIF compilation if [ ${UAGRIF} = 'yes' ] ; then ../../../util/ins_make -w AGRIF (cd ../../../modeles/AGRIF/ ; gmake ;) echo ' ' echo ' AGRIF Makefile and compilation done' echo ' ' fi echo ' ' echo ' #############################################################' echo ' >>>>>>>> Now set "by hand" the mpi domain decomposition indices jpni, ' echo ' jpnj & jpnij in par_oce.F90_keep files (keeping the "_keep" extension) ' echo " in coherence with the ${DECOMP} total number of processors you just set " echo ' Make this modification in the following directories: ' ind=0 while [ $ind -lt ${NBCFG} ] do echo " ../config/${CONF[${ind}]}/MY_SRC" let ind=$ind+1 done echo ' ###########################################################' echo ' '