[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*) |
---|
[6629] | 142 | if [[ $( hostname -s ) != *"pp"* ]] ; then |
---|
| 143 | echo "Warning! You MUST compile on jean-zay-pp." |
---|
| 144 | echo "EXIT" |
---|
| 145 | exit |
---|
| 146 | else |
---|
| 147 | fcm_arch=X64_JEANZAY |
---|
| 148 | fi ;; |
---|
[5586] | 149 | irene170|irene171|irene190|irene191|irene192|irene193) |
---|
| 150 | fcm_arch=X64_IRENE;; |
---|
| 151 | irene172|irene173|irene194|irene195) |
---|
| 152 | fcm_arch=X64_IRENE-AMD;; |
---|
| 153 | asterix*|obelix*) |
---|
| 154 | fcm_arch=ifort_LSCE |
---|
| 155 | if [ "${parallel}" == "mpi_omp" ] ; then |
---|
| 156 | echo "Warning!! Currently at Obelix hybrid mode is not possible." |
---|
| 157 | echo " Option -parallel mpi_omp is now changed to -parallel mpi" |
---|
| 158 | echo "" |
---|
| 159 | parallel=mpi |
---|
| 160 | else |
---|
| 161 | echo "You used -parallel" $parallel |
---|
| 162 | fi ;; |
---|
| 163 | ciclad*|climserv*|loholt*|camelot*) |
---|
| 164 | fcm_arch=ifort_CICLAD;; |
---|
| 165 | *) |
---|
| 166 | echo Current host is not known. You must use option -arch to specify which architecuture files to use. |
---|
| 167 | echo Exit now. |
---|
| 168 | exit |
---|
| 169 | esac |
---|
| 170 | fi |
---|
| 171 | |
---|
| 172 | # Set a link to arch.env if arch-${fcm_arch}.env file exist for current fcm_arch. |
---|
| 173 | # The link arch.env is also set in config.card and will be used by libIGCM to ensure the same running environnement. |
---|
| 174 | if [ -f ARCH/arch-${fcm_arch}.env ] ; then |
---|
| 175 | echo >> $outfile |
---|
| 176 | echo "The file ARCH/arch-${fcm_arch}.env will now be sourced with modules needed for compilation for all components." |
---|
| 177 | echo "Note that this new environement might be kept after compilation." |
---|
| 178 | echo "If this is the case, source again your personal environment after compilation." |
---|
| 179 | echo " Personal module list before sourcing of ARCH/arch.env file:" >> $outfile |
---|
| 180 | module list >> $outfile 2>&1 |
---|
[6308] | 181 | svn_version=$(module list -t | grep subversion) |
---|
[5586] | 182 | |
---|
| 183 | # Make a link to this file, to be used also in config.card |
---|
| 184 | rm -f ARCH/arch.env |
---|
| 185 | ln -s arch-${fcm_arch}.env ARCH/arch.env |
---|
| 186 | |
---|
| 187 | # Source the file |
---|
| 188 | source ARCH/arch.env >> $outfile 2>&1 |
---|
[6308] | 189 | if [ X$svn_version != X ] ; then |
---|
| 190 | module load ${svn_version} |
---|
| 191 | fi |
---|
[5586] | 192 | |
---|
| 193 | echo >> $outfile |
---|
| 194 | echo " New module list after sourcing of ARCH/arch.env file:" >> $outfile |
---|
| 195 | module list >> $outfile 2>&1 |
---|
| 196 | fi |
---|
| 197 | |
---|
| 198 | #### 2 Do the compilation |
---|
| 199 | ## 2.1 Compile ioipsl |
---|
| 200 | cd $modipsl/modeles/IOIPSL |
---|
| 201 | echo; echo "NOW COMPILE IOIPSL" |
---|
| 202 | echo >> $outfile ; echo " NOW COMPILE IOIPSL" >> $outfile |
---|
| 203 | |
---|
| 204 | echo ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile |
---|
| 205 | ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile 2>&1 |
---|
| 206 | # Test if compiling succeded |
---|
| 207 | if [[ $? != 0 ]] ; then |
---|
| 208 | echo "THERE IS A PROBLEM IN IOIPSL COMPILATION - STOP" |
---|
| 209 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 210 | exit |
---|
| 211 | fi |
---|
| 212 | |
---|
| 213 | ## 2.2 Compile xios |
---|
| 214 | cd $modipsl/modeles/XIOS |
---|
| 215 | echo; echo "NOW COMPILE XIOS" |
---|
| 216 | echo >> $outfile ; echo " NOW COMPILE XIOS" >> $outfile |
---|
| 217 | echo ./make_xios --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios >> $outfile |
---|
| 218 | ./make_xios --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios >> $outfile 2>&1 |
---|
| 219 | # Test if compiling succeded |
---|
| 220 | if [[ $? != 0 ]] ; then |
---|
| 221 | echo "THERE IS A PROBLEM IN XIOS COMPILATION - STOP" |
---|
| 222 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 223 | exit |
---|
| 224 | fi |
---|
| 225 | # Move executables to modipsl/bin |
---|
| 226 | if [ -f $modipsl/modeles/XIOS/bin/xios_server.exe ] ; then |
---|
| 227 | mv $modipsl/modeles/XIOS/bin/xios_server.exe $modipsl/bin/xios_server_${optmode}.exe |
---|
| 228 | else |
---|
| 229 | echo "THERE IS A PROBLEM IN XIOS COMPILATION EXECUTABLE MISSING - STOP" |
---|
| 230 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 231 | exit |
---|
| 232 | fi |
---|
| 233 | |
---|
| 234 | |
---|
| 235 | ## 2.3 Compile orchidee |
---|
| 236 | cd $modipsl/modeles/ORCHIDEE |
---|
| 237 | echo; echo "NOW COMPILE ORCHIDEE" |
---|
| 238 | echo >> $outfile ; echo " NOW COMPILE ORCHIDEE" >> $outfile |
---|
| 239 | |
---|
| 240 | # Check if the compilation of ORCHIDEE was previsouly interupted prematured. |
---|
| 241 | # In that case, the files fcm.bld.lock exist. If the file exist, it is here removed to avoid makeorchidee_fcm |
---|
| 242 | # to ask question and wait for interactivly answer from the user. |
---|
| 243 | if [ -f build/fcm.bld.lock ] ; then |
---|
| 244 | echo >> $outfile |
---|
| 245 | echo " WARNING!! The file ORCHIDEE/build/fcm.bld.lock exist. " >> $outfile |
---|
| 246 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 247 | echo " The file will now be removed. " >> $outfile |
---|
| 248 | echo >> $outfile |
---|
| 249 | rm -f build/fcm.bld.lock |
---|
| 250 | fi |
---|
| 251 | |
---|
| 252 | echo ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch >> $outfile |
---|
| 253 | ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch >> $outfile 2>&1 |
---|
| 254 | # Test if compiling finished |
---|
| 255 | if [[ $? != 0 ]] ; then |
---|
| 256 | echo "THERE IS A PROBLEM IN ORCHIDEE COMPILATION - STOP" |
---|
| 257 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 258 | exit |
---|
| 259 | fi |
---|
| 260 | |
---|
| 261 | # If orchide driver executables have been compiled (option -driver), then rename executables to contain $optmode |
---|
| 262 | if [ -f $modipsl/bin/orchidee_ol ] ; then mv $modipsl/bin/orchidee_ol $modipsl/bin/orchidee_ol_${optmode} ; fi |
---|
| 263 | if [ -f $modipsl/bin/orchideedriver ] ; then mv $modipsl/bin/orchideedriver $modipsl/bin/orchideedriver_${optmode} ; fi |
---|
| 264 | |
---|
| 265 | |
---|
| 266 | ## ajout compile inca Anne |
---|
| 267 | cd $modipsl/modeles/INCA |
---|
[5705] | 268 | |
---|
| 269 | echo; echo "NOW COMPILE INCA ${optchimie}" |
---|
[5591] | 270 | echo ./makeinca_fcm -chimie ${optchimie} -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_flag >> $outfile |
---|
| 271 | ./makeinca_fcm -chimie ${optchimie} -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_flag >> $outfile 2>&1 |
---|
[5586] | 272 | |
---|
| 273 | # Test if compiling finished |
---|
| 274 | if [[ $? != 0 ]] ; then |
---|
| 275 | echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP" |
---|
| 276 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 277 | exit |
---|
| 278 | fi |
---|
| 279 | |
---|
| 280 | |
---|
| 281 | |
---|
| 282 | echo "Move inca.dat modipsl/bin" |
---|
| 283 | if [[ -f $modipsl/modeles/INCA/SIMULATIONS/${optchimie}/inca.dat ]] ; then |
---|
| 284 | mv $modipsl/modeles/INCA/SIMULATIONS/${optchimie}/inca.dat $modipsl/bin/inca_${optmode}_${optchimie}.dat ; |
---|
| 285 | else |
---|
| 286 | echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP" |
---|
| 287 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 288 | exit |
---|
| 289 | fi |
---|
| 290 | |
---|
[5705] | 291 | echo "Move tracer.def to modipsl/bin" |
---|
| 292 | if [[ -f $modipsl/modeles/INCA/tracer.def ]] ; then |
---|
| 293 | mv $modipsl/modeles/INCA/tracer.def $modipsl/bin/tracer_${optmode}_${optchimie}.def ; |
---|
| 294 | fi |
---|
[5586] | 295 | |
---|
| 296 | |
---|
| 297 | ## 2.4 Compile lmdz |
---|
| 298 | |
---|
[6083] | 299 | if [ $reg_only = no ] && [ $ce0l_only = no ]; then |
---|
[5586] | 300 | |
---|
[6083] | 301 | cd $modipsl/modeles/LMDZ |
---|
| 302 | |
---|
[5958] | 303 | # Compile LMDZ as library to couple to DYNAMICO |
---|
| 304 | echo; echo "NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO" |
---|
| 305 | echo >> $outfile ; echo " NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO" >> $outfile |
---|
[5586] | 306 | |
---|
[5958] | 307 | # Check if the compilation of LMDZ was previsouly interupted prematured. |
---|
| 308 | # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm |
---|
| 309 | # to ask question and wait for interactivly answer from the user. |
---|
| 310 | if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then |
---|
| 311 | echo >> $outfile |
---|
| 312 | echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. " >> $outfile |
---|
| 313 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 314 | echo " The files dimension.h and .lock will now be removed. " >> $outfile |
---|
| 315 | echo >> $outfile |
---|
| 316 | rm -f libf/grid/dimensions.h |
---|
| 317 | rm -f .lock |
---|
| 318 | fi |
---|
[5586] | 319 | |
---|
[5958] | 320 | 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 |
---|
| 321 | ./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 |
---|
| 322 | # Test if compiling finished |
---|
| 323 | if [[ $? != 0 ]] ; then |
---|
| 324 | echo "THERE IS A PROBLEM IN LMDZ PHYSICS COMPILATION - STOP" |
---|
| 325 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 326 | exit |
---|
| 327 | fi |
---|
| 328 | |
---|
| 329 | |
---|
[5586] | 330 | ## 2.5 Compile DYNAMICO |
---|
[5958] | 331 | cd $modipsl/modeles/DYNAMICO |
---|
| 332 | echo; echo "NOW COMPILE DYNAMICO " |
---|
| 333 | echo >> $outfile ; echo " NOW COMPILE DYNAMICO" >> $outfile |
---|
[5586] | 334 | |
---|
[6345] | 335 | echo ./make_icosa -$optmode -with_fcm1 -parallel $parallel -external_ioipsl -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna >> $outfile |
---|
| 336 | ./make_icosa -$optmode -with_fcm1 -parallel $parallel -external_ioipsl -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna >> $outfile 2>&1 |
---|
[5958] | 337 | # Test if compiling finished |
---|
| 338 | if [[ $? != 0 ]] ; then |
---|
| 339 | echo "THERE IS A PROBLEM IN DYNAMICO COMPILATION - STOP" |
---|
| 340 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 341 | exit |
---|
| 342 | fi |
---|
[5586] | 343 | |
---|
[5958] | 344 | ## 2.6 Compile interface ICOSA_LMDZ |
---|
| 345 | cd $modipsl/modeles/ICOSA_LMDZ |
---|
| 346 | echo; echo "NOW COMPILE ICOSA_LMDZ " |
---|
| 347 | echo >> $outfile ; echo " NOW COMPILE ICOSA_LMDZ" >> $outfile |
---|
[5586] | 348 | |
---|
[5958] | 349 | 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 |
---|
| 350 | ./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 |
---|
| 351 | # Test if compiling finished |
---|
| 352 | if [[ $? != 0 ]] ; then |
---|
| 353 | echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION - STOP" |
---|
| 354 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 355 | exit |
---|
| 356 | fi |
---|
| 357 | # Move executables to modipsl/bin |
---|
| 358 | if [ $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe ] ; then |
---|
| 359 | mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/icosa_lmdz_${optmode}_${optchimie}.exe |
---|
| 360 | else |
---|
| 361 | echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION EXECUTABLE MISSING - STOP" |
---|
| 362 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 363 | exit |
---|
| 364 | fi |
---|
| 365 | fi |
---|
[5586] | 366 | |
---|
| 367 | |
---|
| 368 | ## 2.7 Compile LMDZ for regular latlon configuration |
---|
| 369 | |
---|
[6209] | 370 | |
---|
| 371 | # Option de compilation du rayonnement : depend de $lmdzsvn ><= r4185 |
---|
| 372 | case $rad in |
---|
| 373 | oldrad) opt_rad="" ;; |
---|
| 374 | rrtm) if [ $lmdzsvn -le 4185 ] ; then opt_rad="-rrtm true" ; else opt_rad="-rad rrtm" ; fi ;; |
---|
| 375 | ecrad) opt_rad="-rad ecrad" ;; |
---|
| 376 | *) echo Only oldrad rrtm ecrad for rad option ; exit |
---|
| 377 | esac |
---|
| 378 | if [ $lmdzsvn -le 4185 -a $rad = "ecrad" ] ; then echo "ecrad only available for LMDZ rev starting with 4186 " ; exit ; fi |
---|
| 379 | |
---|
| 380 | |
---|
[6083] | 381 | # Find executable suffix |
---|
| 382 | if [ $parallel == seq ] || [ $parallel == none ] ; then |
---|
[6209] | 383 | |
---|
| 384 | if [ $lmdzsvn -ge 4186 ] ; then |
---|
| 385 | suffix=_${resol_atm}_phylmd_${rad}_seq_orch_inca.e |
---|
| 386 | else |
---|
| 387 | suffix=_${resol_atm}_phylmd_seq_orch_inca.e |
---|
| 388 | fi |
---|
[6083] | 389 | else |
---|
[6209] | 390 | if [ $lmdzsvn -ge 4186 ] ; then |
---|
| 391 | suffix=_${resol_atm}_phylmd_${rad}_para_mem_orch_inca.e |
---|
| 392 | else |
---|
| 393 | suffix=_${resol_atm}_phylmd_para_mem_orch_inca.e |
---|
| 394 | fi |
---|
[6083] | 395 | fi |
---|
| 396 | echo gcm suffix = $suffix |
---|
| 397 | |
---|
| 398 | if [ $ico_only = no ] && [ $ce0l_only = no ]; then |
---|
| 399 | |
---|
[5958] | 400 | cd $modipsl/modeles/LMDZ |
---|
| 401 | # Compile LMDZ regular lat-lon exectuable |
---|
| 402 | echo; echo "NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" |
---|
| 403 | echo >> $outfile ; echo " NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" >> $outfile |
---|
| 404 | |
---|
| 405 | # Check if the compilation of LMDZ was previsouly interupted prematured. |
---|
| 406 | # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm |
---|
| 407 | # to ask question and wait for interactivly answer from the user. |
---|
| 408 | if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then |
---|
| 409 | echo >> $outfile |
---|
| 410 | echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. " >> $outfile |
---|
| 411 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 412 | echo " The files dimension.h and .lock will now be removed. " >> $outfile |
---|
| 413 | echo >> $outfile |
---|
| 414 | rm -f libf/grid/dimensions.h |
---|
| 415 | rm -f .lock |
---|
| 416 | fi |
---|
[6209] | 417 | 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 |
---|
| 418 | ./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] | 419 | # Test if compiling finished |
---|
| 420 | if [[ $? != 0 ]] ; then |
---|
| 421 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
| 422 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 423 | exit |
---|
| 424 | fi |
---|
[6083] | 425 | |
---|
| 426 | |
---|
| 427 | # Move executables to modipsl/bin folder |
---|
| 428 | echo "Move gcm.e and ce0l executable to modipsl/bin" |
---|
| 429 | if [ -f $modipsl/modeles/LMDZ/bin/gcm${suffix} ] ; then |
---|
| 430 | mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${optmode}_${optchimie}.e |
---|
| 431 | else |
---|
| 432 | echo "ERROR gcm${suffix} executable does not exist." |
---|
| 433 | echo "THERE IS A PROBLEM TO MOVE LMDZ REGULAR LATLON EXECUTABLE - STOP" |
---|
| 434 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 435 | exit |
---|
| 436 | fi |
---|
| 437 | |
---|
[5958] | 438 | fi |
---|
[5586] | 439 | |
---|
| 440 | |
---|
[6185] | 441 | if [ $ce0l_only = yes ] || [ $ico_only = no ] && [ $reg_only = no ] ; then |
---|
[6083] | 442 | |
---|
| 443 | cd $modipsl/modeles/LMDZ |
---|
| 444 | |
---|
[5958] | 445 | # Compile ce0l initialization program for LMDZ regular lat-lon exectuable |
---|
| 446 | echo; echo "NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" |
---|
| 447 | echo >> $outfile ; echo " NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" >> $outfile |
---|
| 448 | |
---|
[6209] | 449 | 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 |
---|
| 450 | ./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] | 451 | # Test if compiling finished |
---|
| 452 | if [[ $? != 0 ]] ; then |
---|
| 453 | echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP" |
---|
| 454 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 455 | exit |
---|
| 456 | fi |
---|
[5586] | 457 | |
---|
[5961] | 458 | if [ -f $modipsl/modeles/LMDZ/bin/ce0l${suffix} ] ; then |
---|
| 459 | mv $modipsl/modeles/LMDZ/bin/ce0l${suffix} $modipsl/bin/ce0l_${resol_atm}_${optmode}_${optchimie}.e |
---|
| 460 | else |
---|
| 461 | echo "ERROR ce0l${suffix} executable does not exist." |
---|
| 462 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
| 463 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 464 | exit |
---|
| 465 | fi |
---|
[6083] | 466 | |
---|
| 467 | |
---|
[5961] | 468 | fi |
---|
[5907] | 469 | |
---|
[5586] | 470 | echo >>$outfile ; echo "ALL COMPILING FINISHED" >> $outfile |
---|
| 471 | echo ls -lrt modipsl/bin >> $outfile |
---|
| 472 | ls -lrt $modipsl/bin >> $outfile |
---|
| 473 | |
---|
| 474 | echo; echo "ALL COMPILING FINISHED" ; echo |
---|
| 475 | echo "Executables are found in modipsl/bin" |
---|
| 476 | echo "Check that executable names correspond with the name set in config.card before launching the job" |
---|
| 477 | echo ls -lrt modipsl/bin |
---|
| 478 | ls -lrt $modipsl/bin |
---|
| 479 | |
---|
| 480 | date |
---|
| 481 | exit |
---|
| 482 | |
---|
| 483 | |
---|