[5586] | 1 | #!/bin/bash |
---|
| 2 | #set -vx |
---|
| 3 | # Default options |
---|
| 4 | # |
---|
| 5 | # |
---|
| 6 | # |
---|
| 7 | date |
---|
| 8 | #### 1 Set up the compiling options |
---|
| 9 | #### Define some directories |
---|
| 10 | submitdir=$( pwd ) |
---|
| 11 | modipsl=$submitdir/../.. |
---|
| 12 | arch_path=$submitdir/ARCH |
---|
| 13 | export ROOT=$modipsl/modeles/DYNAMICO |
---|
| 14 | |
---|
| 15 | #### Set default options |
---|
| 16 | # Optimization mode |
---|
| 17 | # optmode=prod/dev/debug |
---|
| 18 | optmode=prod |
---|
| 19 | # Resolution if compiling LMDZ in regular mode without DYNAMICO |
---|
| 20 | # Use for example following "./compile_icolmdzorinca.sh -regular_latlon 144x142x79" |
---|
[6083] | 21 | resol_atm="144x142x79" |
---|
[5586] | 22 | # fcm_arch |
---|
| 23 | fcm_arch=default |
---|
| 24 | # Default values to be overritten |
---|
| 25 | parallel=mpi_omp |
---|
| 26 | export fcm_arch parallel xios |
---|
| 27 | full_flag="" |
---|
| 28 | full_xios="" |
---|
| 29 | full_lmdz="" |
---|
| 30 | full_orch="" |
---|
| 31 | full_dyna="" |
---|
[6083] | 32 | #choose if we want to compile only grid ico, grid reg. If no for both of them, we will compile the two grids |
---|
[5958] | 33 | ico_only=no |
---|
| 34 | reg_only=no |
---|
[6083] | 35 | #choose if we want to compile only create_etat0_limit |
---|
| 36 | ce0l_only=no |
---|
| 37 | #choose chemistry inca configuration |
---|
[5586] | 38 | optchimie=GES |
---|
| 39 | |
---|
| 40 | # Default netcdf_lib is used for XIOS but can be change by argument |
---|
| 41 | netcdf_lib="" |
---|
[6209] | 42 | #radiative code compilation option |
---|
| 43 | rad="rrtm" |
---|
| 44 | opt_rad="" |
---|
[5586] | 45 | |
---|
| 46 | # Output text file for compilation of each component |
---|
| 47 | datestr=`LC_ALL=C date +"%Y%m%dT%H%M"` |
---|
| 48 | outfile=$submitdir/out_compile_icolmdzorinca.$datestr |
---|
| 49 | echo > $outfile |
---|
[5907] | 50 | echo; echo "Text output from compilation will be stored in file out_compile_icolmdzorinca.$datestr"; echo |
---|
[5586] | 51 | |
---|
| 52 | #### Read arguments |
---|
| 53 | # Loop over all arguments to modify default set up |
---|
| 54 | while (($# > 0)) ; do |
---|
| 55 | case $1 in |
---|
| 56 | "-h") cat <<end_help |
---|
| 57 | |
---|
| 58 | ######################################################################## |
---|
| 59 | # Usage of the script compile_icolmdzorinca.sh |
---|
| 60 | # |
---|
| 61 | ######################################################################## |
---|
| 62 | |
---|
| 63 | ./compile_config [Options] |
---|
| 64 | |
---|
[6209] | 65 | Options: -full, -regular_latlon, -debug, -dev, -prod(default) -opt_rad |
---|
[5586] | 66 | |
---|
[6083] | 67 | Example 1: Default compilation of [DYNAMICO-LMDZ-ORCHIDEE-INCA GES with XIOS and IOIPSL] and [LMDZ(144x142x79)-ORCHIDEE-INCA GES with XIOS and IOIPSL] and [create_etat0_limit] |
---|
[5586] | 68 | ./compile_icolmdzorinca.sh |
---|
| 69 | |
---|
| 70 | Example 2: Compile in debug mode |
---|
| 71 | ./compile_icolmdzorinca.sh -debug |
---|
| 72 | |
---|
| 73 | Example 3: Default compilation with full recompilation of all components |
---|
| 74 | ./compile_icolmdzorinca.sh -full |
---|
| 75 | |
---|
[6083] | 76 | Example 4: Define dimension for regular grid (default one is 144x142x79) |
---|
| 77 | The dimension can be changed to any other 3d dimension - in this example DYNAMICO is also compiled as default. |
---|
| 78 | ./compile_icolmdzorinca.sh -regular_latlon 256x256x79 |
---|
[5586] | 79 | |
---|
[6083] | 80 | Example 5: Compilation with a chosen chemistry, for example DUSS (default: GES) |
---|
[5586] | 81 | ./compile_icolmdzorinca.sh -chimie DUSS |
---|
| 82 | |
---|
[5958] | 83 | Example 6: Compile only ico grid |
---|
| 84 | ./compile_icolmdzorinca.sh -ico_only |
---|
[5586] | 85 | |
---|
[5958] | 86 | Example 7: Compile only reg grid |
---|
| 87 | ./compile_icolmdzorinca.sh -reg_only |
---|
| 88 | |
---|
[6083] | 89 | Example 8: compile only create_etat0_limit |
---|
| 90 | ./compile_icolmdzorinca.sh -ce0l_only |
---|
[5958] | 91 | |
---|
[6209] | 92 | Example 9: choose radiative scheme for LMDZ (oldrad/rrtm/ecrad) Default is rrtm |
---|
| 93 | ./compile_icolmdzorinca.sh -rad ecrad |
---|
| 94 | |
---|
[5586] | 95 | end_help |
---|
| 96 | exit;; |
---|
| 97 | |
---|
| 98 | "-parallel") parallel=$2 ; shift ; shift ;; |
---|
| 99 | "-arch") fcm_arch="$2" ; shift ; shift ;; |
---|
| 100 | "-xios") xios="$2" ; shift ; shift ;; |
---|
| 101 | "-debug") optmode=debug ; shift ;; |
---|
| 102 | "-dev") optmode=dev ; shift ;; |
---|
| 103 | "-prod") optmode=prod ; shift ;; |
---|
| 104 | "-regular_latlon") regular_latlon=yes ; resol_atm=$2 ; shift ; shift ;; |
---|
| 105 | "-full") full_flag="-full"; full_xios="--full" ; full_lmdz="-full" ; full_orch="-full" ; full_dyna="-full" ; shift ;; |
---|
| 106 | "-full_xios") full_xios="--full" ; shift ;; # Note only full_xios is using double dash: --full |
---|
| 107 | "-full_lmdz") full_lmdz="-full" ; shift ;; |
---|
| 108 | "-full_orch") full_orch="-full" ; shift ;; |
---|
| 109 | "-full_dyna") full_dyna="-full" ; shift ;; |
---|
[5958] | 110 | "-ico_only") ico_only=yes ; shift ;; |
---|
| 111 | "-reg_only") reg_only=yes ; shift ;; |
---|
[6185] | 112 | "-ce0l_only") ce0l_only=yes ; shift ;; |
---|
[5586] | 113 | "-netcdf_lib_seq") netcdf_lib="--netcdf_lib netcdf4_seq"; shift ;; |
---|
[6209] | 114 | "-rad") rad=$2; shift;; |
---|
[5586] | 115 | "-chimie") optchimie=$2; shift ; shift;; |
---|
| 116 | |
---|
| 117 | *) echo "unknown option "$1" , exiting..." ; exit |
---|
| 118 | esac |
---|
| 119 | done |
---|
| 120 | |
---|
| 121 | echo "Following options are set in current compiling:" >> $outfile |
---|
[6083] | 122 | echo " chemistry=${optchimie}">> $outfile |
---|
| 123 | echo " ico_only=${ico_only}, reg_only=${reg_only}, ce0l_only=${ce0l_only}" >> $outfile |
---|
| 124 | echo " regular_latlon=${resol_atm} (use to create executable on regular grid)" >> $outfile |
---|
[5586] | 125 | echo " optmode = $optmode, parallel = $parallel, fcm_arch = $fcm_arch " >> $outfile |
---|
| 126 | echo " full_flag=$full_flag, full_xios=$full_xios, full_lmdz=$full_lmdz, full_orch=$full_orch, full_dyna=$full_dyna" >> $outfile |
---|
| 127 | echo >> $outfile |
---|
| 128 | |
---|
[6083] | 129 | |
---|
[6209] | 130 | # check lmdz svn version |
---|
| 131 | lmdzsvn=`svnversion ../../modeles/LMDZ | egrep -o "[0-9]+" | awk 'NR==1'` |
---|
| 132 | |
---|
[5586] | 133 | ### Read host dependent default values |
---|
| 134 | ### These variables will not be changed if they were set as argument |
---|
| 135 | ###./host.sh $host |
---|
| 136 | # Later : Following lines should be set in host.sh file |
---|
| 137 | # begin host.sh |
---|
| 138 | if [ $fcm_arch == default ] ; then |
---|
| 139 | # Find out current host and source specific paths and commands for the host |
---|
| 140 | case $( hostname -s ) in |
---|
| 141 | jean-zay*) |
---|
| 142 | fcm_arch=X64_JEANZAY;; |
---|
| 143 | irene170|irene171|irene190|irene191|irene192|irene193) |
---|
| 144 | fcm_arch=X64_IRENE;; |
---|
| 145 | irene172|irene173|irene194|irene195) |
---|
| 146 | fcm_arch=X64_IRENE-AMD;; |
---|
| 147 | asterix*|obelix*) |
---|
| 148 | fcm_arch=ifort_LSCE |
---|
| 149 | if [ "${parallel}" == "mpi_omp" ] ; then |
---|
| 150 | echo "Warning!! Currently at Obelix hybrid mode is not possible." |
---|
| 151 | echo " Option -parallel mpi_omp is now changed to -parallel mpi" |
---|
| 152 | echo "" |
---|
| 153 | parallel=mpi |
---|
| 154 | else |
---|
| 155 | echo "You used -parallel" $parallel |
---|
| 156 | fi ;; |
---|
| 157 | ciclad*|climserv*|loholt*|camelot*) |
---|
| 158 | fcm_arch=ifort_CICLAD;; |
---|
| 159 | *) |
---|
| 160 | echo Current host is not known. You must use option -arch to specify which architecuture files to use. |
---|
| 161 | echo Exit now. |
---|
| 162 | exit |
---|
| 163 | esac |
---|
| 164 | fi |
---|
| 165 | |
---|
| 166 | # Set a link to arch.env if arch-${fcm_arch}.env file exist for current fcm_arch. |
---|
| 167 | # The link arch.env is also set in config.card and will be used by libIGCM to ensure the same running environnement. |
---|
| 168 | if [ -f ARCH/arch-${fcm_arch}.env ] ; then |
---|
| 169 | echo >> $outfile |
---|
| 170 | echo "The file ARCH/arch-${fcm_arch}.env will now be sourced with modules needed for compilation for all components." |
---|
| 171 | echo "Note that this new environement might be kept after compilation." |
---|
| 172 | echo "If this is the case, source again your personal environment after compilation." |
---|
| 173 | echo " Personal module list before sourcing of ARCH/arch.env file:" >> $outfile |
---|
| 174 | module list >> $outfile 2>&1 |
---|
| 175 | |
---|
| 176 | # Make a link to this file, to be used also in config.card |
---|
| 177 | rm -f ARCH/arch.env |
---|
| 178 | ln -s arch-${fcm_arch}.env ARCH/arch.env |
---|
| 179 | |
---|
| 180 | # Source the file |
---|
| 181 | source ARCH/arch.env >> $outfile 2>&1 |
---|
| 182 | |
---|
| 183 | echo >> $outfile |
---|
| 184 | echo " New module list after sourcing of ARCH/arch.env file:" >> $outfile |
---|
| 185 | module list >> $outfile 2>&1 |
---|
| 186 | fi |
---|
| 187 | |
---|
| 188 | #### 2 Do the compilation |
---|
| 189 | ## 2.1 Compile ioipsl |
---|
| 190 | cd $modipsl/modeles/IOIPSL |
---|
| 191 | echo; echo "NOW COMPILE IOIPSL" |
---|
| 192 | echo >> $outfile ; echo " NOW COMPILE IOIPSL" >> $outfile |
---|
| 193 | |
---|
| 194 | echo ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile |
---|
| 195 | ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile 2>&1 |
---|
| 196 | # Test if compiling succeded |
---|
| 197 | if [[ $? != 0 ]] ; then |
---|
| 198 | echo "THERE IS A PROBLEM IN IOIPSL COMPILATION - STOP" |
---|
| 199 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 200 | exit |
---|
| 201 | fi |
---|
| 202 | |
---|
| 203 | ## 2.2 Compile xios |
---|
| 204 | cd $modipsl/modeles/XIOS |
---|
| 205 | echo; echo "NOW COMPILE XIOS" |
---|
| 206 | echo >> $outfile ; echo " NOW COMPILE XIOS" >> $outfile |
---|
| 207 | echo ./make_xios --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios >> $outfile |
---|
| 208 | ./make_xios --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios >> $outfile 2>&1 |
---|
| 209 | # Test if compiling succeded |
---|
| 210 | if [[ $? != 0 ]] ; then |
---|
| 211 | echo "THERE IS A PROBLEM IN XIOS COMPILATION - STOP" |
---|
| 212 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 213 | exit |
---|
| 214 | fi |
---|
| 215 | # Move executables to modipsl/bin |
---|
| 216 | if [ -f $modipsl/modeles/XIOS/bin/xios_server.exe ] ; then |
---|
| 217 | mv $modipsl/modeles/XIOS/bin/xios_server.exe $modipsl/bin/xios_server_${optmode}.exe |
---|
| 218 | else |
---|
| 219 | echo "THERE IS A PROBLEM IN XIOS COMPILATION EXECUTABLE MISSING - STOP" |
---|
| 220 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 221 | exit |
---|
| 222 | fi |
---|
| 223 | |
---|
| 224 | |
---|
| 225 | ## 2.3 Compile orchidee |
---|
| 226 | cd $modipsl/modeles/ORCHIDEE |
---|
| 227 | echo; echo "NOW COMPILE ORCHIDEE" |
---|
| 228 | echo >> $outfile ; echo " NOW COMPILE ORCHIDEE" >> $outfile |
---|
| 229 | |
---|
| 230 | # Check if the compilation of ORCHIDEE was previsouly interupted prematured. |
---|
| 231 | # In that case, the files fcm.bld.lock exist. If the file exist, it is here removed to avoid makeorchidee_fcm |
---|
| 232 | # to ask question and wait for interactivly answer from the user. |
---|
| 233 | if [ -f build/fcm.bld.lock ] ; then |
---|
| 234 | echo >> $outfile |
---|
| 235 | echo " WARNING!! The file ORCHIDEE/build/fcm.bld.lock exist. " >> $outfile |
---|
| 236 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 237 | echo " The file will now be removed. " >> $outfile |
---|
| 238 | echo >> $outfile |
---|
| 239 | rm -f build/fcm.bld.lock |
---|
| 240 | fi |
---|
| 241 | |
---|
| 242 | echo ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch >> $outfile |
---|
| 243 | ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch >> $outfile 2>&1 |
---|
| 244 | # Test if compiling finished |
---|
| 245 | if [[ $? != 0 ]] ; then |
---|
| 246 | echo "THERE IS A PROBLEM IN ORCHIDEE COMPILATION - STOP" |
---|
| 247 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 248 | exit |
---|
| 249 | fi |
---|
| 250 | |
---|
| 251 | # If orchide driver executables have been compiled (option -driver), then rename executables to contain $optmode |
---|
| 252 | if [ -f $modipsl/bin/orchidee_ol ] ; then mv $modipsl/bin/orchidee_ol $modipsl/bin/orchidee_ol_${optmode} ; fi |
---|
| 253 | if [ -f $modipsl/bin/orchideedriver ] ; then mv $modipsl/bin/orchideedriver $modipsl/bin/orchideedriver_${optmode} ; fi |
---|
| 254 | |
---|
| 255 | |
---|
| 256 | ## ajout compile inca Anne |
---|
| 257 | cd $modipsl/modeles/INCA |
---|
[5705] | 258 | |
---|
| 259 | echo; echo "NOW COMPILE INCA ${optchimie}" |
---|
[5591] | 260 | echo ./makeinca_fcm -chimie ${optchimie} -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_flag >> $outfile |
---|
| 261 | ./makeinca_fcm -chimie ${optchimie} -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_flag >> $outfile 2>&1 |
---|
[5586] | 262 | |
---|
| 263 | # Test if compiling finished |
---|
| 264 | if [[ $? != 0 ]] ; then |
---|
| 265 | echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP" |
---|
| 266 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 267 | exit |
---|
| 268 | fi |
---|
| 269 | |
---|
| 270 | |
---|
| 271 | |
---|
| 272 | echo "Move inca.dat modipsl/bin" |
---|
| 273 | if [[ -f $modipsl/modeles/INCA/SIMULATIONS/${optchimie}/inca.dat ]] ; then |
---|
| 274 | mv $modipsl/modeles/INCA/SIMULATIONS/${optchimie}/inca.dat $modipsl/bin/inca_${optmode}_${optchimie}.dat ; |
---|
| 275 | else |
---|
| 276 | echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP" |
---|
| 277 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 278 | exit |
---|
| 279 | fi |
---|
| 280 | |
---|
[5705] | 281 | echo "Move tracer.def to modipsl/bin" |
---|
| 282 | if [[ -f $modipsl/modeles/INCA/tracer.def ]] ; then |
---|
| 283 | mv $modipsl/modeles/INCA/tracer.def $modipsl/bin/tracer_${optmode}_${optchimie}.def ; |
---|
| 284 | fi |
---|
[5586] | 285 | |
---|
| 286 | |
---|
| 287 | ## 2.4 Compile lmdz |
---|
| 288 | |
---|
[6083] | 289 | if [ $reg_only = no ] && [ $ce0l_only = no ]; then |
---|
[5586] | 290 | |
---|
[6083] | 291 | cd $modipsl/modeles/LMDZ |
---|
| 292 | |
---|
[5958] | 293 | # Compile LMDZ as library to couple to DYNAMICO |
---|
| 294 | echo; echo "NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO" |
---|
| 295 | echo >> $outfile ; echo " NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO" >> $outfile |
---|
[5586] | 296 | |
---|
[5958] | 297 | # Check if the compilation of LMDZ was previsouly interupted prematured. |
---|
| 298 | # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm |
---|
| 299 | # to ask question and wait for interactivly answer from the user. |
---|
| 300 | if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then |
---|
| 301 | echo >> $outfile |
---|
| 302 | echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. " >> $outfile |
---|
| 303 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 304 | echo " The files dimension.h and .lock will now be removed. " >> $outfile |
---|
| 305 | echo >> $outfile |
---|
| 306 | rm -f libf/grid/dimensions.h |
---|
| 307 | rm -f .lock |
---|
| 308 | fi |
---|
[5586] | 309 | |
---|
[5958] | 310 | echo ./makelmdz_fcm -p lmd -rrtm true -cosp true -$optmode -mem -parallel $parallel -libphy -v orchidee2.1 -chimie INCA -io xios -arch $fcm_arch -j 8 $full_lmdz >> $outfile |
---|
| 311 | ./makelmdz_fcm -p lmd -rrtm true -cosp true -$optmode -mem -parallel $parallel -libphy -v orchidee2.1 -chimie INCA -io xios -arch $fcm_arch -j 8 $full_lmdz >> $outfile 2>&1 |
---|
| 312 | # Test if compiling finished |
---|
| 313 | if [[ $? != 0 ]] ; then |
---|
| 314 | echo "THERE IS A PROBLEM IN LMDZ PHYSICS COMPILATION - STOP" |
---|
| 315 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 316 | exit |
---|
| 317 | fi |
---|
| 318 | |
---|
| 319 | |
---|
[5586] | 320 | ## 2.5 Compile DYNAMICO |
---|
[5958] | 321 | cd $modipsl/modeles/DYNAMICO |
---|
| 322 | echo; echo "NOW COMPILE DYNAMICO " |
---|
| 323 | echo >> $outfile ; echo " NOW COMPILE DYNAMICO" >> $outfile |
---|
[5586] | 324 | |
---|
[5958] | 325 | echo ./make_icosa -$optmode -parallel $parallel -external_ioipsl -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna >> $outfile |
---|
| 326 | ./make_icosa -$optmode -parallel $parallel -external_ioipsl -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna >> $outfile 2>&1 |
---|
| 327 | # Test if compiling finished |
---|
| 328 | if [[ $? != 0 ]] ; then |
---|
| 329 | echo "THERE IS A PROBLEM IN DYNAMICO COMPILATION - STOP" |
---|
| 330 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 331 | exit |
---|
| 332 | fi |
---|
[5586] | 333 | |
---|
[5958] | 334 | ## 2.6 Compile interface ICOSA_LMDZ |
---|
| 335 | cd $modipsl/modeles/ICOSA_LMDZ |
---|
| 336 | echo; echo "NOW COMPILE ICOSA_LMDZ " |
---|
| 337 | echo >> $outfile ; echo " NOW COMPILE ICOSA_LMDZ" >> $outfile |
---|
[5586] | 338 | |
---|
[5958] | 339 | echo ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel -with_orchidee -with_inca -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_dyna >> $outfile |
---|
| 340 | ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel -with_orchidee -with_inca -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_dyna >> $outfile 2>&1 |
---|
| 341 | # Test if compiling finished |
---|
| 342 | if [[ $? != 0 ]] ; then |
---|
| 343 | echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION - STOP" |
---|
| 344 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 345 | exit |
---|
| 346 | fi |
---|
| 347 | # Move executables to modipsl/bin |
---|
| 348 | if [ $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe ] ; then |
---|
| 349 | mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/icosa_lmdz_${optmode}_${optchimie}.exe |
---|
| 350 | else |
---|
| 351 | echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION EXECUTABLE MISSING - STOP" |
---|
| 352 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 353 | exit |
---|
| 354 | fi |
---|
| 355 | fi |
---|
[5586] | 356 | |
---|
| 357 | |
---|
| 358 | ## 2.7 Compile LMDZ for regular latlon configuration |
---|
| 359 | |
---|
[6209] | 360 | |
---|
| 361 | # Option de compilation du rayonnement : depend de $lmdzsvn ><= r4185 |
---|
| 362 | case $rad in |
---|
| 363 | oldrad) opt_rad="" ;; |
---|
| 364 | rrtm) if [ $lmdzsvn -le 4185 ] ; then opt_rad="-rrtm true" ; else opt_rad="-rad rrtm" ; fi ;; |
---|
| 365 | ecrad) opt_rad="-rad ecrad" ;; |
---|
| 366 | *) echo Only oldrad rrtm ecrad for rad option ; exit |
---|
| 367 | esac |
---|
| 368 | if [ $lmdzsvn -le 4185 -a $rad = "ecrad" ] ; then echo "ecrad only available for LMDZ rev starting with 4186 " ; exit ; fi |
---|
| 369 | |
---|
| 370 | |
---|
[6083] | 371 | # Find executable suffix |
---|
| 372 | if [ $parallel == seq ] || [ $parallel == none ] ; then |
---|
[6209] | 373 | |
---|
| 374 | if [ $lmdzsvn -ge 4186 ] ; then |
---|
| 375 | suffix=_${resol_atm}_phylmd_${rad}_seq_orch_inca.e |
---|
| 376 | else |
---|
| 377 | suffix=_${resol_atm}_phylmd_seq_orch_inca.e |
---|
| 378 | fi |
---|
[6083] | 379 | else |
---|
[6209] | 380 | if [ $lmdzsvn -ge 4186 ] ; then |
---|
| 381 | suffix=_${resol_atm}_phylmd_${rad}_para_mem_orch_inca.e |
---|
| 382 | else |
---|
| 383 | suffix=_${resol_atm}_phylmd_para_mem_orch_inca.e |
---|
| 384 | fi |
---|
[6083] | 385 | fi |
---|
| 386 | echo gcm suffix = $suffix |
---|
| 387 | |
---|
| 388 | if [ $ico_only = no ] && [ $ce0l_only = no ]; then |
---|
| 389 | |
---|
[5958] | 390 | cd $modipsl/modeles/LMDZ |
---|
| 391 | # Compile LMDZ regular lat-lon exectuable |
---|
| 392 | echo; echo "NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" |
---|
| 393 | echo >> $outfile ; echo " NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" >> $outfile |
---|
| 394 | |
---|
| 395 | # Check if the compilation of LMDZ was previsouly interupted prematured. |
---|
| 396 | # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm |
---|
| 397 | # to ask question and wait for interactivly answer from the user. |
---|
| 398 | if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then |
---|
| 399 | echo >> $outfile |
---|
| 400 | echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. " >> $outfile |
---|
| 401 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 402 | echo " The files dimension.h and .lock will now be removed. " >> $outfile |
---|
| 403 | echo >> $outfile |
---|
| 404 | rm -f libf/grid/dimensions.h |
---|
| 405 | rm -f .lock |
---|
| 406 | fi |
---|
[6209] | 407 | echo ./makelmdz_fcm -d ${resol_atm} -p lmd $opt_rad -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -chimie INCA -arch $fcm_arch -j 8 $full_lmdz gcm >> $outfile |
---|
| 408 | ./makelmdz_fcm -d ${resol_atm} -p lmd $opt_rad -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -chimie INCA -arch $fcm_arch -j 8 $full_lmdz gcm >> $outfile 2>&1 |
---|
[5958] | 409 | # Test if compiling finished |
---|
| 410 | if [[ $? != 0 ]] ; then |
---|
| 411 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
| 412 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 413 | exit |
---|
| 414 | fi |
---|
[6083] | 415 | |
---|
| 416 | |
---|
| 417 | # Move executables to modipsl/bin folder |
---|
| 418 | echo "Move gcm.e and ce0l executable to modipsl/bin" |
---|
| 419 | if [ -f $modipsl/modeles/LMDZ/bin/gcm${suffix} ] ; then |
---|
| 420 | mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${optmode}_${optchimie}.e |
---|
| 421 | else |
---|
| 422 | echo "ERROR gcm${suffix} executable does not exist." |
---|
| 423 | echo "THERE IS A PROBLEM TO MOVE LMDZ REGULAR LATLON EXECUTABLE - STOP" |
---|
| 424 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 425 | exit |
---|
| 426 | fi |
---|
| 427 | |
---|
[5958] | 428 | fi |
---|
[5586] | 429 | |
---|
| 430 | |
---|
[6185] | 431 | if [ $ce0l_only = yes ] || [ $ico_only = no ] && [ $reg_only = no ] ; then |
---|
[6083] | 432 | |
---|
| 433 | cd $modipsl/modeles/LMDZ |
---|
| 434 | |
---|
[5958] | 435 | # Compile ce0l initialization program for LMDZ regular lat-lon exectuable |
---|
| 436 | echo; echo "NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" |
---|
| 437 | echo >> $outfile ; echo " NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" >> $outfile |
---|
| 438 | |
---|
[6209] | 439 | echo ./makelmdz_fcm -d ${resol_atm} -p lmd ${opt_rad} -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -chimie INCA -arch $fcm_arch -j 8 $full_lmdz ce0l >> $outfile |
---|
| 440 | ./makelmdz_fcm -d ${resol_atm} -p lmd ${opt_rad} -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -chimie INCA -arch $fcm_arch -j 8 $full_lmdz ce0l >> $outfile 2>&1 |
---|
[5958] | 441 | # Test if compiling finished |
---|
| 442 | if [[ $? != 0 ]] ; then |
---|
| 443 | echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP" |
---|
| 444 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 445 | exit |
---|
| 446 | fi |
---|
[5586] | 447 | |
---|
[5961] | 448 | if [ -f $modipsl/modeles/LMDZ/bin/ce0l${suffix} ] ; then |
---|
| 449 | mv $modipsl/modeles/LMDZ/bin/ce0l${suffix} $modipsl/bin/ce0l_${resol_atm}_${optmode}_${optchimie}.e |
---|
| 450 | else |
---|
| 451 | echo "ERROR ce0l${suffix} executable does not exist." |
---|
| 452 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
| 453 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 454 | exit |
---|
| 455 | fi |
---|
[6083] | 456 | |
---|
| 457 | |
---|
[5961] | 458 | fi |
---|
[5907] | 459 | |
---|
[5586] | 460 | echo >>$outfile ; echo "ALL COMPILING FINISHED" >> $outfile |
---|
| 461 | echo ls -lrt modipsl/bin >> $outfile |
---|
| 462 | ls -lrt $modipsl/bin >> $outfile |
---|
| 463 | |
---|
| 464 | echo; echo "ALL COMPILING FINISHED" ; echo |
---|
| 465 | echo "Executables are found in modipsl/bin" |
---|
| 466 | echo "Check that executable names correspond with the name set in config.card before launching the job" |
---|
| 467 | echo ls -lrt modipsl/bin |
---|
| 468 | ls -lrt $modipsl/bin |
---|
| 469 | |
---|
| 470 | date |
---|
| 471 | exit |
---|
| 472 | |
---|
| 473 | |
---|