[4268] | 1 | #!/bin/bash |
---|
| 2 | #set -vx |
---|
| 3 | # Default options |
---|
| 4 | # |
---|
| 5 | # |
---|
| 6 | # |
---|
[4409] | 7 | date |
---|
[4268] | 8 | #### 1 Set up the compiling options |
---|
| 9 | #### Define some directories |
---|
| 10 | submitdir=$( pwd ) |
---|
| 11 | modipsl=$submitdir/../.. |
---|
[4275] | 12 | arch_path=$submitdir/ARCH |
---|
[4611] | 13 | mysrc_path=$submitdir/SOURCES |
---|
[4268] | 14 | |
---|
[4278] | 15 | #### Set default options |
---|
[4471] | 16 | # Atmospheric resolution, for LMDZ/ORCHIDEE in regular mode |
---|
| 17 | resol_atm=144x142x79 |
---|
| 18 | # Oceanic resolution, for NEMO (ORCA2/ORCA1/ORCA025) |
---|
| 19 | resol_oce=ORCA1 |
---|
| 20 | # Version of ice model lim2/lim3 |
---|
[4611] | 21 | icemodel=lim3 |
---|
| 22 | # Coupled with ocean biogeochemistry (y/n) |
---|
| 23 | oceanbio=y |
---|
[4471] | 24 | # Version ESM CO2: CO2 interactif ocean/atmosphere (y/n) |
---|
| 25 | esmco2=n |
---|
[4707] | 26 | # Version ESM AER : Aer interactif chemistry / atmosphere (y/n) |
---|
| 27 | esmaer=n |
---|
[4641] | 28 | # Also compile ce0l subprogram to LMDZ (y/n) |
---|
| 29 | ce0l=n |
---|
[6210] | 30 | # choose radiative code compilation option |
---|
| 31 | rad=rrtm |
---|
| 32 | opt_rad="" |
---|
[4471] | 33 | |
---|
[4268] | 34 | # Optimization mode |
---|
| 35 | # optmode=prod/dev/debug |
---|
| 36 | optmode=prod |
---|
| 37 | # fcm_arch |
---|
| 38 | fcm_arch=default |
---|
| 39 | # Default values to be overritten |
---|
[4339] | 40 | parallel=mpi_omp |
---|
[4268] | 41 | export fcm_arch parallel xios |
---|
| 42 | full_flag="" |
---|
[4611] | 43 | full_nemo=n |
---|
[4707] | 44 | full_inca="" |
---|
[4641] | 45 | full_xios="" |
---|
| 46 | full_lmdz="" |
---|
| 47 | full_orch="" |
---|
[4268] | 48 | |
---|
[4641] | 49 | |
---|
| 50 | |
---|
[4408] | 51 | # Output text file for compilation of each component |
---|
[4622] | 52 | datestr=`LC_ALL=C date +"%Y%m%dT%H%M"` |
---|
| 53 | outfile=$submitdir/out_compile_ipslcm6.$datestr |
---|
| 54 | echo > $outfile |
---|
[4641] | 55 | echo; echo "Text output from compilation will be stored in file out_compile_ipslcm6.$datestr"; echo |
---|
[4408] | 56 | |
---|
[4278] | 57 | #### Read arguments |
---|
[4268] | 58 | # Loop over all arguments to modify default set up |
---|
| 59 | while (($# > 0)) ; do |
---|
[4278] | 60 | case $1 in |
---|
[4641] | 61 | "-h") cat <<end_help |
---|
[4268] | 62 | ######################################################################## |
---|
[4471] | 63 | # Usage of the script compile_ipslcm6.sh |
---|
[4268] | 64 | # |
---|
| 65 | ######################################################################## |
---|
| 66 | |
---|
[4471] | 67 | ./compile_ipslcm6.sh [Options] |
---|
[4268] | 68 | |
---|
| 69 | |
---|
[4611] | 70 | Options: [LR / VLR / MR1 / MR025] Model resolution, choose only one. Default: LR. |
---|
[4471] | 71 | [ESMCO2] Compile IPSLCM6 for CO2 interactif ocean/atmosphere. |
---|
[4707] | 72 | [ESMAER] Compile IPSLCM6 for AER interactif on atmosphere |
---|
[6309] | 73 | [ESMCO2AER] Compile IPSLCM6 for both interactive CO2 and AER, and also with transfer of species from PISCES to INCA. |
---|
[4471] | 74 | [-full] Full recompilation of all components. This option can be added to all other options. |
---|
[4611] | 75 | [-cleannemo] Full recompilation of NEMO component only. |
---|
[4471] | 76 | [-debug / -dev / -prod] Level of optimization. One of these can be added to all other compile options. Default: -prod. |
---|
[4268] | 77 | |
---|
[4407] | 78 | |
---|
[4471] | 79 | Example 1: Default compilation of IPSLCM6 for resoltion LR |
---|
| 80 | (Resolution atmos: 144x142x79, ocean: ORCA1) |
---|
| 81 | ./compile_ipslcm6.sh |
---|
[4268] | 82 | |
---|
[4471] | 83 | Example 2: Compilation of IPSLCM6 for resolution MR025 |
---|
| 84 | (atmos: 256x256x79, ocean: ORCA025, NOPISCES) |
---|
| 85 | ./compile_ipslcm6.sh MR025 |
---|
[4268] | 86 | |
---|
[4471] | 87 | Example 3: Compilation of IPSLCM6 for ESM CO2 |
---|
[4611] | 88 | ./compile_ipslcm6.sh ESMCO2 -cleannemo |
---|
[4471] | 89 | |
---|
| 90 | Example 4: Default resoltuion (LR) compiled in debug mode |
---|
| 91 | ./compile_ipslcm6.sh -debug |
---|
| 92 | |
---|
| 93 | Example 5: Default compilation with full recompilation of all components. No clean is needed. |
---|
| 94 | ./compile_ipslcm6.sh -full |
---|
| 95 | |
---|
| 96 | Example 6: Full recompilation of resolution MR05 in debug mode |
---|
| 97 | ./compile_ipslcm6.sh MR025 -debug -full |
---|
| 98 | |
---|
[6210] | 99 | Example 7: choose radiative schema for LMDZ (oldrad/rrtm/ecrad). Default is rrtm |
---|
| 100 | ./compile_ipslcm6.sh MR025 -rad ecrad |
---|
| 101 | |
---|
| 102 | |
---|
[4641] | 103 | end_help |
---|
| 104 | exit;; |
---|
| 105 | "VLR") resol_atm=96x95x39; resol_oce=ORCA2 ; icemodel=lim2; oceanbio=y; shift ;; |
---|
| 106 | "LR") resol_atm=144x142x79; resol_oce=ORCA1 ; icemodel=lim3; oceanbio=y; shift ;; |
---|
| 107 | "MR1") resol_atm=256x256x79; resol_oce=ORCA1 ; icemodel=lim3; oceanbio=y; shift ;; |
---|
| 108 | "MR025") resol_atm=256x256x79; resol_oce=ORCA025 ; icemodel=lim3; oceanbio=n; shift ;; |
---|
| 109 | "ESMCO2") esmco2=y; shift ;; |
---|
[4707] | 110 | "ESMAER") esmaer=y; shift ;; |
---|
[5644] | 111 | "ESMCO2AER") esmco2=y; esmaer=y; shift ;; |
---|
[4641] | 112 | "CE0L") ce0l=y ; shift ;; |
---|
[6211] | 113 | "-rad") rad=$2; shift ; shift;; |
---|
[4641] | 114 | "-parallel") parallel=$2 ; shift ; shift ;; |
---|
| 115 | "-arch") fcm_arch="$2" ; shift ; shift ;; |
---|
| 116 | "-debug") optmode=debug ; shift ;; |
---|
| 117 | "-dev") optmode=dev ; shift ;; |
---|
| 118 | "-prod") optmode=prod ; shift ;; |
---|
| 119 | "-full") full_flag="-full"; full_nemo=y ; full_xios="--full" ; full_lmdz="-full" ; full_orch="-full" ; shift ;; |
---|
| 120 | "-full_xios") full_xios="--full" ; shift ;; # Note only full_xios is using double dash: --full |
---|
| 121 | "-full_lmdz") full_lmdz="-full" ; shift ;; |
---|
| 122 | "-full_orch") full_orch="-full" ; shift ;; |
---|
| 123 | "-full_nemo") full_nemo=y ; shift ;; |
---|
[4707] | 124 | "-full_inca") full_inca="-clean"; shift ;; |
---|
[4641] | 125 | "-cleannemo") full_nemo=y ; shift ;; |
---|
[4644] | 126 | *) echo "unknown option "$1" , exiting..." ; exit |
---|
[4278] | 127 | esac |
---|
| 128 | done |
---|
[4268] | 129 | |
---|
[4641] | 130 | echo "Following options are set in current compiling:" >> $outfile |
---|
| 131 | echo " resol_atm=${resol_atm}, resol_oce=${resol_oce}, icemodel=${icemodel}, oceanbio=${oceanbio}" >> $outfile |
---|
[5018] | 132 | echo " esmco2=${esmco2}, esmaer=${esmaer}" >> $outfile |
---|
[4641] | 133 | echo " ce0l=${ce0l}" >> $outfile |
---|
| 134 | echo " optmode = $optmode, parallel = $parallel, fcm_arch = $fcm_arch " >> $outfile |
---|
| 135 | echo " full_flag=$full_flag, full_xios=$full_xios, full_lmdz=$full_lmdz, full_orch=$full_orch, full_nemo=$full_nemo," >> $outfile |
---|
[4408] | 136 | echo >> $outfile |
---|
[4268] | 137 | |
---|
[4278] | 138 | ### Read host dependent default values |
---|
| 139 | ### These variables will not be changed if they were set as argument |
---|
[4268] | 140 | ###./host.sh $host |
---|
| 141 | # Later : Following lines should be set in host.sh file |
---|
| 142 | # begin host.sh |
---|
| 143 | if [ $fcm_arch == default ] ; then |
---|
[4278] | 144 | # Find out current host and source specific paths and commands for the host |
---|
| 145 | case $( hostname -s ) in |
---|
[4932] | 146 | jean-zay*) |
---|
| 147 | fcm_arch=X64_JEANZAY;; |
---|
[5030] | 148 | irene170|irene171|irene190|irene191|irene192|irene193) |
---|
| 149 | fcm_arch=X64_IRENE;; |
---|
| 150 | irene172|irene173|irene194|irene195) |
---|
| 151 | fcm_arch=X64_IRENE-AMD;; |
---|
[4278] | 152 | asterix*|obelix*) |
---|
[4975] | 153 | fcm_arch=ifort_LSCE |
---|
| 154 | if [ "${parallel}" == "mpi_omp" ] ; then |
---|
| 155 | echo "Warning!! Currently at Obelix hybrid mode is not possible." |
---|
| 156 | echo " Option -parallel mpi_omp is now changed to -parallel mpi" |
---|
| 157 | echo "" |
---|
| 158 | parallel=mpi |
---|
| 159 | else |
---|
| 160 | echo "You used -parallel" $parallel |
---|
| 161 | fi ;; |
---|
| 162 | ciclad*|climserv*|loholt*|camelot*) |
---|
[4391] | 163 | fcm_arch=ifort_CICLAD;; |
---|
[4278] | 164 | *) |
---|
[4391] | 165 | echo Current host is not known. You must use option -arch to specify which architecuture files to use. |
---|
[4278] | 166 | echo Exit now. |
---|
| 167 | exit |
---|
| 168 | esac |
---|
[4268] | 169 | fi |
---|
| 170 | |
---|
[4452] | 171 | # Set a link to arch.env if arch-${fcm_arch}.env file exist for current fcm_arch. |
---|
[4391] | 172 | # The link arch.env is also set in config.card and will be used by libIGCM to ensure the same running environnement. |
---|
| 173 | if [ -f ARCH/arch-${fcm_arch}.env ] ; then |
---|
[4408] | 174 | echo >> $outfile |
---|
[4932] | 175 | echo "The file ARCH/arch-${fcm_arch}.env will now be sourced with modules needed for compilation for all components." |
---|
[4470] | 176 | echo "Note that this new environement might be kept after compilation." |
---|
| 177 | echo "If this is the case, source again your personal environment after compilation. " |
---|
| 178 | echo " Personal module list before sourcing of ARCH/arch.env file:" >> $outfile |
---|
| 179 | module list >> $outfile 2>&1 |
---|
[6299] | 180 | # Get initial svn version |
---|
| 181 | svn_version=$(module list -t | grep subversion) |
---|
[4470] | 182 | |
---|
| 183 | # Make a link to this file, to be used also in config.card |
---|
[4391] | 184 | rm -f ARCH/arch.env |
---|
| 185 | ln -s arch-${fcm_arch}.env ARCH/arch.env |
---|
[4470] | 186 | |
---|
| 187 | # Source the file |
---|
| 188 | source ARCH/arch.env >> $outfile 2>&1 |
---|
[6299] | 189 | if [ X$svn_version != X ] ; then |
---|
| 190 | # Put back initial version of svn |
---|
| 191 | module load ${svn_version} |
---|
| 192 | fi |
---|
[4470] | 193 | echo >> $outfile |
---|
| 194 | echo " New module list after sourcing of ARCH/arch.env file:" >> $outfile |
---|
| 195 | module list >> $outfile 2>&1 |
---|
[4391] | 196 | fi |
---|
| 197 | |
---|
[4268] | 198 | #### 2 Do the compilation |
---|
| 199 | ## 2.1 Compile ioipsl |
---|
| 200 | cd $modipsl/modeles/IOIPSL |
---|
[4278] | 201 | echo; echo "NOW COMPILE IOIPSL" |
---|
[4408] | 202 | echo >> $outfile ; echo " NOW COMPILE IOIPSL" >> $outfile |
---|
| 203 | |
---|
[4411] | 204 | # Check if compilation with fcm is included in IOIPSL |
---|
| 205 | if [ ! -f makeioipsl_fcm ] ; then |
---|
| 206 | echo "The file makeiopsl_fcm do not exist. Probably this is not the right version of IOIPSL." |
---|
| 207 | echo "Version of IOIPSL with fcm compilation is needed to compile with this script. Stop now." |
---|
| 208 | exit |
---|
| 209 | fi |
---|
| 210 | |
---|
[4408] | 211 | echo ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile |
---|
| 212 | ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile 2>&1 |
---|
[4268] | 213 | # Test if compiling succeded |
---|
| 214 | if [[ $? != 0 ]] ; then |
---|
[4278] | 215 | echo "THERE IS A PROBLEM IN IOIPSL COMPILATION - STOP" |
---|
| 216 | exit |
---|
[4268] | 217 | fi |
---|
| 218 | |
---|
[4611] | 219 | ## 2.2 Compile oasis3-mct |
---|
[4627] | 220 | cd $modipsl/oasis3-mct/util/make_dir |
---|
[4611] | 221 | echo; echo "NOW COMPILE OASIS3-MCT" |
---|
| 222 | echo >> $outfile ; echo " NOW COMPILE OASIS3-MCT" >> $outfile |
---|
[4627] | 223 | cp $mysrc_path/OASIS3-MCT/make_${fcm_arch} make.inc |
---|
[4611] | 224 | |
---|
[4627] | 225 | echo make -f TopMakefileOasis3 >> $outfile |
---|
| 226 | make -f TopMakefileOasis3 >> $outfile 2>&1 |
---|
| 227 | |
---|
| 228 | |
---|
[4611] | 229 | ## 2.3 Compile xios |
---|
[4268] | 230 | cd $modipsl/modeles/XIOS |
---|
[4278] | 231 | echo; echo "NOW COMPILE XIOS" |
---|
[4408] | 232 | echo >> $outfile ; echo " NOW COMPILE XIOS" >> $outfile |
---|
[4641] | 233 | echo ./make_xios --use_oasis oasis3_mct --$optmode --arch $fcm_arch --arch_path $arch_path --job 4 $full_xios >> $outfile |
---|
| 234 | ./make_xios --use_oasis oasis3_mct --$optmode --arch $fcm_arch --arch_path $arch_path --job 4 $full_xios >> $outfile 2>&1 |
---|
[4268] | 235 | # Test if compiling succeded |
---|
| 236 | if [[ $? != 0 ]] ; then |
---|
[4278] | 237 | echo "THERE IS A PROBLEM IN XIOS COMPILATION - STOP" |
---|
| 238 | exit |
---|
[4268] | 239 | fi |
---|
[4391] | 240 | # Move executables to modipsl/bin |
---|
[4457] | 241 | if [ -f $modipsl/modeles/XIOS/bin/xios_server.exe ] ; then |
---|
| 242 | mv $modipsl/modeles/XIOS/bin/xios_server.exe $modipsl/bin/xios_server_${optmode}.exe |
---|
[4391] | 243 | else |
---|
| 244 | echo "THERE IS A PROBLEM IN XIOS COMPILATION EXECUTABLE MISSING - STOP" |
---|
| 245 | exit |
---|
| 246 | fi |
---|
[4268] | 247 | |
---|
[4391] | 248 | |
---|
[4611] | 249 | ## 2.4 Compile orchidee |
---|
[4268] | 250 | cd $modipsl/modeles/ORCHIDEE |
---|
[4278] | 251 | echo; echo "NOW COMPILE ORCHIDEE" |
---|
[4408] | 252 | echo >> $outfile ; echo " NOW COMPILE ORCHIDEE" >> $outfile |
---|
| 253 | |
---|
[4975] | 254 | # Check if the compilation of ORCHIDEE was previsouly interupted prematured. |
---|
| 255 | # In that case, the files fcm.bld.lock exist. If the file exist, it is here removed to avoid makeorchidee_fcm |
---|
| 256 | # to ask question and wait for interactivly answer from the user. |
---|
| 257 | if [ -f build/fcm.bld.lock ] ; then |
---|
| 258 | echo >> $outfile |
---|
| 259 | echo " WARNING!! The file ORCHIDEE/build/fcm.bld.lock exist. " >> $outfile |
---|
| 260 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 261 | echo " The file will now be removed. " >> $outfile |
---|
| 262 | echo >> $outfile |
---|
| 263 | rm -f build/fcm.bld.lock |
---|
| 264 | fi |
---|
| 265 | |
---|
[4641] | 266 | echo ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch >> $outfile |
---|
| 267 | ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch >> $outfile 2>&1 |
---|
[4268] | 268 | # Test if compiling finished |
---|
| 269 | if [[ $? != 0 ]] ; then |
---|
| 270 | echo "THERE IS A PROBLEM IN ORCHIDEE COMPILATION - STOP" |
---|
| 271 | exit |
---|
| 272 | fi |
---|
| 273 | |
---|
[4408] | 274 | |
---|
[4611] | 275 | ## 2.5 Compile NEMO |
---|
| 276 | nemo_root=$modipsl/modeles/NEMOGCM/CONFIG |
---|
| 277 | if [ ${icemodel} == lim2 ] ; then |
---|
| 278 | addkeys="key_lim2_vp key_diahth key_oasis3" |
---|
| 279 | delkeys="key_nosignedzero key_mpp_rep" |
---|
| 280 | else |
---|
[6309] | 281 | addkeys="key_top key_pisces key_age key_cfc key_cpl_carbon_cycle key_gas key_oasis3 key_transm_ocninca" |
---|
[4611] | 282 | if [ ${oceanbio} == y ] ; then |
---|
| 283 | if [ ${esmco2} == y ] ; then |
---|
[6309] | 284 | if [ ${esmaer} == y ] ; then |
---|
| 285 | delkeys="key_nosignedzero key_mpp_rep" |
---|
| 286 | else |
---|
| 287 | delkeys="key_nosignedzero key_mpp_rep key_transm_ocninca" |
---|
| 288 | fi |
---|
[4611] | 289 | else |
---|
[6309] | 290 | delkeys="key_nosignedzero key_mpp_rep key_cpl_carbon_cycle key_gas key_transm_ocninca" |
---|
[4611] | 291 | fi |
---|
| 292 | else |
---|
[6309] | 293 | delkeys="key_nosignedzero key_mpp_rep key_top key_pisces key_cfc key_age key_cpl_carbon_cycle key_gas key_transm_ocninca" |
---|
[4611] | 294 | fi |
---|
| 295 | fi |
---|
| 296 | |
---|
| 297 | if [ ${oceanbio} == n ] ; then |
---|
| 298 | echo; echo "NOW COMPILE NEMO. Resolution = ${resol_oce} with icemodel ${icemodel} and without PISCES" |
---|
| 299 | echo >> $outfile ; echo " NOW COMPILE NEMO. Resolution = ${resol_oce} with icemodel ${icemodel} and without PISCES" >> $outfile |
---|
| 300 | else |
---|
| 301 | echo; echo "NOW COMPILE NEMO. Resolution = ${resol_oce} with icemodel ${icemodel} and PISCES" |
---|
| 302 | echo >> $outfile ; echo " NOW COMPILE NEMO. Resolution = ${resol_oce} with icemodel ${icemodel} and PISCES" >> $outfile |
---|
| 303 | fi |
---|
| 304 | echo >> $outfile ; echo cd $nemo_root >> $outfile |
---|
| 305 | echo >> $outfile ; echo cp $modipsl/config/IPSLCM6/SOURCES/NEMO/arch-${fcm_arch}.fcm ../ARCH/. >> $outfile |
---|
| 306 | echo >> $outfile |
---|
| 307 | |
---|
| 308 | cd $nemo_root ; cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm ../ARCH/. |
---|
| 309 | |
---|
| 310 | if [ ${resol_oce} == ORCA2 ] ; then cfg_wrk=ORCA2_LIM_PISCES ; fi |
---|
| 311 | if [ ${resol_oce} == ORCA1 ] ; then cfg_wrk=ORCA1_LIM3_PISCES ; fi |
---|
| 312 | if [ ${resol_oce} == ORCA025 ] ; then cfg_wrk=ORCA025_LIM3_PISCES ; fi |
---|
| 313 | |
---|
| 314 | echo cp $modipsl/config/IPSLCM6/SOURCES/NEMO/*.*90 $nemo_root/$cfg_wrk/MY_SRC/ >> $outfile |
---|
| 315 | echo >> $outfile |
---|
| 316 | cp $mysrc_path/NEMO/*.*90 $nemo_root/$cfg_wrk/MY_SRC/ |
---|
| 317 | |
---|
| 318 | if [ $full_nemo == y ] ; then |
---|
[4641] | 319 | # To make a full compilation, first make a clean to remove all files produced during previous compilation |
---|
[4611] | 320 | echo ./makenemo -m ${fcm_arch} -n $cfg_wrk clean >> $outfile |
---|
| 321 | echo >> $outfile |
---|
| 322 | ./makenemo -m ${fcm_arch} -n $cfg_wrk clean >> $outfile 2>&1 |
---|
| 323 | fi |
---|
[4627] | 324 | echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -j16 add_key "$addkeys" del_key "$delkeys" >> $outfile |
---|
| 325 | echo >> $outfile |
---|
| 326 | ./makenemo -m ${fcm_arch} -n $cfg_wrk -j16 add_key "$addkeys" del_key "$delkeys" >> $outfile 2>&1 |
---|
[4611] | 327 | |
---|
[4627] | 328 | |
---|
[4611] | 329 | # Test if compiling finished |
---|
| 330 | if [[ $? != 0 ]] ; then |
---|
| 331 | echo "THERE IS A PROBLEM IN NEMO COMPILATION - STOP" |
---|
| 332 | exit |
---|
| 333 | fi |
---|
| 334 | |
---|
[4627] | 335 | echo >> $outfile |
---|
[4629] | 336 | echo "Move nemo executable to modipsl/bin" >> $outfile |
---|
[4627] | 337 | echo ls -lrt $nemo_root/$cfg_wrk/BLD/bin >> $outfile |
---|
| 338 | ls -lrt $nemo_root/$cfg_wrk/BLD/bin >> $outfile |
---|
| 339 | echo >> $outfile |
---|
| 340 | |
---|
[4642] | 341 | if [ -f $nemo_root/$cfg_wrk/BLD/bin/nemo.exe ] ; then |
---|
[5644] | 342 | if [ ${esmco2} == y ] && [ ${esmaer} == n ] ; then |
---|
[4645] | 343 | mv $nemo_root/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa.ESMCO2_${resol_oce}_${optmode} |
---|
[5644] | 344 | elif [ ${esmco2} == y ] && [ ${esmaer} == y ] ; then |
---|
| 345 | mv $nemo_root/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa.ESMCO2AER_${resol_oce}_${optmode} |
---|
[4642] | 346 | else |
---|
[4645] | 347 | mv $nemo_root/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa_${resol_oce}_${optmode} |
---|
[4642] | 348 | fi |
---|
| 349 | fi |
---|
[4611] | 350 | |
---|
| 351 | |
---|
| 352 | ## 2.6 Compile LMDZ for regular latlon configuration |
---|
[4707] | 353 | # If necessary compile INCA modele with AER configuration |
---|
| 354 | if [ ${esmaer} == y ] ; then |
---|
| 355 | cd $modipsl/modeles/INCA |
---|
[6309] | 356 | #compile INCA regulat lat_lon chimie library |
---|
[4707] | 357 | echo; echo "NOW COMPILE INCA AER on resolution = ${resol_atm}" |
---|
[6309] | 358 | if [ ${esmco2} == y ] ; then |
---|
| 359 | echo ./makeinca_fcm -chimie AER -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_flag $full_inca -cplocninca >> $outfile |
---|
| 360 | ./makeinca_fcm -chimie AER -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_flag $full_inca -cplocninca >> $outfile 2>&1 |
---|
| 361 | else |
---|
| 362 | echo ./makeinca_fcm -chimie AER -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_flag $full_inca >> $outfile |
---|
| 363 | ./makeinca_fcm -chimie AER -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_flag $full_inca >> $outfile 2>&1 |
---|
| 364 | fi |
---|
[4707] | 365 | # Test if compiling finished |
---|
| 366 | if [[ $? != 0 ]] ; then |
---|
| 367 | echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP" |
---|
| 368 | exit |
---|
| 369 | fi |
---|
| 370 | |
---|
| 371 | echo "Move inca.dat modipsl/bin" |
---|
| 372 | if [[ -f $modipsl/modeles/INCA/SIMULATIONS/AER/inca.dat ]] ; then |
---|
| 373 | mv $modipsl/modeles/INCA/SIMULATIONS/AER/inca.dat $modipsl/bin/inca_${resol_atm}_${optmode}_AER.dat ; |
---|
| 374 | else |
---|
| 375 | echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP" |
---|
| 376 | exit |
---|
| 377 | fi |
---|
| 378 | |
---|
| 379 | fi |
---|
| 380 | |
---|
| 381 | |
---|
[4932] | 382 | # Compile LMDZ regular lat-lon executable |
---|
[4469] | 383 | cd $modipsl/modeles/LMDZ |
---|
| 384 | echo; echo "NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" |
---|
| 385 | echo >> $outfile ; echo " NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" >> $outfile |
---|
[6210] | 386 | # Retrieve the final svn release number, needed for radiative code suffix of executable |
---|
| 387 | lmdzsvn=`svnversion . | egrep -o "[0-9]+" | awk 'NR==1'` |
---|
[6299] | 388 | echo >> $outfile ; echo "lmdzsvn= $lmdzsvn " >> $outfile |
---|
[4268] | 389 | |
---|
[4622] | 390 | # Check if the compilation of LMDZ was previsouly interupted prematured. |
---|
| 391 | # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm |
---|
| 392 | # to ask question and wait for interactivly answer from the user. |
---|
| 393 | if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then |
---|
| 394 | echo >> $outfile |
---|
| 395 | echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. " >> $outfile |
---|
| 396 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 397 | echo " The files dimension.h and .lock will now be removed. " >> $outfile |
---|
| 398 | echo >> $outfile |
---|
| 399 | rm -f libf/grid/dimensions.h |
---|
| 400 | rm -f .lock |
---|
| 401 | fi |
---|
| 402 | |
---|
[6210] | 403 | # Need to define the proper option for radiative code compilation. By default, we use rrtm |
---|
| 404 | case $rad in |
---|
| 405 | oldrad) opt_rad="" ;; |
---|
| 406 | rrtm) if [ $lmdzsvn -le 4185 ] ; then opt_rad="-rrtm true" ; else opt_rad="-rad rrtm" ; fi ;; |
---|
| 407 | ecrad) opt_rad="-rad ecrad" ;; |
---|
| 408 | *) echo Only oldrad rrtm ecrad for rad option ; exit |
---|
| 409 | esac |
---|
| 410 | |
---|
[6212] | 411 | if [ $lmdzsvn -le 4185 -a $rad = "ecrad" ] ; then echo "ecrad only available for LMDZ rev starting with 4186 " ; exit ; fi |
---|
| 412 | |
---|
| 413 | |
---|
[5579] | 414 | if [ ${esmaer} == n ] ; then |
---|
[6210] | 415 | echo ./makelmdz_fcm -d ${resol_atm} -c OMCT -cosp true $opt_rad -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm >> $outfile |
---|
| 416 | ./makelmdz_fcm -d ${resol_atm} -c OMCT -cosp true $opt_rad -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm >> $outfile 2>&1 |
---|
[4707] | 417 | else |
---|
[5579] | 418 | #in esm aer case add chemistry option to lmdz compilation |
---|
[6309] | 419 | if [ ${esmco2} == y ] ; then |
---|
| 420 | echo ./makelmdz_fcm -d ${resol_atm} -c OMCT -cosp true -rrtm true -$optmode -mem -parallel $parallel -chimie INCA -cplocninca -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm >> $outfile |
---|
| 421 | ./makelmdz_fcm -d ${resol_atm} -c OMCT -cosp true -rrtm true -$optmode -mem -parallel $parallel -chimie INCA -cplocninca -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm >> $outfile 2>&1 |
---|
| 422 | else |
---|
| 423 | echo ./makelmdz_fcm -d ${resol_atm} -c OMCT -cosp true -rrtm true -$optmode -mem -parallel $parallel -chimie INCA -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm >> $outfile |
---|
| 424 | ./makelmdz_fcm -d ${resol_atm} -c OMCT -cosp true -rrtm true -$optmode -mem -parallel $parallel -chimie INCA -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm >> $outfile 2>&1 |
---|
| 425 | fi |
---|
[5579] | 426 | fi |
---|
| 427 | |
---|
[4469] | 428 | # Test if compiling finished |
---|
| 429 | if [[ $? != 0 ]] ; then |
---|
| 430 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
| 431 | exit |
---|
| 432 | fi |
---|
[4408] | 433 | |
---|
[6210] | 434 | |
---|
| 435 | |
---|
| 436 | |
---|
[4469] | 437 | # Move executables to modipsl/bin folder |
---|
[4627] | 438 | echo >> $outfile |
---|
[4641] | 439 | echo "Move gcm.e executable to modipsl/bin" >> $outfile |
---|
[4627] | 440 | echo ls -lrt $modipsl/modeles/LMDZ/bin >> $outfile |
---|
| 441 | ls -lrt $modipsl/modeles/LMDZ/bin >> $outfile |
---|
| 442 | echo >> $outfile |
---|
[6210] | 443 | |
---|
| 444 | |
---|
| 445 | suffix=_${resol_atm}_phylmd |
---|
| 446 | if [ $lmdzsvn -ge 4186 ] ; then suffix=${suffix}_${rad} ; fi |
---|
| 447 | suffix=${suffix}_para_mem_orch_couple |
---|
[4707] | 448 | if [ ${esmaer} == n ] ; then |
---|
[6210] | 449 | suffix=${suffix}.e |
---|
[4707] | 450 | else |
---|
[6210] | 451 | suffix=${suffix}_inca.e |
---|
[4707] | 452 | fi |
---|
[6210] | 453 | |
---|
[4643] | 454 | echo gcm suffix = $suffix |
---|
[4627] | 455 | |
---|
[4641] | 456 | if [ -f $modipsl/modeles/LMDZ/bin/gcm${suffix} ] ; then |
---|
[4707] | 457 | if [ ${esmaer} == n ] ; then |
---|
| 458 | mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${optmode}.e |
---|
| 459 | else |
---|
| 460 | mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${optmode}_AER.e |
---|
| 461 | fi |
---|
[4641] | 462 | else |
---|
| 463 | echo "ERROR gcm${suffix} executable does not exist." |
---|
| 464 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
| 465 | exit |
---|
| 466 | fi |
---|
[4278] | 467 | |
---|
[4268] | 468 | |
---|
[6210] | 469 | |
---|
| 470 | |
---|
| 471 | |
---|
[4641] | 472 | # Compile ce0l initialization program for LMDZ regular lat-lon exectuable |
---|
| 473 | if [ $ce0l == y ] ; then |
---|
| 474 | echo; echo "NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" |
---|
| 475 | echo >> $outfile ; echo " NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" >> $outfile |
---|
| 476 | |
---|
[6210] | 477 | echo ./makelmdz_fcm -d ${resol_atm} $opt_rad -$optmode -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile |
---|
| 478 | ./makelmdz_fcm -d ${resol_atm} $opt_rad -$optmode -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile 2>&1 |
---|
| 479 | |
---|
| 480 | # 1er aout - remove xios from ce0l compilation # |
---|
| 481 | # echo ./makelmdz_fcm -d ${resol_atm} $opt_rad -$optmode -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile |
---|
| 482 | # ./makelmdz_fcm -d ${resol_atm} $opt_rad -$optmode -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile 2>&1 |
---|
| 483 | |
---|
[4641] | 484 | # Test if compiling finished |
---|
| 485 | if [[ $? != 0 ]] ; then |
---|
| 486 | echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP" |
---|
| 487 | exit |
---|
| 488 | fi |
---|
| 489 | |
---|
| 490 | |
---|
| 491 | # Move executables to modipsl/bin folder |
---|
| 492 | echo >> $outfile |
---|
| 493 | echo "Move ce0l.e executable to modipsl/bin" >> $outfile |
---|
| 494 | echo ls -lrt $modipsl/modeles/LMDZ/bin >> $outfile |
---|
| 495 | ls -lrt $modipsl/modeles/LMDZ/bin >> $outfile |
---|
| 496 | echo >> $outfile |
---|
[6210] | 497 | |
---|
[5122] | 498 | suffix=_${resol_atm}_phylmd_seq.e |
---|
[6210] | 499 | if [ $lmdzsvn -ge 4186 ] ; then suffix=_${resol_atm}_phylmd_${rad}_seq.e ; fi |
---|
[4641] | 500 | echo ce0l suffix = $suffix |
---|
| 501 | |
---|
| 502 | if [ -f $modipsl/modeles/LMDZ/bin/ce0l${suffix} ] ; then |
---|
| 503 | mv $modipsl/modeles/LMDZ/bin/ce0l${suffix} $modipsl/bin/ce0l_${resol_atm}_${optmode}.e |
---|
| 504 | else |
---|
| 505 | echo "ERROR ce0l${suffix} executable does not exist." |
---|
| 506 | echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP" |
---|
| 507 | exit |
---|
| 508 | fi |
---|
| 509 | fi |
---|
| 510 | |
---|
[4408] | 511 | echo >>$outfile ; echo "ALL COMPILING FINISHED" >> $outfile |
---|
[4628] | 512 | echo ls -lrt modipsl/bin >> $outfile |
---|
| 513 | ls -lrt $modipsl/bin >> $outfile |
---|
[4278] | 514 | |
---|
[4628] | 515 | echo; echo "ALL COMPILING FINISHED" ; echo |
---|
| 516 | echo "Executables are found in modipsl/bin" |
---|
| 517 | echo "Check that executable names correspond with the name set in config.card before launching the job" |
---|
[4629] | 518 | echo ls -lrt modipsl/bin |
---|
| 519 | ls -lrt $modipsl/bin |
---|
[4628] | 520 | |
---|
[4409] | 521 | date |
---|
[4627] | 522 | |
---|
[4268] | 523 | exit |
---|
| 524 | |
---|
| 525 | |
---|