[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*) |
---|
[6629] | 147 | if [[ $( hostname -s ) != *"pp"* ]] ; then |
---|
| 148 | echo "Warning! You MUST compile on jean-zay-pp." |
---|
| 149 | echo "EXIT" |
---|
| 150 | exit |
---|
| 151 | else |
---|
| 152 | fcm_arch=X64_JEANZAY |
---|
| 153 | fi ;; |
---|
[5030] | 154 | irene170|irene171|irene190|irene191|irene192|irene193) |
---|
| 155 | fcm_arch=X64_IRENE;; |
---|
| 156 | irene172|irene173|irene194|irene195) |
---|
| 157 | fcm_arch=X64_IRENE-AMD;; |
---|
[4278] | 158 | asterix*|obelix*) |
---|
[4975] | 159 | fcm_arch=ifort_LSCE |
---|
| 160 | if [ "${parallel}" == "mpi_omp" ] ; then |
---|
| 161 | echo "Warning!! Currently at Obelix hybrid mode is not possible." |
---|
| 162 | echo " Option -parallel mpi_omp is now changed to -parallel mpi" |
---|
| 163 | echo "" |
---|
| 164 | parallel=mpi |
---|
| 165 | else |
---|
| 166 | echo "You used -parallel" $parallel |
---|
| 167 | fi ;; |
---|
| 168 | ciclad*|climserv*|loholt*|camelot*) |
---|
[4391] | 169 | fcm_arch=ifort_CICLAD;; |
---|
[4278] | 170 | *) |
---|
[4391] | 171 | echo Current host is not known. You must use option -arch to specify which architecuture files to use. |
---|
[4278] | 172 | echo Exit now. |
---|
| 173 | exit |
---|
| 174 | esac |
---|
[4268] | 175 | fi |
---|
| 176 | |
---|
[4452] | 177 | # Set a link to arch.env if arch-${fcm_arch}.env file exist for current fcm_arch. |
---|
[4391] | 178 | # The link arch.env is also set in config.card and will be used by libIGCM to ensure the same running environnement. |
---|
| 179 | if [ -f ARCH/arch-${fcm_arch}.env ] ; then |
---|
[4408] | 180 | echo >> $outfile |
---|
[4932] | 181 | echo "The file ARCH/arch-${fcm_arch}.env will now be sourced with modules needed for compilation for all components." |
---|
[4470] | 182 | echo "Note that this new environement might be kept after compilation." |
---|
| 183 | echo "If this is the case, source again your personal environment after compilation. " |
---|
| 184 | echo " Personal module list before sourcing of ARCH/arch.env file:" >> $outfile |
---|
| 185 | module list >> $outfile 2>&1 |
---|
[6299] | 186 | # Get initial svn version |
---|
| 187 | svn_version=$(module list -t | grep subversion) |
---|
[4470] | 188 | |
---|
| 189 | # Make a link to this file, to be used also in config.card |
---|
[4391] | 190 | rm -f ARCH/arch.env |
---|
| 191 | ln -s arch-${fcm_arch}.env ARCH/arch.env |
---|
[4470] | 192 | |
---|
| 193 | # Source the file |
---|
| 194 | source ARCH/arch.env >> $outfile 2>&1 |
---|
[6299] | 195 | if [ X$svn_version != X ] ; then |
---|
| 196 | # Put back initial version of svn |
---|
| 197 | module load ${svn_version} |
---|
| 198 | fi |
---|
[4470] | 199 | echo >> $outfile |
---|
| 200 | echo " New module list after sourcing of ARCH/arch.env file:" >> $outfile |
---|
| 201 | module list >> $outfile 2>&1 |
---|
[4391] | 202 | fi |
---|
| 203 | |
---|
[4268] | 204 | #### 2 Do the compilation |
---|
| 205 | ## 2.1 Compile ioipsl |
---|
| 206 | cd $modipsl/modeles/IOIPSL |
---|
[4278] | 207 | echo; echo "NOW COMPILE IOIPSL" |
---|
[4408] | 208 | echo >> $outfile ; echo " NOW COMPILE IOIPSL" >> $outfile |
---|
| 209 | |
---|
[4411] | 210 | # Check if compilation with fcm is included in IOIPSL |
---|
| 211 | if [ ! -f makeioipsl_fcm ] ; then |
---|
| 212 | echo "The file makeiopsl_fcm do not exist. Probably this is not the right version of IOIPSL." |
---|
| 213 | echo "Version of IOIPSL with fcm compilation is needed to compile with this script. Stop now." |
---|
| 214 | exit |
---|
| 215 | fi |
---|
| 216 | |
---|
[4408] | 217 | echo ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile |
---|
| 218 | ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile 2>&1 |
---|
[4268] | 219 | # Test if compiling succeded |
---|
| 220 | if [[ $? != 0 ]] ; then |
---|
[4278] | 221 | echo "THERE IS A PROBLEM IN IOIPSL COMPILATION - STOP" |
---|
| 222 | exit |
---|
[4268] | 223 | fi |
---|
| 224 | |
---|
[4611] | 225 | ## 2.2 Compile oasis3-mct |
---|
[4627] | 226 | cd $modipsl/oasis3-mct/util/make_dir |
---|
[4611] | 227 | echo; echo "NOW COMPILE OASIS3-MCT" |
---|
| 228 | echo >> $outfile ; echo " NOW COMPILE OASIS3-MCT" >> $outfile |
---|
[4627] | 229 | cp $mysrc_path/OASIS3-MCT/make_${fcm_arch} make.inc |
---|
[4611] | 230 | |
---|
[4627] | 231 | echo make -f TopMakefileOasis3 >> $outfile |
---|
| 232 | make -f TopMakefileOasis3 >> $outfile 2>&1 |
---|
| 233 | |
---|
| 234 | |
---|
[4611] | 235 | ## 2.3 Compile xios |
---|
[4268] | 236 | cd $modipsl/modeles/XIOS |
---|
[4278] | 237 | echo; echo "NOW COMPILE XIOS" |
---|
[4408] | 238 | echo >> $outfile ; echo " NOW COMPILE XIOS" >> $outfile |
---|
[4641] | 239 | echo ./make_xios --use_oasis oasis3_mct --$optmode --arch $fcm_arch --arch_path $arch_path --job 4 $full_xios >> $outfile |
---|
| 240 | ./make_xios --use_oasis oasis3_mct --$optmode --arch $fcm_arch --arch_path $arch_path --job 4 $full_xios >> $outfile 2>&1 |
---|
[4268] | 241 | # Test if compiling succeded |
---|
| 242 | if [[ $? != 0 ]] ; then |
---|
[4278] | 243 | echo "THERE IS A PROBLEM IN XIOS COMPILATION - STOP" |
---|
| 244 | exit |
---|
[4268] | 245 | fi |
---|
[4391] | 246 | # Move executables to modipsl/bin |
---|
[4457] | 247 | if [ -f $modipsl/modeles/XIOS/bin/xios_server.exe ] ; then |
---|
| 248 | mv $modipsl/modeles/XIOS/bin/xios_server.exe $modipsl/bin/xios_server_${optmode}.exe |
---|
[4391] | 249 | else |
---|
| 250 | echo "THERE IS A PROBLEM IN XIOS COMPILATION EXECUTABLE MISSING - STOP" |
---|
| 251 | exit |
---|
| 252 | fi |
---|
[4268] | 253 | |
---|
[4391] | 254 | |
---|
[4611] | 255 | ## 2.4 Compile orchidee |
---|
[4268] | 256 | cd $modipsl/modeles/ORCHIDEE |
---|
[4278] | 257 | echo; echo "NOW COMPILE ORCHIDEE" |
---|
[4408] | 258 | echo >> $outfile ; echo " NOW COMPILE ORCHIDEE" >> $outfile |
---|
| 259 | |
---|
[4975] | 260 | # Check if the compilation of ORCHIDEE was previsouly interupted prematured. |
---|
| 261 | # In that case, the files fcm.bld.lock exist. If the file exist, it is here removed to avoid makeorchidee_fcm |
---|
| 262 | # to ask question and wait for interactivly answer from the user. |
---|
| 263 | if [ -f build/fcm.bld.lock ] ; then |
---|
| 264 | echo >> $outfile |
---|
| 265 | echo " WARNING!! The file ORCHIDEE/build/fcm.bld.lock exist. " >> $outfile |
---|
| 266 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 267 | echo " The file will now be removed. " >> $outfile |
---|
| 268 | echo >> $outfile |
---|
| 269 | rm -f build/fcm.bld.lock |
---|
| 270 | fi |
---|
| 271 | |
---|
[4641] | 272 | echo ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch >> $outfile |
---|
| 273 | ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch >> $outfile 2>&1 |
---|
[4268] | 274 | # Test if compiling finished |
---|
| 275 | if [[ $? != 0 ]] ; then |
---|
| 276 | echo "THERE IS A PROBLEM IN ORCHIDEE COMPILATION - STOP" |
---|
| 277 | exit |
---|
| 278 | fi |
---|
| 279 | |
---|
[4408] | 280 | |
---|
[4611] | 281 | ## 2.5 Compile NEMO |
---|
| 282 | nemo_root=$modipsl/modeles/NEMOGCM/CONFIG |
---|
| 283 | if [ ${icemodel} == lim2 ] ; then |
---|
| 284 | addkeys="key_lim2_vp key_diahth key_oasis3" |
---|
| 285 | delkeys="key_nosignedzero key_mpp_rep" |
---|
| 286 | else |
---|
[6572] | 287 | addkeys="key_top key_pisces key_age key_cfc key_cpl_carbon_cycle key_gas key_oasis3" |
---|
[4611] | 288 | if [ ${oceanbio} == y ] ; then |
---|
[6578] | 289 | if [ ${esmco2} == y ] ; then |
---|
[6309] | 290 | delkeys="key_nosignedzero key_mpp_rep" |
---|
[4611] | 291 | else |
---|
[6572] | 292 | delkeys="key_nosignedzero key_mpp_rep key_cpl_carbon_cycle key_gas" |
---|
[4611] | 293 | fi |
---|
| 294 | else |
---|
[6572] | 295 | delkeys="key_nosignedzero key_mpp_rep key_top key_pisces key_cfc key_age key_cpl_carbon_cycle key_gas" |
---|
[4611] | 296 | fi |
---|
| 297 | fi |
---|
| 298 | |
---|
| 299 | if [ ${oceanbio} == n ] ; then |
---|
| 300 | echo; echo "NOW COMPILE NEMO. Resolution = ${resol_oce} with icemodel ${icemodel} and without PISCES" |
---|
| 301 | echo >> $outfile ; echo " NOW COMPILE NEMO. Resolution = ${resol_oce} with icemodel ${icemodel} and without PISCES" >> $outfile |
---|
| 302 | else |
---|
| 303 | echo; echo "NOW COMPILE NEMO. Resolution = ${resol_oce} with icemodel ${icemodel} and PISCES" |
---|
| 304 | echo >> $outfile ; echo " NOW COMPILE NEMO. Resolution = ${resol_oce} with icemodel ${icemodel} and PISCES" >> $outfile |
---|
| 305 | fi |
---|
| 306 | echo >> $outfile ; echo cd $nemo_root >> $outfile |
---|
| 307 | echo >> $outfile ; echo cp $modipsl/config/IPSLCM6/SOURCES/NEMO/arch-${fcm_arch}.fcm ../ARCH/. >> $outfile |
---|
| 308 | echo >> $outfile |
---|
| 309 | |
---|
| 310 | cd $nemo_root ; cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm ../ARCH/. |
---|
| 311 | |
---|
| 312 | if [ ${resol_oce} == ORCA2 ] ; then cfg_wrk=ORCA2_LIM_PISCES ; fi |
---|
| 313 | if [ ${resol_oce} == ORCA1 ] ; then cfg_wrk=ORCA1_LIM3_PISCES ; fi |
---|
| 314 | if [ ${resol_oce} == ORCA025 ] ; then cfg_wrk=ORCA025_LIM3_PISCES ; fi |
---|
| 315 | |
---|
| 316 | echo cp $modipsl/config/IPSLCM6/SOURCES/NEMO/*.*90 $nemo_root/$cfg_wrk/MY_SRC/ >> $outfile |
---|
| 317 | echo >> $outfile |
---|
| 318 | cp $mysrc_path/NEMO/*.*90 $nemo_root/$cfg_wrk/MY_SRC/ |
---|
| 319 | |
---|
| 320 | if [ $full_nemo == y ] ; then |
---|
[4641] | 321 | # To make a full compilation, first make a clean to remove all files produced during previous compilation |
---|
[4611] | 322 | echo ./makenemo -m ${fcm_arch} -n $cfg_wrk clean >> $outfile |
---|
| 323 | echo >> $outfile |
---|
| 324 | ./makenemo -m ${fcm_arch} -n $cfg_wrk clean >> $outfile 2>&1 |
---|
| 325 | fi |
---|
[4627] | 326 | echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -j16 add_key "$addkeys" del_key "$delkeys" >> $outfile |
---|
| 327 | echo >> $outfile |
---|
| 328 | ./makenemo -m ${fcm_arch} -n $cfg_wrk -j16 add_key "$addkeys" del_key "$delkeys" >> $outfile 2>&1 |
---|
[4611] | 329 | |
---|
[4627] | 330 | |
---|
[4611] | 331 | # Test if compiling finished |
---|
| 332 | if [[ $? != 0 ]] ; then |
---|
| 333 | echo "THERE IS A PROBLEM IN NEMO COMPILATION - STOP" |
---|
| 334 | exit |
---|
| 335 | fi |
---|
| 336 | |
---|
[4627] | 337 | echo >> $outfile |
---|
[4629] | 338 | echo "Move nemo executable to modipsl/bin" >> $outfile |
---|
[4627] | 339 | echo ls -lrt $nemo_root/$cfg_wrk/BLD/bin >> $outfile |
---|
| 340 | ls -lrt $nemo_root/$cfg_wrk/BLD/bin >> $outfile |
---|
| 341 | echo >> $outfile |
---|
| 342 | |
---|
[4642] | 343 | if [ -f $nemo_root/$cfg_wrk/BLD/bin/nemo.exe ] ; then |
---|
[5644] | 344 | if [ ${esmco2} == y ] && [ ${esmaer} == n ] ; then |
---|
[4645] | 345 | mv $nemo_root/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa.ESMCO2_${resol_oce}_${optmode} |
---|
[5644] | 346 | elif [ ${esmco2} == y ] && [ ${esmaer} == y ] ; then |
---|
| 347 | mv $nemo_root/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa.ESMCO2AER_${resol_oce}_${optmode} |
---|
[4642] | 348 | else |
---|
[4645] | 349 | mv $nemo_root/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa_${resol_oce}_${optmode} |
---|
[4642] | 350 | fi |
---|
| 351 | fi |
---|
[4611] | 352 | |
---|
| 353 | |
---|
| 354 | ## 2.6 Compile LMDZ for regular latlon configuration |
---|
[4707] | 355 | # If necessary compile INCA modele with AER configuration |
---|
| 356 | if [ ${esmaer} == y ] ; then |
---|
| 357 | cd $modipsl/modeles/INCA |
---|
[6309] | 358 | #compile INCA regulat lat_lon chimie library |
---|
[4707] | 359 | echo; echo "NOW COMPILE INCA AER on resolution = ${resol_atm}" |
---|
[6309] | 360 | if [ ${esmco2} == y ] ; then |
---|
| 361 | 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 |
---|
| 362 | ./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 |
---|
| 363 | else |
---|
| 364 | echo ./makeinca_fcm -chimie AER -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_flag $full_inca >> $outfile |
---|
| 365 | ./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 |
---|
| 366 | fi |
---|
[4707] | 367 | # Test if compiling finished |
---|
| 368 | if [[ $? != 0 ]] ; then |
---|
| 369 | echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP" |
---|
| 370 | exit |
---|
| 371 | fi |
---|
| 372 | |
---|
| 373 | echo "Move inca.dat modipsl/bin" |
---|
| 374 | if [[ -f $modipsl/modeles/INCA/SIMULATIONS/AER/inca.dat ]] ; then |
---|
| 375 | mv $modipsl/modeles/INCA/SIMULATIONS/AER/inca.dat $modipsl/bin/inca_${resol_atm}_${optmode}_AER.dat ; |
---|
| 376 | else |
---|
| 377 | echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP" |
---|
| 378 | exit |
---|
| 379 | fi |
---|
| 380 | |
---|
| 381 | fi |
---|
| 382 | |
---|
| 383 | |
---|
[4932] | 384 | # Compile LMDZ regular lat-lon executable |
---|
[4469] | 385 | cd $modipsl/modeles/LMDZ |
---|
| 386 | echo; echo "NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" |
---|
| 387 | echo >> $outfile ; echo " NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" >> $outfile |
---|
[6210] | 388 | # Retrieve the final svn release number, needed for radiative code suffix of executable |
---|
| 389 | lmdzsvn=`svnversion . | egrep -o "[0-9]+" | awk 'NR==1'` |
---|
[6299] | 390 | echo >> $outfile ; echo "lmdzsvn= $lmdzsvn " >> $outfile |
---|
[4268] | 391 | |
---|
[4622] | 392 | # Check if the compilation of LMDZ was previsouly interupted prematured. |
---|
| 393 | # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm |
---|
| 394 | # to ask question and wait for interactivly answer from the user. |
---|
| 395 | if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then |
---|
| 396 | echo >> $outfile |
---|
| 397 | echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. " >> $outfile |
---|
| 398 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 399 | echo " The files dimension.h and .lock will now be removed. " >> $outfile |
---|
| 400 | echo >> $outfile |
---|
| 401 | rm -f libf/grid/dimensions.h |
---|
| 402 | rm -f .lock |
---|
| 403 | fi |
---|
| 404 | |
---|
[6210] | 405 | # Need to define the proper option for radiative code compilation. By default, we use rrtm |
---|
| 406 | case $rad in |
---|
| 407 | oldrad) opt_rad="" ;; |
---|
| 408 | rrtm) if [ $lmdzsvn -le 4185 ] ; then opt_rad="-rrtm true" ; else opt_rad="-rad rrtm" ; fi ;; |
---|
| 409 | ecrad) opt_rad="-rad ecrad" ;; |
---|
| 410 | *) echo Only oldrad rrtm ecrad for rad option ; exit |
---|
| 411 | esac |
---|
| 412 | |
---|
[6212] | 413 | if [ $lmdzsvn -le 4185 -a $rad = "ecrad" ] ; then echo "ecrad only available for LMDZ rev starting with 4186 " ; exit ; fi |
---|
| 414 | |
---|
| 415 | |
---|
[5579] | 416 | if [ ${esmaer} == n ] ; then |
---|
[6210] | 417 | 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 |
---|
| 418 | ./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] | 419 | else |
---|
[5579] | 420 | #in esm aer case add chemistry option to lmdz compilation |
---|
[6309] | 421 | if [ ${esmco2} == y ] ; then |
---|
| 422 | 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 |
---|
| 423 | ./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 |
---|
| 424 | else |
---|
| 425 | 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 |
---|
| 426 | ./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 |
---|
| 427 | fi |
---|
[5579] | 428 | fi |
---|
| 429 | |
---|
[4469] | 430 | # Test if compiling finished |
---|
| 431 | if [[ $? != 0 ]] ; then |
---|
| 432 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
| 433 | exit |
---|
| 434 | fi |
---|
[4408] | 435 | |
---|
[6210] | 436 | |
---|
| 437 | |
---|
| 438 | |
---|
[4469] | 439 | # Move executables to modipsl/bin folder |
---|
[4627] | 440 | echo >> $outfile |
---|
[4641] | 441 | echo "Move gcm.e executable to modipsl/bin" >> $outfile |
---|
[4627] | 442 | echo ls -lrt $modipsl/modeles/LMDZ/bin >> $outfile |
---|
| 443 | ls -lrt $modipsl/modeles/LMDZ/bin >> $outfile |
---|
| 444 | echo >> $outfile |
---|
[6210] | 445 | |
---|
| 446 | |
---|
| 447 | suffix=_${resol_atm}_phylmd |
---|
| 448 | if [ $lmdzsvn -ge 4186 ] ; then suffix=${suffix}_${rad} ; fi |
---|
| 449 | suffix=${suffix}_para_mem_orch_couple |
---|
[4707] | 450 | if [ ${esmaer} == n ] ; then |
---|
[6210] | 451 | suffix=${suffix}.e |
---|
[4707] | 452 | else |
---|
[6210] | 453 | suffix=${suffix}_inca.e |
---|
[4707] | 454 | fi |
---|
[6210] | 455 | |
---|
[4643] | 456 | echo gcm suffix = $suffix |
---|
[4627] | 457 | |
---|
[4641] | 458 | if [ -f $modipsl/modeles/LMDZ/bin/gcm${suffix} ] ; then |
---|
[4707] | 459 | if [ ${esmaer} == n ] ; then |
---|
| 460 | mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${optmode}.e |
---|
| 461 | else |
---|
| 462 | mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${optmode}_AER.e |
---|
| 463 | fi |
---|
[4641] | 464 | else |
---|
| 465 | echo "ERROR gcm${suffix} executable does not exist." |
---|
| 466 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
| 467 | exit |
---|
| 468 | fi |
---|
[4278] | 469 | |
---|
[4268] | 470 | |
---|
[6210] | 471 | |
---|
| 472 | |
---|
| 473 | |
---|
[4641] | 474 | # Compile ce0l initialization program for LMDZ regular lat-lon exectuable |
---|
| 475 | if [ $ce0l == y ] ; then |
---|
| 476 | echo; echo "NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" |
---|
| 477 | echo >> $outfile ; echo " NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" >> $outfile |
---|
| 478 | |
---|
[6210] | 479 | echo ./makelmdz_fcm -d ${resol_atm} $opt_rad -$optmode -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile |
---|
| 480 | ./makelmdz_fcm -d ${resol_atm} $opt_rad -$optmode -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile 2>&1 |
---|
| 481 | |
---|
| 482 | # 1er aout - remove xios from ce0l compilation # |
---|
| 483 | # echo ./makelmdz_fcm -d ${resol_atm} $opt_rad -$optmode -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile |
---|
| 484 | # ./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 |
---|
| 485 | |
---|
[4641] | 486 | # Test if compiling finished |
---|
| 487 | if [[ $? != 0 ]] ; then |
---|
| 488 | echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP" |
---|
| 489 | exit |
---|
| 490 | fi |
---|
| 491 | |
---|
| 492 | |
---|
| 493 | # Move executables to modipsl/bin folder |
---|
| 494 | echo >> $outfile |
---|
| 495 | echo "Move ce0l.e executable to modipsl/bin" >> $outfile |
---|
| 496 | echo ls -lrt $modipsl/modeles/LMDZ/bin >> $outfile |
---|
| 497 | ls -lrt $modipsl/modeles/LMDZ/bin >> $outfile |
---|
| 498 | echo >> $outfile |
---|
[6210] | 499 | |
---|
[5122] | 500 | suffix=_${resol_atm}_phylmd_seq.e |
---|
[6210] | 501 | if [ $lmdzsvn -ge 4186 ] ; then suffix=_${resol_atm}_phylmd_${rad}_seq.e ; fi |
---|
[4641] | 502 | echo ce0l suffix = $suffix |
---|
| 503 | |
---|
| 504 | if [ -f $modipsl/modeles/LMDZ/bin/ce0l${suffix} ] ; then |
---|
| 505 | mv $modipsl/modeles/LMDZ/bin/ce0l${suffix} $modipsl/bin/ce0l_${resol_atm}_${optmode}.e |
---|
| 506 | else |
---|
| 507 | echo "ERROR ce0l${suffix} executable does not exist." |
---|
| 508 | echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP" |
---|
| 509 | exit |
---|
| 510 | fi |
---|
| 511 | fi |
---|
| 512 | |
---|
[4408] | 513 | echo >>$outfile ; echo "ALL COMPILING FINISHED" >> $outfile |
---|
[4628] | 514 | echo ls -lrt modipsl/bin >> $outfile |
---|
| 515 | ls -lrt $modipsl/bin >> $outfile |
---|
[4278] | 516 | |
---|
[4628] | 517 | echo; echo "ALL COMPILING FINISHED" ; echo |
---|
| 518 | echo "Executables are found in modipsl/bin" |
---|
| 519 | echo "Check that executable names correspond with the name set in config.card before launching the job" |
---|
[4629] | 520 | echo ls -lrt modipsl/bin |
---|
| 521 | ls -lrt $modipsl/bin |
---|
[4628] | 522 | |
---|
[4409] | 523 | date |
---|
[4627] | 524 | |
---|
[4268] | 525 | exit |
---|
| 526 | |
---|
| 527 | |
---|