[5479] | 1 | #!/bin/bash |
---|
| 2 | # Default options |
---|
| 3 | # |
---|
| 4 | # |
---|
| 5 | # |
---|
| 6 | date |
---|
| 7 | #### 1 Set up the compiling options |
---|
| 8 | #### Define some directories |
---|
| 9 | submitdir=$( pwd ) |
---|
| 10 | modipsl=$submitdir/../.. |
---|
| 11 | arch_path=$submitdir/ARCH |
---|
| 12 | mysrc_path=$submitdir/SOURCES |
---|
| 13 | export ROOT=$modipsl/modeles/DYNAMICO |
---|
[6641] | 14 | #### Set default options |
---|
| 15 | # Activate compilation of LMDZ for regular latlon grid without DYNAMICO |
---|
[6677] | 16 | regular_latlon=y |
---|
| 17 | # Atmospheric resolution for regular grid for LMDZ/ORCHIDEE, if regular_latlon=y |
---|
[5479] | 18 | resol_atm=144x142x79 |
---|
| 19 | # Coupled with ocean biogeochemistry (y/n) |
---|
[6346] | 20 | nemotop=y |
---|
[5479] | 21 | # Optimization mode |
---|
| 22 | # optmode=prod/dev/debug |
---|
| 23 | optmode=prod |
---|
| 24 | # fcm_arch |
---|
| 25 | fcm_arch=default |
---|
| 26 | # Default values to be overritten |
---|
| 27 | parallel=mpi_omp |
---|
| 28 | export fcm_arch parallel xios |
---|
| 29 | full_flag="" |
---|
| 30 | full_nemo=n |
---|
| 31 | full_inca="" |
---|
| 32 | full_xios="" |
---|
| 33 | full_lmdz="" |
---|
| 34 | full_orch="" |
---|
| 35 | full_dyna="" |
---|
[6648] | 36 | full_oasis=n |
---|
[6296] | 37 | # choose radiative code compilation option |
---|
| 38 | rad=rrtm |
---|
| 39 | opt_rad="" |
---|
[6544] | 40 | #choose chemistry inca configuration |
---|
| 41 | optchimie=GES |
---|
[6462] | 42 | |
---|
[6638] | 43 | # subconfig : which sub-configuration to compile. By default, the full extracted configuration is compiled. |
---|
| 44 | subconfig=default |
---|
| 45 | |
---|
[6462] | 46 | # orchversion tells if ORCHIDEE_2_2 or ORCHIDEE_trunk is compiled. This is used as argument and also in the suffix of the executables. |
---|
| 47 | orchversion=orch22 |
---|
| 48 | |
---|
[5479] | 49 | # Default netcdf_lib is used for XIOS but can be change by argument |
---|
| 50 | netcdf_lib="" |
---|
| 51 | |
---|
| 52 | # Output text file for compilation of each component |
---|
| 53 | datestr=`LC_ALL=C date +"%Y%m%dT%H%M"` |
---|
| 54 | outfile=$submitdir/out_compile_ipslcm7.$datestr |
---|
| 55 | echo > $outfile |
---|
| 56 | echo; echo "Text output from compilation will be stored in file out_compile_ipslcm7.$datestr"; echo |
---|
| 57 | |
---|
[6538] | 58 | |
---|
| 59 | rm -f out_compile_ipslcm7 |
---|
| 60 | ln -s ${outfile} out_compile_ipslcm7 |
---|
| 61 | |
---|
| 62 | |
---|
[5479] | 63 | #### Read arguments |
---|
| 64 | # Loop over all arguments to modify default set up |
---|
| 65 | while (($# > 0)) ; do |
---|
| 66 | case $1 in |
---|
[6677] | 67 | "-h"|"-help") cat <<end_help |
---|
[5479] | 68 | ######################################################################## |
---|
| 69 | # Usage of the script compile_ipslcm7.sh |
---|
| 70 | # |
---|
| 71 | ######################################################################## |
---|
| 72 | |
---|
| 73 | ./compile_ipslcm7.sh [Options] |
---|
| 74 | |
---|
[6677] | 75 | Description of all options: |
---|
[5479] | 76 | |
---|
[6677] | 77 | [-full] Full recompilation of all components. This option can be added to all other options. |
---|
| 78 | [-cleannemo] Full recompilation of NEMO component only. |
---|
| 79 | [-regular_latlon yes/no] Activate or deactivate compilation of LMDZ dynamics for regular latlon grid. |
---|
| 80 | Default resol_atm size is used. This option is set in addition to the compilation of the icosahedric grid. |
---|
| 81 | [-resol_atm XXXxYYYxZZ] Define which regular grid to compile. A default grid is set if this option is not used. |
---|
| 82 | [-debug / -dev / -prod] Level of optimization. One of these can be added to all other compile options. Default: -prod. |
---|
| 83 | [-subconfig X] Set this option if you want to compile a sub-configuration. X can be one of following sub-configurations : |
---|
| 84 | ICOLMDZORINCA, ICOLMDZOR, LMDZORINCA, LMDZOR, IPSLCM-reg or IPSLCM |
---|
| 85 | By default, all available components are compiled. |
---|
| 86 | [-orch4 / -orch22] Choice of ORCHIDEE version. The source code are found in modeles/ORCHIDEE_trunk or modeles/ORCHIDEE_2_2 |
---|
| 87 | and a link will be set to the choosen model version. Default version is currently ORCHIDEE_2_2 (-orch22). |
---|
[5479] | 88 | |
---|
[6677] | 89 | |
---|
| 90 | Example 1: Default compilation of IPSLCM7 |
---|
[5479] | 91 | ./compile_ipslcm7.sh |
---|
| 92 | |
---|
[6677] | 93 | Example 2: Default compilation in debug mode |
---|
[5479] | 94 | ./compile_ipslcm7.sh -debug |
---|
| 95 | |
---|
| 96 | Example 3: Default compilation with full recompilation of all components. No clean is needed. |
---|
| 97 | ./compile_ipslcm7.sh -full |
---|
| 98 | |
---|
[6677] | 99 | Example 4: Compilation in addition of LMDZ in regular lat-lon for a specific resolution : |
---|
[6641] | 100 | ./compile_ipslcm7.sh -resol_atm 144x142x95 |
---|
[5479] | 101 | |
---|
[6677] | 102 | Example 5: Compilation without regular grid (only icosaedric grid) |
---|
| 103 | ./compile_ipslcm7.sh -regular_latlon no |
---|
| 104 | |
---|
[6462] | 105 | Example 5: Compiltion of ORCHIDEE_trunk version |
---|
| 106 | ./compile_ipslcm7.sh -orch4 |
---|
| 107 | |
---|
[6544] | 108 | Example 6: compilation of a specific chemistry for INCA (default is GES) |
---|
| 109 | ./compile_ipslcm7.sh -chimie NMHC_AER_S |
---|
| 110 | |
---|
[6677] | 111 | Example 7: Compilation of sub-configuration LMDZOR : |
---|
| 112 | ./compile_ipslcm7.sh -subconfig LMDZOR |
---|
| 113 | |
---|
[5479] | 114 | end_help |
---|
| 115 | exit;; |
---|
| 116 | |
---|
| 117 | "-parallel") parallel=$2 ; shift ; shift ;; |
---|
| 118 | "-arch") fcm_arch="$2" ; shift ; shift ;; |
---|
| 119 | "-debug") optmode=debug ; shift ;; |
---|
| 120 | "-dev") optmode=dev ; shift ;; |
---|
| 121 | "-prod") optmode=prod ; shift ;; |
---|
[6677] | 122 | "-regular_latlon") regular_latlon=$2 ; shift ; shift ;; |
---|
| 123 | "-resol_atm") regular_latlon=y ; resol_atm=$2 ; shift ; shift ;; |
---|
[6638] | 124 | "-subconfig") subconfig=$2 ; shift ; shift ;; |
---|
[6649] | 125 | "-full") full_flag="-full"; full_nemo=y ; full_xios="--full" ; full_lmdz="-full" ; full_orch="-full" ; full_oasis=y ; full_inca="-clean" ; full_dyna="-full" ; shift ;; |
---|
[5479] | 126 | "-full_xios") full_xios="--full" ; shift ;; # Note only full_xios is using double dash: --full |
---|
| 127 | "-full_lmdz") full_lmdz="-full" ; shift ;; |
---|
| 128 | "-full_orch") full_orch="-full" ; shift ;; |
---|
| 129 | "-full_nemo") full_nemo=y ; shift ;; |
---|
| 130 | "-full_inca") full_inca="-clean"; shift ;; |
---|
[6648] | 131 | "-full_dyna") full_dyna="-full" ; shift ;; |
---|
| 132 | "-full_oasis") full_oasis=y ; shift ;; |
---|
[5479] | 133 | "-cleannemo") full_nemo=y ; shift ;; |
---|
[6296] | 134 | "-rad") rad=$2; shift ; shift ;; |
---|
[6640] | 135 | "-orch22") orchversion="orch22"; shift ;; |
---|
| 136 | "-orch4") orchversion="orch4"; shift ;; |
---|
[6544] | 137 | "-chimie") optchimie=$2; shift ; shift;; |
---|
[5479] | 138 | *) echo "unknown option "$1" , exiting..." ; exit |
---|
| 139 | esac |
---|
| 140 | done |
---|
| 141 | |
---|
[6638] | 142 | |
---|
| 143 | # Define which sub-configuration to compile. By default all extracted source components are compiled. |
---|
| 144 | source define_config.sh |
---|
| 145 | |
---|
[5479] | 146 | echo "Following options are set in current compiling:" >> $outfile |
---|
| 147 | echo " regular_latlon=$regular_latlon (if yes, then resol_atm=${resol_atm})" >> $outfile |
---|
[6641] | 148 | echo " resol_atm=${resol_atm}, nemotop=${nemotop}" >> $outfile |
---|
[5479] | 149 | echo " optmode = $optmode, parallel = $parallel, fcm_arch = $fcm_arch " >> $outfile |
---|
[6648] | 150 | echo " full_flag=$full_flag, full_xios=$full_xios, full_lmdz=$full_lmdz, full_orch=$full_orch, full_nemo=$full_nemo, full_dyna=$full_dyna, full_oasis=$full_oasis" >> $outfile |
---|
[6638] | 151 | echo " compinca=$compinca compnemo=$compnemo compoasis=$compoasis compdyna=$compdyna complmdz=y comporch=y compxios=y" >> $outfile |
---|
[5479] | 152 | echo >> $outfile |
---|
[6640] | 153 | ### Verification of argument |
---|
| 154 | # Set argorch depeinding on the version of ORCHIDEE. This is argument needed for the compilation of LMDZ to consider coherent interface. |
---|
| 155 | if [ $orchversion == orch22 ] ; then |
---|
| 156 | argorch=orchidee2.1 |
---|
| 157 | elif [ $orchversion == orch4 ] ; then |
---|
| 158 | argorch=orchideetrunk |
---|
| 159 | else |
---|
| 160 | echo "ERROR in version of ORCHIDEE. It is only possible to have orch22 or orch4 for now" |
---|
| 161 | fi |
---|
[6638] | 162 | |
---|
[5479] | 163 | ### Read host dependent default values |
---|
| 164 | ### These variables will not be changed if they were set as argument |
---|
| 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 |
---|
| 169 | # Find out current host and source specific paths and commands for the host |
---|
| 170 | case $( hostname -s ) in |
---|
| 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 ;; |
---|
[5479] | 179 | irene170|irene171|irene190|irene191|irene192|irene193) |
---|
| 180 | fcm_arch=X64_IRENE;; |
---|
| 181 | irene172|irene173|irene194|irene195) |
---|
| 182 | fcm_arch=X64_IRENE-AMD;; |
---|
| 183 | asterix*|obelix*) |
---|
| 184 | fcm_arch=ifort_LSCE |
---|
| 185 | if [ "${parallel}" == "mpi_omp" ] ; then |
---|
| 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 |
---|
| 190 | else |
---|
| 191 | echo "You used -parallel" $parallel |
---|
| 192 | fi ;; |
---|
[6296] | 193 | spirit*) |
---|
| 194 | fcm_arch=ifort_MESOIPSL;; |
---|
[5479] | 195 | ciclad*|climserv*|loholt*|camelot*) |
---|
| 196 | fcm_arch=ifort_CICLAD;; |
---|
| 197 | *) |
---|
| 198 | echo Current host is not known. You must use option -arch to specify which architecuture files to use. |
---|
| 199 | echo Exit now. |
---|
| 200 | exit |
---|
| 201 | esac |
---|
| 202 | fi |
---|
| 203 | |
---|
| 204 | # Set a link to arch.env if arch-${fcm_arch}.env file exist for current fcm_arch. |
---|
| 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 |
---|
| 207 | echo >> $outfile |
---|
| 208 | echo "The file ARCH/arch-${fcm_arch}.env will now be sourced with modules needed for compilation for all components." |
---|
[6296] | 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 |
---|
| 213 | svn_version=$(module list -t | grep subversion) |
---|
| 214 | |
---|
[5479] | 215 | # Make a link to this file, to be used also in config.card |
---|
| 216 | rm -f ARCH/arch.env |
---|
| 217 | ln -s arch-${fcm_arch}.env ARCH/arch.env |
---|
| 218 | |
---|
| 219 | # Source the file |
---|
[6296] | 220 | source ARCH/arch.env >> $outfile 2>&1 |
---|
| 221 | if [ X$svn_version != X ] ; then |
---|
| 222 | module load ${svn_version} |
---|
| 223 | fi |
---|
| 224 | echo >> $outfile |
---|
| 225 | echo " New module list after sourcing of ARCH/arch.env file:" >> $outfile |
---|
| 226 | module list >> $outfile 2>&1 |
---|
[5479] | 227 | fi |
---|
| 228 | |
---|
[6462] | 229 | |
---|
| 230 | #### Clean if full_orch |
---|
| 231 | # If full recompilation of ORCHIDEE then first clean modipsl/lib folder |
---|
| 232 | if [ X${full_orch} == X"-full" ] ; then |
---|
| 233 | rm -f $modipsl/lib/* |
---|
| 234 | fi |
---|
| 235 | |
---|
[5479] | 236 | #### 2 Do the compilation |
---|
| 237 | ## 2.1 Compile ioipsl |
---|
| 238 | cd $modipsl/modeles/IOIPSL |
---|
| 239 | echo; echo "NOW COMPILE IOIPSL" |
---|
| 240 | echo >> $outfile ; echo " NOW COMPILE IOIPSL" >> $outfile |
---|
| 241 | |
---|
| 242 | echo ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile |
---|
| 243 | ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile 2>&1 |
---|
| 244 | # Test if compiling succeded |
---|
| 245 | if [[ $? != 0 ]] ; then |
---|
| 246 | echo "THERE IS A PROBLEM IN IOIPSL COMPILATION - STOP" |
---|
| 247 | exit |
---|
| 248 | fi |
---|
| 249 | |
---|
[6638] | 250 | if [ $compoasis == y ] ; then |
---|
[5479] | 251 | ## 2.2 Compile oasis3-mct |
---|
[6648] | 252 | if [ $full_oasis == y ] ; then |
---|
| 253 | rm -rf $modipsl/oasis3-mct/BLD |
---|
| 254 | fi |
---|
[5479] | 255 | cd $modipsl/oasis3-mct/util/make_dir |
---|
| 256 | echo; echo "NOW COMPILE OASIS3-MCT" |
---|
| 257 | echo >> $outfile ; echo " NOW COMPILE OASIS3-MCT" >> $outfile |
---|
| 258 | cp $mysrc_path/OASIS3-MCT/make_${fcm_arch} make.inc |
---|
| 259 | |
---|
| 260 | echo make -f TopMakefileOasis3 >> $outfile |
---|
| 261 | make -f TopMakefileOasis3 >> $outfile 2>&1 |
---|
[6686] | 262 | if [[ $? != 0 ]] ; then |
---|
| 263 | echo "THERE IS A PROBLEM IN OASIS COMPILATION - STOP" |
---|
| 264 | exit |
---|
| 265 | fi |
---|
| 266 | |
---|
[5479] | 267 | |
---|
[6638] | 268 | else |
---|
| 269 | echo ; echo No compilation of OASIS |
---|
| 270 | fi |
---|
[5479] | 271 | |
---|
| 272 | ## 2.3 Compile xios |
---|
| 273 | cd $modipsl/modeles/XIOS |
---|
| 274 | echo; echo "NOW COMPILE XIOS" |
---|
| 275 | echo >> $outfile ; echo " NOW COMPILE XIOS" >> $outfile |
---|
[6638] | 276 | if [ $compoasis == y ] ; then |
---|
| 277 | argoasis="--use_oasis oasis3_mct " |
---|
| 278 | else |
---|
| 279 | argoasis=" " |
---|
| 280 | fi |
---|
| 281 | echo ./make_xios $argoasis --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios >> $outfile |
---|
| 282 | ./make_xios $argoasis --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios >> $outfile 2>&1 |
---|
[5479] | 283 | # Test if compiling succeded |
---|
| 284 | if [[ $? != 0 ]] ; then |
---|
| 285 | echo "THERE IS A PROBLEM IN XIOS COMPILATION - STOP" |
---|
| 286 | exit |
---|
| 287 | fi |
---|
| 288 | # Move executables to modipsl/bin |
---|
| 289 | if [ -f $modipsl/modeles/XIOS/bin/xios_server.exe ] ; then |
---|
| 290 | mv $modipsl/modeles/XIOS/bin/xios_server.exe $modipsl/bin/xios_server_${optmode}.exe |
---|
| 291 | else |
---|
| 292 | echo "THERE IS A PROBLEM IN XIOS COMPILATION EXECUTABLE MISSING - STOP" |
---|
| 293 | exit |
---|
| 294 | fi |
---|
| 295 | |
---|
| 296 | |
---|
[6462] | 297 | ## 2.4 Compile ORCHIDEE |
---|
| 298 | # Choose ORCHIDEE version to compile and create a link to generic folder name ORCHIDEE. |
---|
| 299 | # This link is needed for the compilation of ICOSA_LMDZ for it to find the orchidee librarie. |
---|
| 300 | cd $modipsl/modeles |
---|
| 301 | rm -f ORCHIDEE |
---|
| 302 | if [ $orchversion == orch22 ] ; then |
---|
| 303 | ln -s ORCHIDEE_2_2 ORCHIDEE |
---|
| 304 | cd $modipsl/modeles/ORCHIDEE_2_2 |
---|
| 305 | echo; echo "NOW COMPILE ORCHIDEE_2_2" |
---|
| 306 | echo >> $outfile ; echo " NOW COMPILE ORCHIDEE_2_2" >> $outfile |
---|
| 307 | else |
---|
| 308 | ln -s ORCHIDEE_trunk ORCHIDEE |
---|
| 309 | cd $modipsl/modeles/ORCHIDEE_trunk |
---|
| 310 | echo; echo "NOW COMPILE ORCHIDEE_trunk v4" |
---|
| 311 | echo >> $outfile ; echo " NOW COMPILE ORCHIDEE_trunk v4" >> $outfile |
---|
| 312 | fi |
---|
[5479] | 313 | |
---|
| 314 | # Check if the compilation of ORCHIDEE was previsouly interupted prematured. |
---|
| 315 | # In that case, the files fcm.bld.lock exist. If the file exist, it is here removed to avoid makeorchidee_fcm |
---|
| 316 | # to ask question and wait for interactivly answer from the user. |
---|
| 317 | if [ -f build/fcm.bld.lock ] ; then |
---|
| 318 | echo >> $outfile |
---|
| 319 | echo " WARNING!! The file ORCHIDEE/build/fcm.bld.lock exist. " >> $outfile |
---|
| 320 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 321 | echo " The file will now be removed. " >> $outfile |
---|
| 322 | echo >> $outfile |
---|
| 323 | rm -f build/fcm.bld.lock |
---|
| 324 | fi |
---|
| 325 | |
---|
[6462] | 326 | echo ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch >> $outfile |
---|
| 327 | ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch >> $outfile 2>&1 |
---|
[5479] | 328 | # Test if compiling finished |
---|
| 329 | if [[ $? != 0 ]] ; then |
---|
| 330 | echo "THERE IS A PROBLEM IN ORCHIDEE COMPILATION - STOP" |
---|
| 331 | exit |
---|
| 332 | fi |
---|
| 333 | |
---|
[6462] | 334 | # Rename exetubles for ORCHIDEE offline driver with suffix version |
---|
| 335 | cd $modipsl/bin |
---|
| 336 | if [ -f orchideedriver ] ; then mv orchideedriver orchideedriver.$orchversion ; fi |
---|
| 337 | if [ -f orchidee_ol ] ; then mv orchidee_ol orchidee_ol.$orchversion ; fi |
---|
[5479] | 338 | |
---|
[6462] | 339 | |
---|
[6639] | 340 | ## 2.5 Compile NEMO |
---|
[6638] | 341 | if [ $compnemo == y ] ; then |
---|
[6639] | 342 | nemo_root=$modipsl/modeles/NEMO |
---|
| 343 | cfg_ref=ORCA2_ICE_PISCES |
---|
| 344 | cfg_wrk=ORCA_ICE_TRC |
---|
| 345 | addkeys="key_oasis3 key_top key_si3 key_isf" |
---|
| 346 | delkeys="" |
---|
| 347 | |
---|
| 348 | if [ ${nemotop} == n ] ; then |
---|
| 349 | cfg_wrk=ORCA_ICE |
---|
| 350 | delkeys="key_top" |
---|
| 351 | fi |
---|
| 352 | |
---|
| 353 | if [ ${nemotop} == n ] ; then |
---|
| 354 | echo; echo "NOW COMPILE NEMO with ice model SI3 without passive tracer model TOP" |
---|
| 355 | echo >> $outfile ; echo " NOW COMPILE NEMO with ice model SI3 without passive tracer model TOP" >> $outfile |
---|
| 356 | else |
---|
| 357 | echo; echo "NOW COMPILE NEMO with ice model SI3 and passive tracer model TOP" |
---|
| 358 | echo >> $outfile ; echo " NOW COMPILE NEMO with ice model SI3 and passive tracer model TOP" >> $outfile |
---|
| 359 | fi |
---|
| 360 | |
---|
| 361 | echo >> $outfile ; echo cd $nemo_root >> $outfile |
---|
| 362 | echo >> $outfile ; echo cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm arch/CNRS/. >> $outfile |
---|
| 363 | echo >> $outfile |
---|
| 364 | |
---|
| 365 | cd $nemo_root ; cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm arch/CNRS/. |
---|
| 366 | |
---|
| 367 | # creation of config |
---|
| 368 | echo >> $outfile ; echo cd $nemo_root >> $outfile |
---|
| 369 | echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j0 add_key "$addkeys" del_key "$delkeys" >> $outfile |
---|
| 370 | echo >> $outfile |
---|
| 371 | cd $nemo_root |
---|
| 372 | ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j0 add_key "$addkeys" del_key "$delkeys" >> $outfile 2>&1 |
---|
| 373 | |
---|
| 374 | |
---|
| 375 | # Copy of specfic source files |
---|
| 376 | echo >> $outfile ; echo cp $mysrc_path/NEMO/*.*90 $nemo_root/cfgs/$cfg_wrk/MY_SRC/. >> $outfile |
---|
| 377 | echo >> $outfile |
---|
| 378 | cp $mysrc_path/NEMO/*.*90 $nemo_root/cfgs/$cfg_wrk/MY_SRC/. |
---|
| 379 | |
---|
| 380 | |
---|
| 381 | if [ $full_nemo == y ] ; then |
---|
| 382 | # To make a full compilation, first make a clean to remove all files produced during previous compilation |
---|
| 383 | echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref clean >> $outfile |
---|
| 384 | echo >> $outfile |
---|
| 385 | ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref clean >> $outfile 2>&1 |
---|
| 386 | fi |
---|
| 387 | echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j8 >> $outfile |
---|
| 388 | echo >> $outfile |
---|
| 389 | ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j8 >> $outfile 2>&1 |
---|
| 390 | |
---|
| 391 | echo >> $outfile |
---|
| 392 | echo "Move nemo executable to modipsl/bin" >> $outfile |
---|
| 393 | echo ls -lrt $nemo_root/cfgs/$cfg_wrk/BLD/bin >> $outfile |
---|
| 394 | ls -lrt $nemo_root/cfgs/$cfg_wrk/BLD/bin >> $outfile |
---|
| 395 | echo >> $outfile |
---|
| 396 | |
---|
| 397 | if [ -f $nemo_root/cfgs/$cfg_wrk/BLD/bin/nemo.exe ] ; then |
---|
| 398 | mv $nemo_root/cfgs/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa_${optmode}.exe |
---|
| 399 | else |
---|
| 400 | echo "ERROR nemo.exe executable does not exist." |
---|
| 401 | echo "THERE IS A PROBLEM IN NEMO COMPILATION - STOP" |
---|
| 402 | exit |
---|
| 403 | fi |
---|
| 404 | |
---|
[5479] | 405 | else |
---|
[6639] | 406 | echo ; echo No compilation of NEMO |
---|
[5479] | 407 | fi |
---|
[6346] | 408 | |
---|
[6639] | 409 | ##2.6 Compile INCA |
---|
[6638] | 410 | if [ $compinca == y ] ; then |
---|
[6544] | 411 | cd $modipsl/modeles/INCA |
---|
[6639] | 412 | |
---|
[6544] | 413 | echo; echo "NOW COMPILE INCA ${optchimie}" |
---|
[6588] | 414 | echo >> $outfile ; echo " NOW COMPILE INCA ${optchimie}" >> $outfile |
---|
| 415 | |
---|
[6649] | 416 | echo ./makeinca_fcm -chimie ${optchimie} -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_inca >> $outfile |
---|
| 417 | ./makeinca_fcm -chimie ${optchimie} -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_inca >> $outfile 2>&1 |
---|
[6639] | 418 | |
---|
[6544] | 419 | # Test if compiling finished |
---|
| 420 | if [[ $? != 0 ]] ; then |
---|
| 421 | echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP" |
---|
| 422 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 423 | exit |
---|
| 424 | fi |
---|
[6639] | 425 | |
---|
[6544] | 426 | echo "Move inca.dat modipsl/bin" |
---|
| 427 | if [[ -f $modipsl/modeles/INCA/SIMULATIONS/${optchimie}/inca.dat ]] ; then |
---|
| 428 | mv $modipsl/modeles/INCA/SIMULATIONS/${optchimie}/inca.dat $modipsl/bin/inca_${optchimie}.dat ; |
---|
| 429 | else |
---|
| 430 | echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP" |
---|
| 431 | echo "ALL INFORMATION IN FILE $outfile" |
---|
| 432 | exit |
---|
| 433 | fi |
---|
[6639] | 434 | |
---|
[6544] | 435 | echo "Move tracer.def to modipsl/bin" |
---|
| 436 | if [[ -f $modipsl/modeles/INCA/tracer.def ]] ; then |
---|
| 437 | mv $modipsl/modeles/INCA/tracer.def $modipsl/bin/tracer_${optchimie}.def ; |
---|
| 438 | fi |
---|
[6639] | 439 | |
---|
[6638] | 440 | else |
---|
[6639] | 441 | echo ; echo No compilation of INCA |
---|
[6638] | 442 | fi |
---|
[6544] | 443 | |
---|
| 444 | ## 2.7 Compile LMDZ |
---|
[5479] | 445 | cd $modipsl/modeles/LMDZ |
---|
| 446 | # Compile LMDZ as library to couple to DYNAMICO |
---|
[6639] | 447 | if [ $compdyna == y ] ; then |
---|
| 448 | echo; echo "NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO" |
---|
| 449 | echo >> $outfile ; echo " NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO" >> $outfile |
---|
| 450 | |
---|
| 451 | # Retrieve the final svn release number, needed for radiative code suffix of executable |
---|
| 452 | lmdzsvn=`svnversion . | egrep -o "[0-9]+" | awk 'NR==1'` |
---|
| 453 | # Temporary use of SOURCES/LMDZ to handle modifications needed by IPSLCM7 |
---|
| 454 | cp $mysrc_path/LMDZ/phylmd/*.*90 libf/phylmd/. |
---|
| 455 | cp $mysrc_path/LMDZ/dyn3d_common/*.*90 libf/dyn3d_common/. |
---|
| 456 | |
---|
| 457 | # Check if the compilation of LMDZ was previsouly interupted prematured. |
---|
| 458 | # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm |
---|
| 459 | # to ask question and wait for interactivly answer from the user. |
---|
| 460 | if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then |
---|
| 461 | echo >> $outfile |
---|
| 462 | echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. " >> $outfile |
---|
| 463 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 464 | echo " The files dimension.h and .lock will now be removed. " >> $outfile |
---|
| 465 | echo >> $outfile |
---|
| 466 | rm -f libf/grid/dimensions.h |
---|
| 467 | rm -f .lock |
---|
| 468 | fi |
---|
| 469 | |
---|
| 470 | # Need to define the proper option for radiative code compilation. By default, we use rrtm |
---|
| 471 | case $rad in |
---|
| 472 | oldrad) opt_rad="" ;; |
---|
| 473 | rrtm) if [ $lmdzsvn -le 4185 ] ; then opt_rad="-rrtm true" ; else opt_rad="-rad rrtm" ; fi ;; |
---|
| 474 | ecrad) opt_rad="-rad ecrad" ;; |
---|
| 475 | *) echo Only oldrad rrtm ecrad for rad option ; exit |
---|
| 476 | esac |
---|
| 477 | |
---|
| 478 | if [ $lmdzsvn -le 4185 -a $rad = "ecrad" ] ; then echo "ecrad only available for LMDZ rev starting with 4186 " ; exit ; fi |
---|
| 479 | |
---|
| 480 | if [ $compinca == y ] ; then |
---|
| 481 | arginca="-chimie INCA " |
---|
| 482 | else |
---|
| 483 | arginca=" " |
---|
| 484 | fi |
---|
| 485 | |
---|
| 486 | if [ $compoasis == y ] ; then |
---|
| 487 | argoasis="-c OMCT " |
---|
| 488 | else |
---|
| 489 | argoasis=" " |
---|
| 490 | fi |
---|
[6640] | 491 | |
---|
| 492 | echo ./makelmdz_fcm -p lmd $argoasis $opt_rad -$optmode -mem -parallel $parallel -libphy -v $argorch $arginca -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz >> $outfile |
---|
| 493 | ./makelmdz_fcm -p lmd $argoasis $opt_rad -$optmode -mem -parallel $parallel -libphy -v $argorch $arginca -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz >> $outfile 2>&1 |
---|
[6639] | 494 | |
---|
| 495 | |
---|
| 496 | # Test if compiling finished |
---|
| 497 | if [[ $? != 0 ]] ; then |
---|
| 498 | echo "THERE IS A PROBLEM IN LMDZ PHYSICS COMPILATION - STOP" |
---|
| 499 | exit |
---|
| 500 | fi |
---|
[5479] | 501 | fi |
---|
| 502 | |
---|
| 503 | |
---|
[6544] | 504 | ## 2.8 Compile DYNAMICO |
---|
[6639] | 505 | if [ $compdyna == y ] ; then |
---|
| 506 | cd $modipsl/modeles/DYNAMICO |
---|
| 507 | echo; echo "NOW COMPILE DYNAMICO " |
---|
| 508 | echo >> $outfile ; echo " NOW COMPILE DYNAMICO" >> $outfile |
---|
| 509 | |
---|
| 510 | if [ $compoasis == y ] ; then |
---|
| 511 | argoasis="-with_oasis " |
---|
| 512 | else |
---|
| 513 | argoasis=" " |
---|
| 514 | fi |
---|
| 515 | if [ $compinca == y ] ; then |
---|
| 516 | arginca="-with_inca " |
---|
| 517 | else |
---|
| 518 | arginca=" " |
---|
| 519 | fi |
---|
| 520 | |
---|
| 521 | |
---|
| 522 | echo ./make_icosa -$optmode -with_fcm1 -parallel $parallel -external_ioipsl $argoasis -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna >> $outfile |
---|
| 523 | ./make_icosa -$optmode -with_fcm1 -parallel $parallel -external_ioipsl $argoasis -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna >> $outfile 2>&1 |
---|
| 524 | # Test if compiling finished |
---|
| 525 | if [[ $? != 0 ]] ; then |
---|
| 526 | echo "THERE IS A PROBLEM IN DYNAMICO COMPILATION - STOP" |
---|
| 527 | exit |
---|
| 528 | fi |
---|
[6638] | 529 | fi |
---|
[6639] | 530 | |
---|
[6544] | 531 | ## 2.9 Compile interface ICOSA_LMDZ |
---|
[6642] | 532 | if [ $compdyna == y ] ; then |
---|
[6639] | 533 | cd $modipsl/modeles/ICOSA_LMDZ |
---|
| 534 | echo; echo "NOW COMPILE ICOSA_LMDZ " |
---|
| 535 | echo >> $outfile ; echo " NOW COMPILE ICOSA_LMDZ" >> $outfile |
---|
| 536 | |
---|
| 537 | echo ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel $argoasis -with_orchidee $arginca -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_dyna >> $outfile |
---|
| 538 | ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel $argoasis -with_orchidee $arginca -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_dyna >> $outfile 2>&1 |
---|
| 539 | # Test if compiling finished |
---|
| 540 | if [[ $? != 0 ]] ; then |
---|
| 541 | echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION - STOP" |
---|
| 542 | exit |
---|
| 543 | fi |
---|
| 544 | # Move executables to modipsl/bin |
---|
| 545 | if [ -f $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe ] ; then |
---|
| 546 | if [ $compinca == y ] ; then |
---|
| 547 | mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/icosa_lmdz_${orchversion}_${optmode}_${optchimie}.exe |
---|
| 548 | # Create link to be use by IPSLCM and LMDZOR without any change in the executable name |
---|
| 549 | cd $modipsl/bin |
---|
| 550 | rm -f icosa_lmdz_${orchversion}_${optmode}.exe |
---|
| 551 | ln -s icosa_lmdz_${orchversion}_${optmode}_${optchimie}.exe icosa_lmdz_${orchversion}_${optmode}.exe |
---|
| 552 | else |
---|
| 553 | mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/icosa_lmdz_${orchversion}_${optmode}.exe |
---|
| 554 | fi |
---|
[6638] | 555 | else |
---|
[6639] | 556 | echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION EXECUTABLE MISSING - STOP" |
---|
| 557 | exit |
---|
[6638] | 558 | fi |
---|
[5479] | 559 | fi |
---|
| 560 | |
---|
| 561 | |
---|
[6544] | 562 | ## 2.10 Compile LMDZ for regular latlon configuration |
---|
[6677] | 563 | if [ $regular_latlon = y ] ; then |
---|
[5479] | 564 | |
---|
| 565 | cd $modipsl/modeles/LMDZ |
---|
| 566 | # Compile LMDZ regular lat-lon exectuable |
---|
| 567 | echo; echo "NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" |
---|
| 568 | echo >> $outfile ; echo " NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" >> $outfile |
---|
| 569 | # Check if the compilation of LMDZ was previsouly interupted prematured. |
---|
| 570 | # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm |
---|
| 571 | # to ask question and wait for interactivly answer from the user. |
---|
| 572 | if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then |
---|
| 573 | echo >> $outfile |
---|
| 574 | echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. " >> $outfile |
---|
| 575 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 576 | echo " The files dimension.h and .lock will now be removed. " >> $outfile |
---|
| 577 | echo >> $outfile |
---|
| 578 | rm -f libf/grid/dimensions.h |
---|
| 579 | rm -f .lock |
---|
| 580 | fi |
---|
[6638] | 581 | |
---|
| 582 | if [ $compinca == y ] ; then |
---|
| 583 | arginca="-chimie INCA" |
---|
| 584 | else |
---|
| 585 | arginca="" |
---|
| 586 | fi |
---|
| 587 | |
---|
| 588 | if [ $compoasis == y ] ; then |
---|
| 589 | argoasis="-c OMCT" |
---|
| 590 | else |
---|
| 591 | argoasis="" |
---|
| 592 | fi |
---|
[6640] | 593 | echo ./makelmdz_fcm -d ${resol_atm} $argoasis -p lmd $opt_rad -$optmode -mem -parallel $parallel $arginca -io xios -v $argorch -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm >> $outfile |
---|
| 594 | ./makelmdz_fcm -d ${resol_atm} $argoasis -p lmd $opt_rad -$optmode -mem -parallel $parallel $arginca -io xios -v $argorch -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm >> $outfile 2>&1 |
---|
[5479] | 595 | # Test if compiling finished |
---|
| 596 | if [[ $? != 0 ]] ; then |
---|
| 597 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
| 598 | exit |
---|
| 599 | fi |
---|
| 600 | |
---|
[6457] | 601 | # Find executable suffix |
---|
| 602 | suffix=_${resol_atm}_phylmd |
---|
| 603 | if [ $lmdzsvn -ge 4186 ] ; then suffix=${suffix}_${rad} ; fi |
---|
| 604 | if [ $parallel == seq ] || [ $parallel == none ] ; then |
---|
[6544] | 605 | suffix=${suffix}_seq_orch_inca.e |
---|
[6457] | 606 | else |
---|
[6638] | 607 | if [ $compoasis == y ] ; then |
---|
| 608 | suffix=${suffix}_para_mem_orch_couple |
---|
| 609 | else |
---|
| 610 | suffix=${suffix}_para_mem_orch |
---|
| 611 | fi |
---|
| 612 | if [ $compinca == y ] ; then |
---|
| 613 | suffix=${suffix}_inca.e |
---|
| 614 | else |
---|
| 615 | suffix=${suffix}.e |
---|
| 616 | fi |
---|
[6457] | 617 | fi |
---|
| 618 | echo gcm suffix = $suffix |
---|
| 619 | |
---|
[6462] | 620 | # Move executables to modipsl/bin folder |
---|
[6457] | 621 | echo "Move gcm.e executable to modipsl/bin" |
---|
| 622 | if [ -f $modipsl/modeles/LMDZ/bin/gcm${suffix} ] ; then |
---|
[6638] | 623 | if [ $compinca == y ] ; then |
---|
| 624 | mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${orchversion}_${optmode}_${optchimie}.e |
---|
| 625 | # Create link to be use by IPSLCM and LMDZOR without any change in the executable name |
---|
| 626 | cd $modipsl/bin |
---|
| 627 | rm -f gcm_${resol_atm}_${orchversion}_${optmode}.e |
---|
| 628 | ln -s gcm_${resol_atm}_${orchversion}_${optmode}_${optchimie}.e gcm_${resol_atm}_${orchversion}_${optmode}.e |
---|
| 629 | else |
---|
| 630 | mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${orchversion}_${optmode}.e |
---|
| 631 | fi |
---|
[6457] | 632 | else |
---|
| 633 | echo "ERROR gcm${suffix} executable does not exist." |
---|
| 634 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
| 635 | exit |
---|
[6462] | 636 | fi |
---|
| 637 | |
---|
[6588] | 638 | # Find executable suffix |
---|
| 639 | suffix=_${resol_atm}_phylmd |
---|
| 640 | if [ $lmdzsvn -ge 4186 ] ; then suffix=${suffix}_${rad} ; fi |
---|
| 641 | if [ $parallel == seq ] || [ $parallel == none ] ; then |
---|
| 642 | suffix=${suffix}_seq_orch.e |
---|
| 643 | else |
---|
[6638] | 644 | if [ $compoasis == y ] ; then |
---|
| 645 | suffix=${suffix}_para_mem_orch_couple.e |
---|
| 646 | else |
---|
| 647 | suffix=${suffix}_para_mem_orch.e |
---|
| 648 | fi |
---|
[6588] | 649 | fi |
---|
| 650 | echo ce0l suffix = $suffix |
---|
[6638] | 651 | |
---|
[5479] | 652 | # Compile ce0l initialization program for LMDZ regular lat-lon exectuable |
---|
[6544] | 653 | cd $modipsl/modeles/LMDZ |
---|
[5479] | 654 | echo; echo "NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" |
---|
| 655 | echo >> $outfile ; echo " NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" >> $outfile |
---|
| 656 | |
---|
[6640] | 657 | echo ./makelmdz_fcm -d ${resol_atm} $argoasis -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v $argorch -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile |
---|
| 658 | ./makelmdz_fcm -d ${resol_atm} $argoasis -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v $argorch -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile 2>&1 |
---|
[5479] | 659 | # Test if compiling finished |
---|
| 660 | if [[ $? != 0 ]] ; then |
---|
| 661 | echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP" |
---|
| 662 | exit |
---|
| 663 | fi |
---|
[6462] | 664 | |
---|
| 665 | |
---|
[6457] | 666 | # Move executable ce0l to modipsl/bin folder |
---|
| 667 | echo "Move ce0l executable to modipsl/bin" |
---|
[5479] | 668 | if [ -f $modipsl/modeles/LMDZ/bin/ce0l${suffix} ] ; then |
---|
| 669 | mv $modipsl/modeles/LMDZ/bin/ce0l${suffix} $modipsl/bin/ce0l_${resol_atm}_${optmode}.e |
---|
| 670 | else |
---|
| 671 | echo "ERROR ce0l${suffix} executable does not exist." |
---|
| 672 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
| 673 | exit |
---|
| 674 | fi |
---|
| 675 | fi |
---|
| 676 | |
---|
| 677 | echo >>$outfile ; echo "ALL COMPILING FINISHED" >> $outfile |
---|
| 678 | echo ls -lrt modipsl/bin >> $outfile |
---|
| 679 | ls -lrt $modipsl/bin >> $outfile |
---|
| 680 | |
---|
| 681 | echo; echo "ALL COMPILING FINISHED" ; echo |
---|
| 682 | echo "Executables are found in modipsl/bin" |
---|
| 683 | echo "Check that executable names correspond with the name set in config.card before launching the job" |
---|
| 684 | echo ls -lrt modipsl/bin |
---|
| 685 | ls -lrt $modipsl/bin |
---|
| 686 | |
---|
| 687 | date |
---|
| 688 | |
---|
| 689 | exit |
---|
| 690 | |
---|
| 691 | |
---|