[5036] | 1 | #!/bin/bash |
---|
[4268] | 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 |
---|
[4268] | 13 | |
---|
[4278] | 14 | #### Set default options |
---|
[4268] | 15 | # Optimization mode |
---|
| 16 | # optmode=prod/dev/debug |
---|
| 17 | optmode=prod |
---|
[4411] | 18 | # Resolution of LMDZ in regular mode |
---|
[4469] | 19 | resol_atm=144x142x79 |
---|
[4643] | 20 | # Also compile ce0l subprogram to LMDZ (y/n) |
---|
| 21 | ce0l=y |
---|
[4411] | 22 | |
---|
[4268] | 23 | # fcm_arch |
---|
| 24 | fcm_arch=default |
---|
| 25 | # Default values to be overritten |
---|
[4339] | 26 | parallel=mpi_omp |
---|
[6112] | 27 | # Compilation with rrtm or ecrad radiative code (default rad=rrtm) |
---|
| 28 | rad=rrtm |
---|
[6243] | 29 | opt_rad="" |
---|
[6112] | 30 | # Compilation with Cosp (cosp=NONE/v1/v2 ; default=NONE) |
---|
| 31 | cosp=NONE |
---|
| 32 | |
---|
[6684] | 33 | # Compilation with flag StratAer (option -strataer) |
---|
| 34 | opt_strataer="" |
---|
| 35 | |
---|
[4268] | 36 | export fcm_arch parallel xios |
---|
| 37 | full_flag="" |
---|
[4643] | 38 | full_xios="" |
---|
| 39 | full_lmdz="" |
---|
| 40 | full_orch="" |
---|
| 41 | |
---|
[4391] | 42 | # Default netcdf_lib is used for XIOS but can be change by argument |
---|
| 43 | netcdf_lib="" |
---|
[4268] | 44 | |
---|
[6787] | 45 | ## Arguments in order to compress temporary files after compilation |
---|
| 46 | tar=no |
---|
| 47 | comp_tar=yes |
---|
| 48 | |
---|
[4408] | 49 | # Output text file for compilation of each component |
---|
[4622] | 50 | datestr=`LC_ALL=C date +"%Y%m%dT%H%M"` |
---|
| 51 | outfile=$submitdir/out_compile_lmdzor.$datestr |
---|
| 52 | echo > $outfile |
---|
[4643] | 53 | echo; echo "Text output from compilation will be stored in file out_compile_lmdzor.$datestr"; echo |
---|
[4408] | 54 | |
---|
[4278] | 55 | #### Read arguments |
---|
[4268] | 56 | # Loop over all arguments to modify default set up |
---|
| 57 | while (($# > 0)) ; do |
---|
[4278] | 58 | case $1 in |
---|
[4643] | 59 | "-h") cat <<end_help |
---|
[4268] | 60 | ######################################################################## |
---|
[4411] | 61 | # Usage of the script compile_lmdzor.sh |
---|
[4268] | 62 | # |
---|
| 63 | ######################################################################## |
---|
| 64 | |
---|
| 65 | ./compile_config [Options] |
---|
| 66 | |
---|
[6787] | 67 | Options: |
---|
| 68 | [-full]: full recompilation of all components |
---|
| 69 | [-debug], [-dev], [-prod](default): use compilation options for debug, dev or production mode, only one option can be used |
---|
| 70 | [-resol_atm]: set resolution of LMDZ in regular mode |
---|
| 71 | [-tar]: option to compress XIOS and/or LMDZ/libo repositories that takes many inodes without compilation |
---|
| 72 | [-comp_tar]: option to compile and compress XIOS and LMDZ/libo repositories if compilation succed (default option) |
---|
| 73 | [-notar]: do not compress XIOS and LMDZ/libo repositories |
---|
[4268] | 74 | |
---|
[4411] | 75 | Example 1: Default compilation of LMDZ-ORCHIDEE with XIOS and IOIPSL |
---|
| 76 | ./compile_lmdzor.sh |
---|
[4268] | 77 | |
---|
[4407] | 78 | Example 2: Compile in debug mode |
---|
[4411] | 79 | ./compile_lmdzor.sh -debug |
---|
[4407] | 80 | |
---|
| 81 | Example 3: Default compilation with full recompilation of all components |
---|
[4411] | 82 | ./compile_lmdzor.sh -full |
---|
[4268] | 83 | |
---|
[4411] | 84 | Example 4: Compilation of LMDZ in regular lat-lon for other dimensions (default: 144x142x79) |
---|
| 85 | The dimension can be changed to any other 3d dimension. |
---|
[4469] | 86 | ./compile_lmdzor.sh -resol_atm 96x95x79 |
---|
[4268] | 87 | |
---|
[6787] | 88 | Example 5: Compile without compressing XIOS and LMDZ/libo in tar files |
---|
| 89 | ./compile_lmdzor.sh -notar |
---|
| 90 | |
---|
[4643] | 91 | end_help |
---|
| 92 | exit;; |
---|
| 93 | "-parallel") parallel=$2 ; shift ; shift ;; |
---|
[6112] | 94 | "-rad") rad=$2 ; shift ; shift ;; |
---|
| 95 | "-cosp") cosp=$2 ; shift ; shift ;; |
---|
[6684] | 96 | "-strataer") opt_strataer="-strataer true" ; shift ; shift ;; |
---|
[4643] | 97 | "-arch") fcm_arch="$2" ; shift ; shift ;; |
---|
| 98 | "-xios") xios="$2" ; shift ; shift ;; |
---|
| 99 | "-debug") optmode=debug ; shift ;; |
---|
| 100 | "-dev") optmode=dev ; shift ;; |
---|
| 101 | "-prod") optmode=prod ; shift ;; |
---|
| 102 | "-resol_atm") resol_atm=$2 ; shift ; shift ;; |
---|
| 103 | "CE0L") ce0l=y ; shift ;; |
---|
| 104 | "-full") full_flag="-full"; full_xios="--full" ; full_lmdz="-full" ; full_orch="-full" ; shift ;; |
---|
| 105 | "-full_xios") full_xios="--full" ; shift ;; # Note only full_xios is using double dash: --full |
---|
| 106 | "-full_lmdz") full_lmdz="-full" ; shift ;; |
---|
| 107 | "-full_orch") full_orch="-full" ; shift ;; |
---|
| 108 | "-netcdf_lib_seq") netcdf_lib="--netcdf_lib netcdf4_seq"; shift ;; |
---|
[6787] | 109 | "-tar") tar=yes ; shift ;; |
---|
| 110 | "-comp_tar") comp_tar=yes ; shift ;; |
---|
| 111 | "-notar") comp_tar=no ; shift ;; |
---|
[4644] | 112 | *) echo "unknown option "$1" , exiting..." ; exit |
---|
[4278] | 113 | esac |
---|
| 114 | done |
---|
[4268] | 115 | |
---|
[4643] | 116 | echo "Following options are set in current compiling:" >> $outfile |
---|
| 117 | echo " resol_atm=${resol_atm}" >> $outfile |
---|
| 118 | echo " ce0l=${ce0l}" >> $outfile |
---|
| 119 | echo " optmode = $optmode, parallel = $parallel, fcm_arch = $fcm_arch " >> $outfile |
---|
| 120 | echo " full_flag=$full_flag, full_xios=$full_xios, full_lmdz=$full_lmdz, full_orch=$full_orch" >> $outfile |
---|
[6787] | 121 | echo " tar=$tar, comp_tar=$comp_tar" >> $outfile |
---|
[4408] | 122 | echo >> $outfile |
---|
[4268] | 123 | |
---|
[6112] | 124 | if [ $cosp = v1 ] ; then |
---|
| 125 | opt_cosp="-cosp true" |
---|
| 126 | elif [ $cosp = v2 ] ; then |
---|
| 127 | opt_cosp="-cospv2 true" |
---|
| 128 | else |
---|
| 129 | opt_cosp="" |
---|
| 130 | fi |
---|
[6787] | 131 | |
---|
| 132 | |
---|
| 133 | # Compress XIOS and LMDZ/libo without compiling if tar=yes |
---|
| 134 | if [ $tar == yes ] ; then |
---|
| 135 | echo "Option tar activated to compress XIOS and LMDZ/libo. No compilation will be done." |
---|
| 136 | echo >> $outfile |
---|
| 137 | echo "Option tar activated to compress XIOS and LMDZ/libo. No compilation will be done." >> $outfile |
---|
| 138 | if [[ -d $modipsl/modeles/XIOS ]] ; then |
---|
| 139 | echo " Now tar XIOS repository" |
---|
| 140 | echo " Now tar XIOS repository" >> $outfile |
---|
| 141 | tar -cf $modipsl/modeles/XIOS.tar $modipsl/modeles/XIOS |
---|
| 142 | rm -rf $modipsl/modeles/XIOS |
---|
| 143 | else |
---|
| 144 | echo " No XIOS repository to compress" |
---|
| 145 | echo " No XIOS repository to compress" >> $outfile |
---|
| 146 | fi |
---|
| 147 | |
---|
| 148 | if [[ -d $modipsl/modeles/LMDZ/libo ]] ; then |
---|
| 149 | echo "Now tar LMDZ/libo repository" |
---|
| 150 | echo "Now tar LMDZ/libo repository" >> $outfile |
---|
| 151 | tar -cf $modipsl/modeles/LMDZ/libo.tar $modipsl/modeles/LMDZ/libo |
---|
| 152 | rm -rf $modipsl/modeles/LMDZ/libo |
---|
| 153 | else |
---|
| 154 | echo " No LMDZ/libo repository to compress" |
---|
| 155 | echo " No LMDZ/libo repository to compress" >> $outfile |
---|
| 156 | fi |
---|
| 157 | |
---|
| 158 | echo "END OF SCRIPT" |
---|
| 159 | echo "END OF SCRIPT" >> $outfile |
---|
| 160 | exit |
---|
| 161 | fi |
---|
| 162 | |
---|
[4278] | 163 | ### Read host dependent default values |
---|
| 164 | ### These variables will not be changed if they were set as argument |
---|
[4268] | 165 | ###./host.sh $host |
---|
| 166 | # Later : Following lines should be set in host.sh file |
---|
| 167 | # begin host.sh |
---|
| 168 | if [ $fcm_arch == default ] ; then |
---|
[4278] | 169 | # Find out current host and source specific paths and commands for the host |
---|
| 170 | case $( hostname -s ) in |
---|
[4744] | 171 | jean-zay*) |
---|
[6629] | 172 | if [[ $( hostname -s ) != *"pp"* ]] ; then |
---|
| 173 | echo "Warning! You MUST compile on jean-zay-pp." |
---|
| 174 | echo "EXIT" |
---|
| 175 | exit |
---|
| 176 | else |
---|
| 177 | fcm_arch=X64_JEANZAY |
---|
| 178 | fi ;; |
---|
[5030] | 179 | irene170|irene171|irene190|irene191|irene192|irene193) |
---|
| 180 | fcm_arch=X64_IRENE;; |
---|
| 181 | irene172|irene173|irene194|irene195) |
---|
| 182 | fcm_arch=X64_IRENE-AMD;; |
---|
[4278] | 183 | asterix*|obelix*) |
---|
[6758] | 184 | fcm_arch=ifort_LSCE_2023 |
---|
[4973] | 185 | if [ "${parallel}" == "mpi_omp" ] ; then |
---|
[6112] | 186 | echo "Warning!! Currently at Obelix hybrid mode is not possible." |
---|
| 187 | echo " Option -parallel mpi_omp is now changed to -parallel mpi" |
---|
| 188 | echo "" |
---|
| 189 | parallel=mpi |
---|
[4973] | 190 | else |
---|
[6112] | 191 | echo "You used -parallel" $parallel |
---|
[4973] | 192 | fi ;; |
---|
[6261] | 193 | spirit*) |
---|
| 194 | fcm_arch=ifort_MESOIPSL;; |
---|
[4973] | 195 | ciclad*|climserv*|loholt*|camelot*) |
---|
[4391] | 196 | fcm_arch=ifort_CICLAD;; |
---|
[4278] | 197 | *) |
---|
[4391] | 198 | echo Current host is not known. You must use option -arch to specify which architecuture files to use. |
---|
[4278] | 199 | echo Exit now. |
---|
| 200 | exit |
---|
| 201 | esac |
---|
[4268] | 202 | fi |
---|
| 203 | |
---|
[4452] | 204 | # Set a link to arch.env if arch-${fcm_arch}.env file exist for current fcm_arch. |
---|
[4391] | 205 | # The link arch.env is also set in config.card and will be used by libIGCM to ensure the same running environnement. |
---|
| 206 | if [ -f ARCH/arch-${fcm_arch}.env ] ; then |
---|
[4408] | 207 | echo >> $outfile |
---|
[4932] | 208 | echo "The file ARCH/arch-${fcm_arch}.env will now be sourced with modules needed for compilation for all components." |
---|
[4470] | 209 | echo "Note that this new environement might be kept after compilation." |
---|
| 210 | echo "If this is the case, source again your personal environment after compilation. " |
---|
| 211 | echo " Personal module list before sourcing of ARCH/arch.env file:" >> $outfile |
---|
| 212 | module list >> $outfile 2>&1 |
---|
[6299] | 213 | # Get initial svn version |
---|
| 214 | svn_version=$(module list -t | grep subversion) |
---|
| 215 | |
---|
[4470] | 216 | # Make a link to this file, to be used also in config.card |
---|
[4391] | 217 | rm -f ARCH/arch.env |
---|
| 218 | ln -s arch-${fcm_arch}.env ARCH/arch.env |
---|
[4470] | 219 | |
---|
| 220 | # Source the file |
---|
| 221 | source ARCH/arch.env >> $outfile 2>&1 |
---|
[6299] | 222 | if [ X$svn_version != X ] ; then |
---|
| 223 | # Put back initial version of svn |
---|
| 224 | module load ${svn_version} |
---|
| 225 | fi |
---|
| 226 | |
---|
[4470] | 227 | echo >> $outfile |
---|
| 228 | echo " New module list after sourcing of ARCH/arch.env file:" >> $outfile |
---|
| 229 | module list >> $outfile 2>&1 |
---|
[4391] | 230 | fi |
---|
| 231 | |
---|
[6787] | 232 | |
---|
[4268] | 233 | #### 2 Do the compilation |
---|
| 234 | ## 2.1 Compile ioipsl |
---|
| 235 | cd $modipsl/modeles/IOIPSL |
---|
[4278] | 236 | echo; echo "NOW COMPILE IOIPSL" |
---|
[4408] | 237 | echo >> $outfile ; echo " NOW COMPILE IOIPSL" >> $outfile |
---|
| 238 | |
---|
[4411] | 239 | # Check if compilation with fcm is included in IOIPSL |
---|
| 240 | if [ ! -f makeioipsl_fcm ] ; then |
---|
| 241 | echo "The file makeiopsl_fcm do not exist. Probably this is not the right version of IOIPSL." |
---|
| 242 | echo "Version of IOIPSL with fcm compilation is needed to compile with this script. Stop now." |
---|
| 243 | exit |
---|
| 244 | fi |
---|
| 245 | |
---|
[4940] | 246 | echo ./makeioipsl_fcm -$optmode -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile |
---|
| 247 | ./makeioipsl_fcm -$optmode -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile 2>&1 |
---|
[4268] | 248 | # Test if compiling succeded |
---|
| 249 | if [[ $? != 0 ]] ; then |
---|
[4278] | 250 | echo "THERE IS A PROBLEM IN IOIPSL COMPILATION - STOP" |
---|
| 251 | exit |
---|
[4268] | 252 | fi |
---|
| 253 | |
---|
| 254 | ## 2.2 Compile xios |
---|
[6787] | 255 | |
---|
| 256 | echo; echo "NOW DECOMPRESS XIOS IF NEEDED" |
---|
| 257 | # First check if XIOS needs to be decompressed |
---|
| 258 | # In priority search for modeles/XIOS_${optmode}.tar but if it doesn't exist take |
---|
| 259 | # the first which is found. |
---|
| 260 | if [[ -d $modipsl/modeles/XIOS ]] ; then |
---|
| 261 | echo "Found XIOS -> no decompress needs to be do"; >> $outfile |
---|
| 262 | elif [[ -f $modipsl/modeles/XIOS_${optmode}.tar ]]; then |
---|
| 263 | echo >> $outfile |
---|
| 264 | echo "Found XIOS_${optmode}.tar -> decompress repository" >> $outfile |
---|
| 265 | # Do not write "tar -xf ... -C $modipsl/modeles because it's modeles/XIOS that is compressed, not only XIOS/ |
---|
| 266 | tar -xf $modipsl/modeles/XIOS_${optmode}.tar -C $modipsl/ >> $outfile 2>&1 |
---|
| 267 | elif [[ -f $modipsl/modeles/XIOS_prod.tar ]]; then |
---|
| 268 | echo >> $outfile |
---|
| 269 | echo "Found XIOS_prod.tar -> decompress repository" >> $outfile |
---|
| 270 | tar -xf $modipsl/modeles/XIOS_prod.tar -C $modipsl/ >> $outfile 2>&1 |
---|
| 271 | elif [[ -f $modipsl/modeles/XIOS_debug.tar ]]; then |
---|
| 272 | echo >> $outfile |
---|
| 273 | echo "Found XIOS_debug.tar -> decompress repository" >> $outfile |
---|
| 274 | tar -xf $modipsl/modeles/XIOS_debug.tar -C $modipsl/ >> $outfile 2>&1 |
---|
| 275 | elif [[ -f $modipsl/modeles/XIOS_dev.tar ]]; then |
---|
| 276 | echo >> $outfile |
---|
| 277 | echo "Found XIOS_dev.tar -> decompress repository" >> $outfile |
---|
| 278 | tar -xf $modipsl/modeles/XIOS_dev.tar -C $modipsl/ >> $outfile 2>&1 |
---|
| 279 | elif [[ -f $modipsl/modeles/XIOS.tar ]]; then |
---|
| 280 | echo >> $outfile |
---|
| 281 | echo "Found XIOS.tar -> decompress repository" >> $outfile |
---|
| 282 | tar -xf $modipsl/modeles/XIOS.tar -C $modipsl/ >> $outfile 2>&1 |
---|
| 283 | else |
---|
| 284 | echo "XIOS source code was not found. Exit" |
---|
| 285 | echo "XIOS source code was not found. Exit" >> $outfile |
---|
| 286 | exit |
---|
| 287 | fi |
---|
| 288 | |
---|
| 289 | |
---|
[4268] | 290 | cd $modipsl/modeles/XIOS |
---|
[4278] | 291 | echo; echo "NOW COMPILE XIOS" |
---|
[4408] | 292 | echo >> $outfile ; echo " NOW COMPILE XIOS" >> $outfile |
---|
[4643] | 293 | echo ./make_xios --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios >> $outfile |
---|
| 294 | ./make_xios --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios >> $outfile 2>&1 |
---|
[4268] | 295 | # Test if compiling succeded |
---|
| 296 | if [[ $? != 0 ]] ; then |
---|
[4278] | 297 | echo "THERE IS A PROBLEM IN XIOS COMPILATION - STOP" |
---|
| 298 | exit |
---|
[4268] | 299 | fi |
---|
[4391] | 300 | # Move executables to modipsl/bin |
---|
[4457] | 301 | if [ -f $modipsl/modeles/XIOS/bin/xios_server.exe ] ; then |
---|
| 302 | mv $modipsl/modeles/XIOS/bin/xios_server.exe $modipsl/bin/xios_server_${optmode}.exe |
---|
[4391] | 303 | else |
---|
| 304 | echo "THERE IS A PROBLEM IN XIOS COMPILATION EXECUTABLE MISSING - STOP" |
---|
| 305 | exit |
---|
| 306 | fi |
---|
[4268] | 307 | |
---|
[4391] | 308 | |
---|
[4268] | 309 | ## 2.3 Compile orchidee |
---|
| 310 | cd $modipsl/modeles/ORCHIDEE |
---|
[4278] | 311 | echo; echo "NOW COMPILE ORCHIDEE" |
---|
[4408] | 312 | echo >> $outfile ; echo " NOW COMPILE ORCHIDEE" >> $outfile |
---|
| 313 | |
---|
[6112] | 314 | |
---|
[4973] | 315 | # Check if the compilation of ORCHIDEE was previsouly interupted prematured. |
---|
| 316 | # In that case, the files fcm.bld.lock exist. If the file exist, it is here removed to avoid makeorchidee_fcm |
---|
| 317 | # to ask question and wait for interactivly answer from the user. |
---|
| 318 | if [ -f build/fcm.bld.lock ] ; then |
---|
| 319 | echo >> $outfile |
---|
| 320 | echo " WARNING!! The file ORCHIDEE/build/fcm.bld.lock exist. " >> $outfile |
---|
| 321 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 322 | echo " The file will now be removed. " >> $outfile |
---|
| 323 | echo >> $outfile |
---|
| 324 | rm -f build/fcm.bld.lock |
---|
| 325 | fi |
---|
| 326 | |
---|
[4643] | 327 | echo ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch -driver >> $outfile |
---|
| 328 | ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch -driver >> $outfile 2>&1 |
---|
[4268] | 329 | # Test if compiling finished |
---|
| 330 | if [[ $? != 0 ]] ; then |
---|
| 331 | echo "THERE IS A PROBLEM IN ORCHIDEE COMPILATION - STOP" |
---|
| 332 | exit |
---|
| 333 | fi |
---|
| 334 | |
---|
[4643] | 335 | # Rename executables to contain $optmode |
---|
| 336 | if [ -f $modipsl/bin/orchidee_ol ] ; then mv $modipsl/bin/orchidee_ol $modipsl/bin/orchidee_ol_${optmode} ; fi |
---|
| 337 | if [ -f $modipsl/bin/orchideedriver ] ; then mv $modipsl/bin/orchideedriver $modipsl/bin/orchideedriver_${optmode} ; fi |
---|
[4408] | 338 | |
---|
[4643] | 339 | |
---|
[4411] | 340 | ## 2.4 Compile LMDZ for regular latlon configuration |
---|
[4469] | 341 | cd $modipsl/modeles/LMDZ |
---|
[6787] | 342 | |
---|
| 343 | # First check if LMDZ/libo exist or if it could be decompressed |
---|
| 344 | # If neither LMDZ/libo or LMDZ/libo_${optmode}.tar exists, nothing is done. It'll be created |
---|
| 345 | # during the compilation. |
---|
| 346 | echo; echo "NOW DECOMPRESS LMDZ/libo IF NEEDED" |
---|
| 347 | if [[ -d $modipsl/modeles/LMDZ/libo ]] ; then |
---|
| 348 | echo "Found LMDZ/libo -> no decompress needs to be done"; >> $outfile |
---|
| 349 | elif [[ -f $modipsl/modeles/LMDZ/libo_${optmode}.tar ]]; then |
---|
| 350 | echo "Found LMDZ/libo_${optmode}.tar -> decompress repository"; >> $outfile |
---|
| 351 | echo >> $outfile |
---|
| 352 | tar -xf $modipsl/modeles/LMDZ/libo_${optmode}.tar -C $modipsl/ >> $outfile 2>&1 |
---|
| 353 | fi |
---|
| 354 | |
---|
| 355 | |
---|
[4932] | 356 | # Compile LMDZ regular lat-lon executable |
---|
[4469] | 357 | echo; echo "NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" |
---|
| 358 | echo >> $outfile ; echo " NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" >> $outfile |
---|
[6243] | 359 | # Retrieve the final svn release number, needed for radiative code suffix of executable |
---|
| 360 | lmdzsvn=`svnversion . | egrep -o "[0-9]+" | awk 'NR==1'` |
---|
[6299] | 361 | echo >> $outfile ; echo "lmdzsvn= $lmdzsvn " >> $outfile |
---|
[4268] | 362 | |
---|
[4622] | 363 | # Check if the compilation of LMDZ was previsouly interupted prematured. |
---|
| 364 | # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm |
---|
| 365 | # to ask question and wait for interactivly answer from the user. |
---|
| 366 | if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then |
---|
| 367 | echo >> $outfile |
---|
| 368 | echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. " >> $outfile |
---|
| 369 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 370 | echo " The files dimension.h and .lock will now be removed. " >> $outfile |
---|
| 371 | echo >> $outfile |
---|
| 372 | rm -f libf/grid/dimensions.h |
---|
| 373 | rm -f .lock |
---|
| 374 | fi |
---|
| 375 | |
---|
[6243] | 376 | # Need to define the proper option for radiative code compilation. By default, we use rrtm |
---|
| 377 | case $rad in |
---|
| 378 | oldrad) opt_rad="" ;; |
---|
| 379 | rrtm) if [ $lmdzsvn -le 4185 ] ; then opt_rad="-rrtm true" ; else opt_rad="-rad rrtm" ; fi ;; |
---|
| 380 | ecrad) opt_rad="-rad ecrad" ;; |
---|
| 381 | *) echo Only oldrad rrtm ecrad for rad option ; exit |
---|
| 382 | esac |
---|
| 383 | |
---|
| 384 | if [ $lmdzsvn -le 4185 -a $rad = "ecrad" ] ; then echo "ecrad only available for LMDZ rev starting with 4186 " ; exit ; fi |
---|
| 385 | |
---|
| 386 | |
---|
[6684] | 387 | echo ./makelmdz_fcm -d ${resol_atm} -p lmd $opt_rad $opt_cosp $opt_strataer -$optmode -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm >> $outfile |
---|
| 388 | ./makelmdz_fcm -d ${resol_atm} -p lmd $opt_rad $opt_strataer -$optmode -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm >> $outfile 2>&1 |
---|
[4469] | 389 | # Test if compiling finished |
---|
| 390 | if [[ $? != 0 ]] ; then |
---|
| 391 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
| 392 | exit |
---|
| 393 | fi |
---|
[4408] | 394 | |
---|
[4643] | 395 | # Move executables to modipsl/bin folder |
---|
| 396 | echo >> $outfile |
---|
| 397 | echo "Move gcm.e executable to modipsl/bin" >> $outfile |
---|
| 398 | echo ls -lrt $modipsl/modeles/LMDZ/bin >> $outfile |
---|
| 399 | ls -lrt $modipsl/modeles/LMDZ/bin >> $outfile |
---|
| 400 | echo >> $outfile |
---|
[4278] | 401 | |
---|
[6243] | 402 | suffix=${resol_atm}_phylmd |
---|
| 403 | if [ $lmdzsvn -ge 4186 ] ; then suffix=${suffix}_${rad} ; fi |
---|
[4469] | 404 | if [ $parallel == seq ] || [ $parallel == none ] ; then |
---|
[6243] | 405 | suffix=_${suffix}_seq_orch.e |
---|
[4469] | 406 | else |
---|
[6243] | 407 | suffix=_${suffix}_para_mem_orch.e |
---|
[4469] | 408 | fi |
---|
[4643] | 409 | echo gcm suffix = $suffix |
---|
[4408] | 410 | |
---|
[4643] | 411 | if [ -f $modipsl/modeles/LMDZ/bin/gcm${suffix} ] ; then |
---|
| 412 | mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${optmode}.e |
---|
| 413 | else |
---|
| 414 | echo "ERROR gcm${suffix} executable does not exist." |
---|
| 415 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
| 416 | exit |
---|
| 417 | fi |
---|
[4278] | 418 | |
---|
[4268] | 419 | |
---|
[4643] | 420 | # Compile ce0l initialization program for LMDZ regular lat-lon exectuable |
---|
| 421 | if [ $ce0l == y ] ; then |
---|
| 422 | echo; echo "NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" |
---|
| 423 | echo >> $outfile ; echo " NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" >> $outfile |
---|
| 424 | |
---|
[6243] | 425 | echo ./makelmdz_fcm -d ${resol_atm} -p lmd $opt_rad -$optmode -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile |
---|
| 426 | ./makelmdz_fcm -d ${resol_atm} -p lmd $opt_rad -$optmode -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile 2>&1 |
---|
[4643] | 427 | # Test if compiling finished |
---|
| 428 | if [[ $? != 0 ]] ; then |
---|
| 429 | echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP" |
---|
| 430 | exit |
---|
| 431 | fi |
---|
| 432 | |
---|
| 433 | |
---|
| 434 | # Move executables to modipsl/bin folder |
---|
| 435 | echo >> $outfile |
---|
| 436 | echo "Move ce0l.e executable to modipsl/bin" >> $outfile |
---|
| 437 | echo ls -lrt $modipsl/modeles/LMDZ/bin >> $outfile |
---|
| 438 | ls -lrt $modipsl/modeles/LMDZ/bin >> $outfile |
---|
| 439 | echo >> $outfile |
---|
[5122] | 440 | suffix=_${resol_atm}_phylmd_seq.e |
---|
[6243] | 441 | if [ $lmdzsvn -ge 4186 ] ; then suffix=_${resol_atm}_phylmd_${rad}_seq.e ; fi |
---|
[4643] | 442 | echo ce0l suffix = $suffix |
---|
| 443 | |
---|
| 444 | if [ -f $modipsl/modeles/LMDZ/bin/ce0l${suffix} ] ; then |
---|
| 445 | mv $modipsl/modeles/LMDZ/bin/ce0l${suffix} $modipsl/bin/ce0l_${resol_atm}_${optmode}.e |
---|
| 446 | else |
---|
| 447 | echo "ERROR ce0l${suffix} executable does not exist." |
---|
| 448 | echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP" |
---|
| 449 | exit |
---|
| 450 | fi |
---|
| 451 | fi |
---|
| 452 | |
---|
[6787] | 453 | # Compress XIOS and LMDZ/libo |
---|
| 454 | if [ $comp_tar == yes ] && [ -d $modipsl/modeles/XIOS ] ; then |
---|
| 455 | echo "Option comp_tar activated, now compress XIOS and LMDZ/libo" |
---|
| 456 | echo "Option comp_tar activated, now compress XIOS and LMDZ/libo" >> $outfile |
---|
| 457 | tar -cf $modipsl/modeles/XIOS_${optmode}.tar $modipsl/modeles/XIOS |
---|
| 458 | rm -rf $modipsl/modeles/XIOS |
---|
| 459 | tar -cf $modipsl/modeles/LMDZ/libo_${optmode}.tar $modipsl/modeles/LMDZ/libo |
---|
| 460 | rm -rf $modipsl/modeles/LMDZ/libo |
---|
| 461 | fi |
---|
[4643] | 462 | |
---|
[4408] | 463 | echo >>$outfile ; echo "ALL COMPILING FINISHED" >> $outfile |
---|
[4643] | 464 | echo ls -lrt modipsl/bin >> $outfile |
---|
| 465 | ls -lrt $modipsl/bin >> $outfile |
---|
[4278] | 466 | |
---|
[4643] | 467 | echo; echo "ALL COMPILING FINISHED" ; echo |
---|
| 468 | echo "Executables are found in modipsl/bin" |
---|
| 469 | echo "Check that executable names correspond with the name set in config.card before launching the job" |
---|
| 470 | echo ls -lrt modipsl/bin |
---|
| 471 | ls -lrt $modipsl/bin |
---|
| 472 | |
---|
[4409] | 473 | date |
---|
[4643] | 474 | |
---|
[4268] | 475 | exit |
---|