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