[695] | 1 | #!/bin/ksh |
---|
[1154] | 2 | # $Id$ |
---|
[695] | 3 | ###################################################### |
---|
| 4 | # Original : C. Talandier for ESOPA |
---|
| 5 | # Contact : opatlod@locean-ipsl.upmc.fr |
---|
| 6 | # |
---|
| 7 | # This script aims to (for each standard configuration) : |
---|
| 8 | # - I. Take into account specific files changes |
---|
| 9 | # - ./modipsl/util/ins_make |
---|
| 10 | # - ./modipsl/config/NAME_CONFIG/AA_make* |
---|
| 11 | # - ./modipsl/config/NAME_CONFIG/scripts/BB_make.ldef |
---|
| 12 | # - II. Build configuration's environment & dependencies |
---|
| 13 | # - ./modipsl/config/NAME_CONFIG/WORK |
---|
| 14 | # - ./modipsl/config/NAME_CONFIG/MY_SRC |
---|
| 15 | # - ./modipsl/config/NAME_CONFIG/scripts/BB_make |
---|
| 16 | # - III. Build results sub-directories in the OUTDIR |
---|
| 17 | # directory specified by user just below |
---|
| 18 | # NEMO_VALID/WNAME_CONFIG/ |
---|
| 19 | # |-- mon --> MONO run |
---|
| 20 | # | |-- 1_SHORT |
---|
| 21 | # | |-- 2_SHORT |
---|
| 22 | # | |-- LONG |
---|
| 23 | # | `-- GTIME |
---|
| 24 | # |-- mpi --> MPI run |
---|
| 25 | # | |-- 1_SHORT |
---|
| 26 | # | |-- 2_SHORT |
---|
| 27 | # | |-- LONG |
---|
| 28 | # | `-- GTIME |
---|
| 29 | # `-- omp --> Open-MP run |
---|
| 30 | # |-- 1_SHORT |
---|
| 31 | # |-- 2_SHORT |
---|
| 32 | # |-- LONG |
---|
| 33 | # `-- GTIME |
---|
| 34 | # |
---|
| 35 | # - IV. Modify lance_batch.ksh & assessment.ksh scripts |
---|
| 36 | # - V. Preliminary compilations |
---|
| 37 | ###################################################### |
---|
| 38 | |
---|
| 39 | #set -xv |
---|
| 40 | |
---|
| 41 | ########################################################## |
---|
| 42 | ##### Begin Users modifications |
---|
| 43 | ########################################################## |
---|
| 44 | # OUTDIR : working directory from which jobs will be launched |
---|
| 45 | # & results stored |
---|
| 46 | # INPUTD : directory where to get ORCA2_LIM_nemo_v2.tar |
---|
| 47 | # REFDAT : directory where to get results from reference tags |
---|
| 48 | # DECOMP : total number of processors which will be used |
---|
| 49 | # MAIL : give your e-mail |
---|
| 50 | # UAGRIF : one of the standard configurations is based on AGRIF yes/no |
---|
| 51 | ########################################################## |
---|
| 52 | OUTDIR=/Users/ctlod/WORK/AZE/modipsl/config |
---|
[795] | 53 | INPUTD=/u/rech/eee/reee831/IO_NEMO_ORCA2_LIM |
---|
| 54 | REFDAT=/u/rech/eee/reee831/NEMO_VALIDATION |
---|
[695] | 55 | DECOMP=8 |
---|
| 56 | MAIL="ctlod@locean-ipsl.upmc.fr" |
---|
| 57 | UAGRIF=yes |
---|
| 58 | ########################################################## |
---|
| 59 | ##### End Users modifications |
---|
| 60 | ########################################################## |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | # Standard configurations |
---|
[795] | 64 | NBCFG=4 |
---|
[695] | 65 | CONF[0]=ORCA2_LIM |
---|
| 66 | CONF[1]=GYRE |
---|
[795] | 67 | CONF[2]=GYRE_LOBSTER |
---|
| 68 | CONF[3]=ZAGRIF |
---|
[695] | 69 | LCLDIR=`pwd` |
---|
| 70 | |
---|
| 71 | # Use a modified modipsl script: ins_make |
---|
| 72 | # which allows to build Makefiles of a specific configuration |
---|
| 73 | # using the following syntax: ins_make -w NAME_CONF |
---|
| 74 | cp ./MODIPSL_FILES/ins_make ../../../util/. |
---|
| 75 | |
---|
| 76 | # Set following variable in AA_make.ldef script |
---|
| 77 | # - WWDIR = directory where to store results and jobs |
---|
| 78 | CAR_WORK_tmp=$( grep 'WWDIR=' ./CONFIG_FILES/AA_make.ldef ) |
---|
| 79 | CAR_WORK=`echo $CAR_WORK_tmp | cut -f 1 -d " " ` |
---|
| 80 | sed -e "s?${CAR_WORK}?WWDIR=${OUTDIR}?" ./CONFIG_FILES/AA_make.ldef > ./CONFIG_FILES/AA_make.ldef.$$ |
---|
| 81 | mv ./CONFIG_FILES/AA_make.ldef.$$ ./CONFIG_FILES/AA_make.ldef && rm -f ./CONFIG_FILES/AA_make.ldef.$$ |
---|
| 82 | |
---|
| 83 | # Get the current target name |
---|
| 84 | LOCTARG=`../../../util/w_i_h` |
---|
| 85 | |
---|
| 86 | # Loop over each standard configuration |
---|
| 87 | # ##################################### |
---|
| 88 | ind=0 |
---|
| 89 | while [ $ind -lt ${NBCFG} ] |
---|
| 90 | do |
---|
| 91 | # I. Take into account specific changes |
---|
| 92 | # ##################################### |
---|
| 93 | # Set following variables in job_NAME_CONF.ksh script |
---|
| 94 | # - MAINDIR = directory where to get namelist input files |
---|
| 95 | # - WORK = directory where to store results |
---|
| 96 | # - REF_OD = directory where Are stored results from previous tags |
---|
| 97 | cd ../../../.. ; NAME_ARCH=$( pwd ) ; |
---|
| 98 | cd ${LCLDIR} |
---|
| 99 | echo ${NAME_ARCH} |
---|
| 100 | CAR_MAIN_tmp=$( grep 'MAINDIR=' ./JOBS/job_${CONF[${ind}]}.ksh ) |
---|
| 101 | CAR_MAIN=`echo $CAR_MAIN_tmp | cut -f 1 -d " " ` |
---|
| 102 | CAR_WORK_tmp=$( grep 'WORK=' ./JOBS/job_${CONF[${ind}]}.ksh ) |
---|
| 103 | CAR_WORK=`echo $CAR_WORK_tmp | cut -f 1 -d " " ` |
---|
| 104 | CAR_REFO_tmp=$( grep 'REF_OD=' ./JOBS/job_${CONF[${ind}]}.ksh | head -1 ) |
---|
| 105 | CAR_REFO=`echo $CAR_REFO_tmp | cut -f 1 -d " " ` |
---|
| 106 | sed -e "s?${CAR_MAIN}?MAINDIR=${NAME_ARCH}?" -e "s?${CAR_WORK}?WORK=${OUTDIR}?" \ |
---|
| 107 | -e "s?${CAR_REFO}?REF_OD=${REFDAT}?" ./JOBS/job_${CONF[${ind}]}.ksh > ./JOBS/job_tmp.$$ |
---|
| 108 | mv ./JOBS/job_tmp.$$ ./JOBS/job_${CONF[${ind}]}.ksh && rm -f ./JOBS/job_tmp.$$ |
---|
| 109 | |
---|
| 110 | # II. Build configuration environment |
---|
| 111 | # ################################### |
---|
| 112 | (cd ../ ; ./use_cfg -n ${CONF[${ind}]} ;) |
---|
| 113 | echo ' ' |
---|
| 114 | echo ' >>>>>>>> Configuration directories have been built:' |
---|
| 115 | echo " ./config/${CONF[${ind}]}/WORK" |
---|
| 116 | echo " ./config/${CONF[${ind}]}/MY_SRC" |
---|
| 117 | echo ' ' |
---|
| 118 | |
---|
| 119 | cp ./CONFIG_FILES/AA_make* ../../${CONF[${ind}]}/. |
---|
| 120 | cp ./CONFIG_FILES/BB_make.ldef_${CONF[${ind}]} ../../${CONF[${ind}]}/scripts/BB_make.ldef |
---|
| 121 | |
---|
| 122 | # Configuration dependencies |
---|
[1140] | 123 | (cd ../../${CONF[${ind}]} ; ../NVTK/fait_AA_make ; ) |
---|
[695] | 124 | echo ' ' |
---|
| 125 | echo " >>>>>>>> Dependencies file ./config/${CONF[${ind}]}/BB_make have been re-built" |
---|
| 126 | echo ' ' |
---|
| 127 | |
---|
| 128 | # III. Build output sub-directories |
---|
| 129 | # ################################# |
---|
| 130 | # Directories from where Jobs will be launched |
---|
| 131 | # and where results will be stored before analysed |
---|
| 132 | cd ${OUTDIR} |
---|
| 133 | if [ ! -d 'NEMO_VALID' ] ; then |
---|
| 134 | mkdir NEMO_VALID |
---|
| 135 | fi |
---|
| 136 | cd NEMO_VALID |
---|
| 137 | if [ ! -d W${CONF[${ind}]} ] ; then |
---|
| 138 | mkdir W${CONF[${ind}]} |
---|
| 139 | fi |
---|
| 140 | if [ ! -d W${CONF[${ind}]}/mon ] ; then |
---|
| 141 | mkdir W${CONF[${ind}]}/mon |
---|
| 142 | fi |
---|
| 143 | if [ ! -d W${CONF[${ind}]}/mon/LONG ] ; then |
---|
| 144 | mkdir W${CONF[${ind}]}/mon/LONG |
---|
| 145 | mkdir W${CONF[${ind}]}/mon/LONG/REF |
---|
| 146 | if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mon/LONG/RUN ; fi |
---|
| 147 | fi |
---|
| 148 | if [ ! -d W${CONF[${ind}]}/mon/GTIME ] ; then |
---|
| 149 | mkdir W${CONF[${ind}]}/mon/GTIME |
---|
| 150 | mkdir W${CONF[${ind}]}/mon/GTIME/REF |
---|
| 151 | if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mon/GTIME/RUN ; fi |
---|
| 152 | fi |
---|
| 153 | if [ ! -d W${CONF[${ind}]}/mon/1_SHORT ] ; then |
---|
| 154 | mkdir W${CONF[${ind}]}/mon/1_SHORT |
---|
| 155 | mkdir W${CONF[${ind}]}/mon/1_SHORT/REF |
---|
| 156 | if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mon/1_SHORT/RUN ; fi |
---|
| 157 | fi |
---|
| 158 | if [ ! -d W${CONF[${ind}]}/mon/2_SHORT ] ; then |
---|
| 159 | mkdir W${CONF[${ind}]}/mon/2_SHORT |
---|
| 160 | mkdir W${CONF[${ind}]}/mon/2_SHORT/REF |
---|
| 161 | if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mon/2_SHORT/RUN ; fi |
---|
| 162 | fi |
---|
| 163 | if [ ! -d W${CONF[${ind}]}/mpi ] ; then |
---|
| 164 | mkdir W${CONF[${ind}]}/mpi |
---|
| 165 | fi |
---|
| 166 | if [ ! -d W${CONF[${ind}]}/mpi/LONG ] ; then |
---|
| 167 | mkdir W${CONF[${ind}]}/mpi/LONG |
---|
| 168 | mkdir W${CONF[${ind}]}/mpi/LONG/REF |
---|
| 169 | if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mpi/LONG/RUN ; fi |
---|
| 170 | fi |
---|
| 171 | if [ ! -d W${CONF[${ind}]}/mpi/GTIME ] ; then |
---|
| 172 | mkdir W${CONF[${ind}]}/mpi/GTIME |
---|
| 173 | mkdir W${CONF[${ind}]}/mpi/GTIME/REF |
---|
| 174 | if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mpi/GTIME/RUN ; fi |
---|
| 175 | fi |
---|
| 176 | if [ ! -d W${CONF[${ind}]}/mpi/1_SHORT ] ; then |
---|
| 177 | mkdir W${CONF[${ind}]}/mpi/1_SHORT |
---|
| 178 | mkdir W${CONF[${ind}]}/mpi/1_SHORT/REF |
---|
| 179 | if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mpi/1_SHORT/RUN ; fi |
---|
| 180 | fi |
---|
| 181 | if [ ! -d W${CONF[${ind}]}/mpi/2_SHORT ] ; then |
---|
| 182 | mkdir W${CONF[${ind}]}/mpi/2_SHORT |
---|
| 183 | mkdir W${CONF[${ind}]}/mpi/2_SHORT/REF |
---|
| 184 | if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mpi/2_SHORT/RUN ; fi |
---|
| 185 | fi |
---|
| 186 | if [ ! -d W${CONF[${ind}]}/omp ] ; then |
---|
| 187 | mkdir W${CONF[${ind}]}/omp |
---|
| 188 | fi |
---|
| 189 | if [ ! -d W${CONF[${ind}]}/omp/LONG ] ; then |
---|
| 190 | mkdir W${CONF[${ind}]}/omp/LONG |
---|
| 191 | mkdir W${CONF[${ind}]}/omp/LONG/REF |
---|
| 192 | fi |
---|
| 193 | if [ ! -d W${CONF[${ind}]}/omp/GTIME ] ; then |
---|
| 194 | mkdir W${CONF[${ind}]}/omp/GTIME |
---|
| 195 | mkdir W${CONF[${ind}]}/omp/GTIME/REF |
---|
| 196 | fi |
---|
| 197 | if [ ! -d W${CONF[${ind}]}/omp/1_SHORT ] ; then |
---|
| 198 | mkdir W${CONF[${ind}]}/omp/1_SHORT |
---|
| 199 | mkdir W${CONF[${ind}]}/omp/1_SHORT/REF |
---|
| 200 | fi |
---|
| 201 | if [ ! -d W${CONF[${ind}]}/omp/2_SHORT ] ; then |
---|
| 202 | mkdir W${CONF[${ind}]}/omp/2_SHORT |
---|
| 203 | mkdir W${CONF[${ind}]}/omp/2_SHORT/REF |
---|
| 204 | fi |
---|
| 205 | echo ' ' |
---|
| 206 | echo ' >>>>>>>> The following sub-directories have been built ' |
---|
| 207 | echo ' under main directory '$( pwd ) |
---|
| 208 | echo ' They are dedicated to store results' |
---|
| 209 | tree W${CONF[${ind}]} |
---|
| 210 | echo ' ' |
---|
| 211 | |
---|
| 212 | cd ${LCLDIR} |
---|
| 213 | |
---|
| 214 | let ind=$ind+1 |
---|
| 215 | done |
---|
| 216 | |
---|
| 217 | |
---|
| 218 | # IV. Modify lance_batch.ksh & assessment.ksh scripts |
---|
| 219 | # ################################################### |
---|
| 220 | # Set following variables in lance_batch.ksh script |
---|
| 221 | # - IODIR = directory where to get ORCA2_LIM_nemo_v2.tar |
---|
| 222 | # - PRC = total number of processors which will be used |
---|
| 223 | |
---|
| 224 | CAR_INPU_tmp=$( grep 'IODIR=' ./JOBS/lance_batch.ksh ) |
---|
| 225 | CAR_INPU=`echo $CAR_INPU_tmp | cut -f 1 -d " " ` |
---|
| 226 | CAR_PROC_tmp=$( grep 'PRC=' ./JOBS/lance_batch.ksh ) |
---|
| 227 | CAR_PROC=`echo $CAR_PROC_tmp | cut -f 1 -d " " ` |
---|
| 228 | CAR_TARG_tmp=$( grep 'TARGET=' ./JOBS/lance_batch.ksh | head -1) |
---|
| 229 | CAR_TARG=`echo $CAR_TARG_tmp | cut -f 1 -d " " ` |
---|
| 230 | sed -e "s?${CAR_INPU}?IODIR=${INPUTD}?" -e "s?${CAR_PROC}?PRC=${DECOMP}?" \ |
---|
| 231 | -e "s/${CAR_TARG}/TARGET=${LOCTARG}/" ./JOBS/lance_batch.ksh > ./JOBS/lance_batch.$$ |
---|
| 232 | mv ./JOBS/lance_batch.$$ ./JOBS/lance_batch.ksh && rm -f ./JOBS/lance_batch.$$ |
---|
| 233 | chmod 744 ./JOBS/lance_batch.ksh |
---|
| 234 | |
---|
| 235 | # Set following variables in assessment.ksh script |
---|
| 236 | # - TARGET = the current plateform |
---|
| 237 | # - MAIL = your e-mail |
---|
| 238 | CAR_TARG_tmp=$( grep 'TARGET=' ./JOBS/assessment.ksh ) |
---|
| 239 | CAR_TARG=`echo $CAR_TARG_tmp | cut -f 1 -d " " ` |
---|
| 240 | CAR_MAIL_tmp=$( grep 'EMAIL=' ./JOBS/assessment.ksh ) |
---|
| 241 | CAR_MAIL=`echo $CAR_MAIL_tmp | cut -f 1 -d " " ` |
---|
| 242 | sed -e "s/${CAR_TARG}/TARGET=${LOCTARG}/" -e "s/${CAR_MAIL}/EMAIL='${MAIL}'/" \ |
---|
| 243 | ./JOBS/assessment.ksh > ./JOBS/assessment.$$ |
---|
| 244 | mv ./JOBS/assessment.$$ ./JOBS/assessment.ksh && rm -f ./JOBS/assessment.$$ |
---|
| 245 | chmod 744 ./JOBS/assessment.ksh |
---|
| 246 | |
---|
| 247 | # V. Preliminary compilations |
---|
| 248 | # ########################### |
---|
| 249 | |
---|
| 250 | # IOIPSL compilation |
---|
| 251 | ../../../util/ins_make -w IOIPSL |
---|
| 252 | if [ ${LOCTARG} = 'sx8brodie' ] ; then |
---|
| 253 | (cd ../../../modeles/IOIPSL/src ; sxgmake ;) |
---|
| 254 | else |
---|
| 255 | (cd ../../../modeles/IOIPSL/src ; gmake ;) |
---|
| 256 | fi |
---|
| 257 | echo ' ' |
---|
| 258 | echo ' >>>>>>>> IOIPSL Makefile and compilation done' |
---|
| 259 | echo ' ' |
---|
| 260 | |
---|
| 261 | # AGRIF compilation |
---|
| 262 | if [ ${UAGRIF} = 'yes' ] ; then |
---|
| 263 | ../../../util/ins_make -w AGRIF |
---|
| 264 | (cd ../../../modeles/AGRIF/ ; gmake ;) |
---|
| 265 | echo ' ' |
---|
| 266 | echo ' AGRIF Makefile and compilation done' |
---|
| 267 | echo ' ' |
---|
| 268 | fi |
---|
| 269 | |
---|
| 270 | |
---|
| 271 | echo ' ' |
---|
| 272 | echo ' #############################################################' |
---|
| 273 | echo ' >>>>>>>> Now set "by hand" the mpi domain decomposition indices jpni, ' |
---|
| 274 | echo ' jpnj & jpnij in par_oce.F90_keep files (keeping the "_keep" extension) ' |
---|
| 275 | echo " in coherence with the ${DECOMP} total number of processors you just set " |
---|
| 276 | echo ' Make this modification in the following directories: ' |
---|
| 277 | ind=0 |
---|
| 278 | while [ $ind -lt ${NBCFG} ] |
---|
| 279 | do |
---|
| 280 | echo " ../config/${CONF[${ind}]}/MY_SRC" |
---|
| 281 | let ind=$ind+1 |
---|
| 282 | done |
---|
| 283 | echo ' ###########################################################' |
---|
| 284 | echo ' ' |
---|