[4210] | 1 | #!/bin/bash |
---|
[4849] | 2 | set -eu # error on command failure, and on unset variables |
---|
| 3 | export LC_ALL=C # standardize awk format |
---|
[4210] | 4 | |
---|
| 5 | ########################################################################### |
---|
[4849] | 6 | # Author : Laurent Fairhead et Frédéric Hourdin |
---|
[4210] | 7 | # Usage : install_lmdz.sh -help |
---|
| 8 | # |
---|
| 9 | # bash installation script of the LMDZ model on different computer types : |
---|
| 10 | # Linux PC, "mesocentre" (IPSL-UPMC, IPSL-X), super-computer (IDRIS) |
---|
| 11 | # |
---|
| 12 | # The model is downloaded in the following directory tree |
---|
| 13 | # $MODEL/modipsl/modeles/... |
---|
| 14 | # using the "modipsl" infrastructure created by the "IPSL" |
---|
| 15 | # for coupled (atmosphere/ocean/vegetation/chemistry) climate modeling |
---|
| 16 | # activities. |
---|
| 17 | # Here we only download atmospheric (LMDZ) and vegetation (ORCHIDEE) |
---|
| 18 | # components. |
---|
| 19 | # |
---|
| 20 | # The sources of the models can be found in the "modeles" directory. |
---|
[4218] | 21 | # In the present case, LMDZ, ORCHIDEE, and IOIPSL or XIOS (handling of |
---|
| 22 | # input-outputs using the NetCDF library). |
---|
[4210] | 23 | # |
---|
| 24 | # The script downloads various source files (including a version of NetCDF) |
---|
| 25 | # and utilities, compiles the model, and runs a test simulation in a |
---|
| 26 | # minimal configuration. |
---|
| 27 | # |
---|
| 28 | # Prerequisites : pgf90/gfortran, bash or ksh, wget , gunzip, tar, ... |
---|
| 29 | # |
---|
| 30 | # Modif 18/11/2011 |
---|
| 31 | # changes for option real 8. |
---|
| 32 | # We compile with -r8 (or equivalent) and -DNC_DOUBLE for the GCM |
---|
| 33 | # but with -r4 for netcdf. Variable real must be set to |
---|
| 34 | # r4 or r8 at the beginning of the script below. |
---|
| 35 | # |
---|
| 36 | ########################################################################### |
---|
| 37 | |
---|
[4849] | 38 | echo install_lmdz.sh DEBUT "$(date)" |
---|
[4210] | 39 | |
---|
| 40 | ################################################################ |
---|
| 41 | # Choice of installation options |
---|
| 42 | ################################################################ |
---|
| 43 | |
---|
| 44 | ################################################################ |
---|
| 45 | # A function to fetch files either locally or on the internet |
---|
| 46 | ################################################################ |
---|
| 47 | function myget { #1st and only argument should be file name |
---|
[4215] | 48 | # Path on local computer where to look for the datafile |
---|
[4849] | 49 | if [[ -f /u/lmdz/WWW/LMDZ/pub/$1 ]]; then |
---|
| 50 | \cp -f -p "/u/lmdz/WWW/LMDZ/pub/$1" . |
---|
| 51 | elif [[ -f ~/LMDZ/pub/$1 ]]; then |
---|
| 52 | \cp -f -p ~"/LMDZ/pub/$1" . |
---|
[4215] | 53 | else |
---|
[4849] | 54 | wget --no-check-certificate -nv "http://lmdz.lmd.jussieu.fr/pub/$1" |
---|
[4405] | 55 | save_pub_locally=0 |
---|
[4849] | 56 | if [[ $save_pub_locally = 1 ]]; then # saving wget files on ~/LMDZ/pub |
---|
| 57 | dir=~"/LMDZ/pub/$(dirname "$1")"; mkdir -p "$dir" |
---|
| 58 | cp -r "$(basename "$1")" "$dir" |
---|
[4405] | 59 | fi |
---|
[4210] | 60 | fi |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | # 04_2021 : tester si r4 marche encore ! |
---|
[4849] | 64 | real="r8" # ou "r4" |
---|
[4210] | 65 | |
---|
| 66 | |
---|
| 67 | ######################################################################### |
---|
[4849] | 68 | # Valeur par défaut des parametres |
---|
[4210] | 69 | ######################################################################### |
---|
| 70 | svn="" |
---|
[4849] | 71 | version="20231022.trunk" |
---|
[4210] | 72 | |
---|
| 73 | getlmdzor=1 |
---|
[4237] | 74 | netcdf=1 # 1: for automatic installation; |
---|
[4267] | 75 | # or 0: do not install NetCDF and look for it in standard locations; |
---|
| 76 | # or absolute path: look for NetCDF there |
---|
[4210] | 77 | check_linux=1 |
---|
| 78 | ioipsl=1 |
---|
| 79 | bench=1 |
---|
| 80 | pclinux=1 |
---|
| 81 | pcmac=0 # default: not on a Mac |
---|
[4849] | 82 | compiler="gfortran" |
---|
| 83 | if [[ $(gfortran -dumpversion | cut -d. -f1) -ge 10 ]]; then allow_arg_mismatch="-fallow-argument-mismatch"; fi |
---|
[4210] | 84 | SCM=0 |
---|
| 85 | # surface/vegetation scheme treatment |
---|
| 86 | # controlled by the single variable veget which can have the following values |
---|
| 87 | # - NONE: bucket scheme (default) |
---|
| 88 | # - CMIP6: orchidee version used in CMIP exercise, rev 5661 |
---|
| 89 | # - number: orchidee version number |
---|
[4849] | 90 | veget="NONE" |
---|
[4210] | 91 | # choose the resolution for the bench runs |
---|
| 92 | # grid_resolution= 32x24x11 or 48x36x19 for tests (test without ORCHIDEE) |
---|
| 93 | # 96x71x19 standard configuration |
---|
[4849] | 94 | grid_resolution="144x142x79" |
---|
| 95 | grid_resolution="96x95x39" |
---|
| 96 | grid_resolution="48x36x19" |
---|
| 97 | grid_resolution="32x32x39" |
---|
[4210] | 98 | # choose the physiq version you want to test |
---|
| 99 | #physiq=NPv6.0.14splith |
---|
[4849] | 100 | physiq="" |
---|
[4210] | 101 | |
---|
| 102 | ## parallel can take the values none/mpi/omp/mpi_omp |
---|
[4849] | 103 | parallel="mpi_omp" |
---|
| 104 | parallel="none" |
---|
| 105 | idris_acct="lmd" |
---|
| 106 | trusting="testing" |
---|
[4210] | 107 | OPT_GPROF="" |
---|
| 108 | OPT_MAKELMDZ="" |
---|
| 109 | MODEL="" |
---|
| 110 | |
---|
| 111 | ## also compile XIOS? (and more recent NetCDF/HDF5 libraries) Default=no |
---|
| 112 | with_xios="n" |
---|
| 113 | opt_makelmdz_xios="" |
---|
| 114 | |
---|
| 115 | ## compile with oldrad/rrtm/ecrad radiatif code (Default=rrtm) |
---|
[4849] | 116 | rad="rrtm" |
---|
[4210] | 117 | |
---|
| 118 | ## compile_with_fcm=1 : use makelmdz_fcm (1) or makelmdz (0) |
---|
| 119 | compile_with_fcm=1 |
---|
| 120 | |
---|
[4849] | 121 | #Compilation with Cosp (cosp=NONE/v1/v2; default=NONE) |
---|
| 122 | cosp="NONE" |
---|
[4210] | 123 | opt_cosp="" |
---|
| 124 | |
---|
| 125 | # Check if on a Mac |
---|
[4849] | 126 | if [[ $(uname) = "Darwin" ]]; then |
---|
[4210] | 127 | pcmac=1 |
---|
| 128 | export MAKE=make |
---|
| 129 | fi |
---|
| 130 | |
---|
| 131 | env_file="" |
---|
[4849] | 132 | optim="" |
---|
[4210] | 133 | |
---|
| 134 | ######################################################################### |
---|
| 135 | # Options interactives |
---|
| 136 | ######################################################################### |
---|
| 137 | while (($# > 0)) |
---|
[4215] | 138 | do |
---|
| 139 | case $1 in |
---|
[4405] | 140 | "-h") cat <<........fin |
---|
[4210] | 141 | $0 [ -v version ] [ -r svn_release ] |
---|
| 142 | [ -parallel PARA ] [ -d GRID_RESOLUTION ] [ -bench 0/1 ] |
---|
| 143 | [-name LOCAL_MODEL_NAME] [-gprof] [-opt_makelmdz] [-rad RADIATIF] |
---|
| 144 | |
---|
| 145 | -v "version" like 20150828.trunk |
---|
| 146 | see http://www.lmd.jussieu.fr/~lmdz/Distrib/LISMOI.trunk |
---|
| 147 | |
---|
| 148 | -r "svn_release" : either the svn release number or "last" |
---|
| 149 | |
---|
| 150 | -compiler gfortran|ifort|pgf90 (default: gfortran) |
---|
| 151 | |
---|
| 152 | -parallel PARA : can be mpi_omp (mpi with openMP) or none (for sequential) |
---|
| 153 | |
---|
| 154 | -d GRID_RESOLUTION should be among the available benchs if -bench 1 |
---|
| 155 | among which : 48x36x19, 48x36x39 |
---|
| 156 | if wanting to run a bench simulation in addition to compilation |
---|
| 157 | default : 48x36x19 |
---|
| 158 | |
---|
| 159 | -bench activating the bench or not (0/1). Default 1 |
---|
| 160 | |
---|
[4421] | 161 | -testing/unstable |
---|
[4417] | 162 | |
---|
[4210] | 163 | -name LOCAL_MODEL_NAME : default = LMDZversion.release |
---|
| 164 | |
---|
[4211] | 165 | -netcdf 0, 1 or PATH |
---|
[4405] | 166 | 0: do not download NetCDF, look for it in standard locations |
---|
| 167 | 1: download and compile NetCDF |
---|
| 168 | PATH: full path to an existing installed NetCDF library |
---|
[4210] | 169 | |
---|
| 170 | -xios also download and compile the XIOS library |
---|
| 171 | (requires the NetCDF4-HDF5 library, also installed by default) |
---|
| 172 | (requires to also have -parallel mpi_omp) |
---|
| 173 | |
---|
| 174 | -gprof to compile with -pg to enable profiling with gprof |
---|
| 175 | |
---|
| 176 | -cosp to run without our with cospv1 or cospv2 [none/v1/v2] |
---|
| 177 | |
---|
| 178 | -rad RADIATIF can be oldrad, rrtm or ecrad radiatif code |
---|
| 179 | |
---|
| 180 | -nofcm to compile without fcm |
---|
| 181 | |
---|
| 182 | -SCM install 1D version automatically |
---|
| 183 | |
---|
| 184 | -debug compile everything in debug mode |
---|
| 185 | |
---|
| 186 | -opt_makelmdz to call makelmdz or makelmdz_fcm with additional options |
---|
| 187 | |
---|
| 188 | -physiq to choose which physics package to use |
---|
| 189 | |
---|
| 190 | -env_file specify an arch.env file to overwrite the existing one |
---|
| 191 | |
---|
| 192 | -veget surface model to run [NONE/CMIP6/xxxx] |
---|
| 193 | |
---|
| 194 | ........fin |
---|
[4849] | 195 | exit 1;; |
---|
| 196 | "-v") version=$2; shift; shift;; |
---|
| 197 | "-r") svn=$2; shift; shift;; |
---|
[4405] | 198 | "-compiler") compiler=$2 |
---|
[4215] | 199 | case $compiler in |
---|
[4849] | 200 | "gfortran"|"ifort"|"pgf90") compiler=$2; shift |
---|
| 201 | shift;; |
---|
[4405] | 202 | *) echo "Only gfortran , ifort or pgf90 for the " \ |
---|
| 203 | "compiler option" |
---|
[4849] | 204 | exit 1 |
---|
| 205 | esac;; |
---|
| 206 | "-d") grid_resolution=$2; shift; shift;; |
---|
| 207 | "-gprof") OPT_GPROF="-pg"; shift;; |
---|
| 208 | "-unstable"|"-testing") trusting=$(echo "$1" | cut -c2-) ; shift;; |
---|
[4405] | 209 | "-cosp") cosp=$2 |
---|
| 210 | case $cosp in |
---|
[4849] | 211 | "none"|"v1"|"v2") cosp=$2; shift; shift;; |
---|
| 212 | *) echo Only none v1 v2 for cosp option; exit 1 |
---|
| 213 | esac;; |
---|
| 214 | "-nofcm") compile_with_fcm=0; echo This option will be reactivated soon '(promesse du 8dec2022)'; exit 1; shift;; |
---|
| 215 | "-SCM") SCM=1; shift;; |
---|
| 216 | "-opt_makelmdz") OPT_MAKELMDZ="$2"; shift; shift;; |
---|
| 217 | "-rrtm") if [[ $2 = "false" ]]; then |
---|
[4405] | 218 | rad="oldrad" |
---|
| 219 | else |
---|
| 220 | rad="rrtm" |
---|
| 221 | fi |
---|
[4849] | 222 | shift; shift;; |
---|
[4405] | 223 | "-rad") rad=$2 |
---|
| 224 | case $rad in |
---|
[4849] | 225 | "oldrad"|"rrtm"|"ecrad") rad=$2; shift; shift;; |
---|
| 226 | *) echo "Only oldrad rrtm ecrad for rad option"; exit 1 |
---|
| 227 | esac;; |
---|
[4405] | 228 | "-parallel") parallel=$2 |
---|
[4215] | 229 | case $parallel in |
---|
[4849] | 230 | "none"|"mpi"|"omp"|"mpi_omp") parallel=$2; shift |
---|
| 231 | shift;; |
---|
| 232 | *) echo "Only none mpi omp mpi_omp for the parallel option" |
---|
| 233 | exit 1 |
---|
| 234 | esac;; |
---|
| 235 | "-bench") bench=$2; shift; shift;; |
---|
| 236 | "-debug") optim=-debug; shift;; |
---|
| 237 | "-name") MODEL=$2; shift; shift;; |
---|
| 238 | "-netcdf") netcdf=$2; shift; shift;; |
---|
| 239 | "-physiq") physiq=$2; shift; shift;; |
---|
| 240 | "-xios") with_xios="y"; shift;; |
---|
| 241 | "-env_file") env_file=$2; shift; shift;; |
---|
| 242 | "-veget") veget=$2; shift; shift;; |
---|
| 243 | *) bash install_lmdz.sh -h; exit 1 |
---|
[4215] | 244 | esac |
---|
[4210] | 245 | done |
---|
| 246 | |
---|
[4218] | 247 | # Option de compilation du rayonnement : depend de $mysvn ><= r4185, |
---|
| 248 | # sera donc definie plus bas |
---|
| 249 | |
---|
[4210] | 250 | #opt_rad="" |
---|
| 251 | #case $rad in |
---|
[4849] | 252 | # rrtm) opt_rad="-rad rrtm";; |
---|
| 253 | # ecrad) opt_rad="-rad ecrad";; |
---|
[4210] | 254 | #esac |
---|
| 255 | |
---|
[4807] | 256 | |
---|
[4210] | 257 | # Option de compilation pour Cosp |
---|
| 258 | opt_cosp="" |
---|
[4784] | 259 | case $cosp in |
---|
[4849] | 260 | v1) opt_cosp="-cosp true";; |
---|
| 261 | v2) opt_cosp="-cospv2 true";; |
---|
[4210] | 262 | esac |
---|
| 263 | |
---|
| 264 | # Check on veget version |
---|
[4849] | 265 | if [[ $veget != 'NONE' && $veget != "CMIP6" ]]; then |
---|
[4210] | 266 | re='^[0-9]+$' |
---|
[4849] | 267 | if ! [[ $veget =~ $re ]]; then |
---|
[4405] | 268 | echo 'Valeur de l option veget non valable' |
---|
[4849] | 269 | exit 1 |
---|
[4210] | 270 | fi |
---|
| 271 | fi |
---|
| 272 | |
---|
| 273 | #Define veget-related suffix for gcm name |
---|
[4849] | 274 | if [[ $veget = 'NONE' ]]; then |
---|
[4210] | 275 | suff_orc='' |
---|
[4218] | 276 | #For use with tutorial, orchidee_rev is also defined (will be |
---|
| 277 | #written in surface_env at the end of the script) |
---|
[4210] | 278 | orchidee_rev='' |
---|
| 279 | else |
---|
| 280 | suff_orc='_orch' |
---|
| 281 | fi |
---|
| 282 | |
---|
| 283 | |
---|
[4849] | 284 | if [[ $parallel = none ]]; then |
---|
[4218] | 285 | sequential=1; suff_exe='_seq' |
---|
| 286 | else |
---|
| 287 | sequential=0; suff_exe='_para_mem' |
---|
| 288 | fi |
---|
[4210] | 289 | |
---|
| 290 | #Chemin pour placer le modele |
---|
[4849] | 291 | if [[ $MODEL = "" ]]; then MODEL=./LMDZ$version$svn$optim; fi |
---|
[4210] | 292 | |
---|
| 293 | |
---|
| 294 | arch=local |
---|
| 295 | |
---|
| 296 | |
---|
[4849] | 297 | if [[ $compiler = g95 ]]; then echo g95 is not supported anymore; exit 1; fi |
---|
[4210] | 298 | |
---|
| 299 | ################################################################ |
---|
| 300 | # Specificite des machines |
---|
| 301 | ################################################################ |
---|
| 302 | |
---|
[4849] | 303 | hostname=$(hostname) |
---|
| 304 | if [[ $pclinux = 1 ]]; then o_ins_make="-t g95"; else o_ins_make=""; fi |
---|
[4210] | 305 | |
---|
| 306 | case ${hostname:0:5} in |
---|
| 307 | |
---|
[4849] | 308 | jean-) compiler="mpiifort"; |
---|
| 309 | par_comp="mpiifort"; |
---|
| 310 | o_ins_make="-t jeanzay"; |
---|
| 311 | make=gmake; |
---|
[4215] | 312 | module purge |
---|
[4849] | 313 | module load intel-compilers/19.0.4; |
---|
| 314 | #module load intel-mpi/19.0.4; |
---|
| 315 | #module load intel-mkl/19.0.4; |
---|
| 316 | module load hdf5/1.10.5-mpi; |
---|
| 317 | module load netcdf/4.7.2-mpi; |
---|
| 318 | module load netcdf-fortran/4.5.2-mpi; |
---|
| 319 | module load subversion/1.9.7; |
---|
[4503] | 320 | module load cmake |
---|
[4508] | 321 | export NETCDF_LIBDIR=./ |
---|
[4215] | 322 | export NETCDFFORTRAN_INCDIR=./ |
---|
| 323 | export NETCDFFORTRAN_LIBDIR=./ |
---|
[4849] | 324 | arch=X64_JEANZAY;; |
---|
[4210] | 325 | |
---|
[4849] | 326 | cicla|camel) compiler="gfortran"; |
---|
[4405] | 327 | module purge |
---|
| 328 | module load gnu/10.2.0 |
---|
| 329 | module load openmpi/4.0.5 |
---|
| 330 | module load hdf5/1.10.7-mpi |
---|
| 331 | module load netcdf-c/4.7.4-mpi |
---|
| 332 | module load netcdf-fortran/4.5.3-mpi |
---|
| 333 | netcdf=/net/nfs/tools/PrgEnv/linux-scientific6-x86_64/gcc-10.2.0/netcdf-fortran-4.5.3-k3drgfqok3lip62hnm3tsyof4cjen5sk |
---|
| 334 | module load svn/1.14.0 |
---|
[4211] | 335 | |
---|
[4849] | 336 | if [[ $parallel != none ]]; then |
---|
[4405] | 337 | root_mpi=/net/nfs/tools/meso-sl6/openmpi/4.0.5-gcc-10.2.0 |
---|
[4849] | 338 | path_mpi=$root_mpi/bin; |
---|
| 339 | par_comp=${path_mpi}/mpif90; |
---|
| 340 | mpirun=${path_mpi}/mpirun; |
---|
| 341 | fi; |
---|
| 342 | arch="local" ; |
---|
| 343 | make="make"; |
---|
| 344 | o_ins_make="-t g95";; |
---|
[4210] | 345 | |
---|
[4849] | 346 | *) if [[ $parallel = none || -f /usr/bin/mpif90 ]]; then |
---|
| 347 | path_mpi=$(which mpif90 | sed -e s:/mpif90::); |
---|
| 348 | if [[ -d /usr/lib64/openmpi ]]; then |
---|
[4215] | 349 | root_mpi="/usr/lib64/openmpi" |
---|
| 350 | else |
---|
| 351 | root_mpi="/usr" |
---|
| 352 | fi |
---|
| 353 | else |
---|
[4849] | 354 | echo "Cannot find mpif90"; |
---|
| 355 | if [[ $parallel = none ]]; then exit 1; fi; |
---|
| 356 | fi; |
---|
| 357 | if [[ $parallel != none ]]; then |
---|
[4405] | 358 | root_mpi=$(which mpif90 | sed -e s:/bin/mpif90::) |
---|
| 359 | path_mpi=$(which mpif90 | sed -e s:/mpif90::) |
---|
| 360 | export LD_LIBRARY_PATH=${root_mpi}/lib:$LD_LIBRARY_PATH |
---|
[4215] | 361 | fi |
---|
[4849] | 362 | par_comp=${path_mpi}/mpif90; |
---|
| 363 | mpirun=${path_mpi}/mpirun; |
---|
| 364 | arch="local" ; |
---|
| 365 | make="make"; |
---|
[4215] | 366 | o_ins_make="-t g95" |
---|
[4210] | 367 | esac |
---|
| 368 | |
---|
| 369 | # Flags for parallelism: |
---|
[4849] | 370 | if [[ $parallel != none ]]; then |
---|
[4215] | 371 | # MPI_LD are the flags needed for linking with MPI |
---|
| 372 | MPI_LD="-L${root_mpi}/lib -lmpi" |
---|
[4849] | 373 | if [[ "$compiler" = "gfortran" ]]; then |
---|
[4405] | 374 | # MPI_FLAGS are the flags needed for compilation with MPI |
---|
| 375 | MPI_FLAGS="-fcray-pointer" |
---|
| 376 | # OMP_FLAGS are the flags needed for compilation with OpenMP |
---|
| 377 | OMP_FLAGS="-fopenmp -fcray-pointer" |
---|
| 378 | # OMP_LD are the flags needed for linking with OpenMP |
---|
| 379 | OMP_LD="-fopenmp" |
---|
[4849] | 380 | elif [[ "$compiler" = "ifort" ]]; then |
---|
[4405] | 381 | MPI_FLAGS="" |
---|
| 382 | OMP_FLAGS="-openmp" |
---|
| 383 | OMP_LD="-openmp" |
---|
[4215] | 384 | else # pgf90 |
---|
[4405] | 385 | MPI_FLAGS="" |
---|
| 386 | OMP_FLAGS="-mp" |
---|
| 387 | OMP_LD="-mp" |
---|
[4215] | 388 | fi |
---|
[4210] | 389 | fi |
---|
| 390 | |
---|
| 391 | ##################################################################### |
---|
| 392 | # Test for old gfortran compilers |
---|
| 393 | # If the compiler is too old (older than 4.3.x) we test if the |
---|
| 394 | # temporary gfortran44 patch is available on the computer in which |
---|
| 395 | # case the compiler is changed from gfortran to gfortran44 |
---|
| 396 | # Must be aware than parallelism can not be activated in this case |
---|
| 397 | ##################################################################### |
---|
| 398 | |
---|
[4849] | 399 | if [[ "$compiler" = "gfortran" ]]; then |
---|
[4215] | 400 | gfortran=gfortran |
---|
[4849] | 401 | gfortranv=$(gfortran --version | \ |
---|
| 402 | head -1 | awk ' { print $NF } ' | awk -F. ' { print $1 * 10 + $2 } ') |
---|
| 403 | if [[ $gfortranv -le 43 ]]; then |
---|
| 404 | \cat <<EOF |
---|
| 405 | ERROR : Your gfortran compiler is too old |
---|
| 406 | Please choose a new one (ifort) and change the line |
---|
| 407 | compiler=xxx |
---|
| 408 | in the install_lmdz.sh script and rerun it |
---|
| 409 | EOF |
---|
| 410 | if [[ $(which gfortran44 | wc -w) -ne 0 ]]; then |
---|
[4215] | 411 | gfortran=gfortran44 |
---|
[4405] | 412 | else |
---|
[4849] | 413 | echo gfotran trop vieux; exit 1 |
---|
[4405] | 414 | fi |
---|
[4215] | 415 | fi |
---|
| 416 | compiler=$gfortran |
---|
[4210] | 417 | fi |
---|
| 418 | ##################################################################### |
---|
| 419 | |
---|
| 420 | ## if also compiling XIOS, parallel must be mpi_omp |
---|
[4849] | 421 | if [[ "$with_xios" = "y" && "$parallel" != "mpi_omp" ]]; then |
---|
[4215] | 422 | echo "Error, you must set -parallel mpi_omp if you want XIOS" |
---|
[4849] | 423 | exit 1 |
---|
[4210] | 424 | fi |
---|
| 425 | |
---|
[4849] | 426 | if [[ "$with_xios" = "y" ]]; then |
---|
[4215] | 427 | opt_makelmdz_xios="-io xios" |
---|
[4210] | 428 | fi |
---|
| 429 | |
---|
[4849] | 430 | if [[ "$cosp" = "v2" && "$with_xios" = "n" ]]; then |
---|
[4215] | 431 | echo "Error, Cospv2 cannot run without Xios" |
---|
[4849] | 432 | exit 1 |
---|
[4210] | 433 | fi |
---|
| 434 | |
---|
| 435 | echo '################################################################' |
---|
| 436 | echo Choix des options de compilation |
---|
| 437 | echo '################################################################' |
---|
| 438 | |
---|
| 439 | export FC=$compiler |
---|
| 440 | export F90=$compiler |
---|
| 441 | export F77=$compiler |
---|
| 442 | export CPPFLAGS= |
---|
[4849] | 443 | OPTIMNC="" |
---|
[4210] | 444 | BASE_LD="$OPT_GPROF" |
---|
| 445 | OPTPREC="$OPT_GPROF" |
---|
[4218] | 446 | ARFLAGS="rs" |
---|
[4849] | 447 | if [[ "$(lsb_release -i -s)" = "Ubuntu" ]]; then |
---|
| 448 | if [[ "$(lsb_release -r -s | cut -d. -f1)" -ge 16 ]]; then |
---|
[4398] | 449 | ARFLAGS="rU" |
---|
[4218] | 450 | fi |
---|
| 451 | fi |
---|
[4210] | 452 | |
---|
[4849] | 453 | if [[ "$compiler" = "$gfortran" ]]; then |
---|
[4267] | 454 | OPTIM="-O3 $allow_arg_mismatch" |
---|
| 455 | OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all -fbacktrace -finit-real=snan $allow_arg_mismatch" |
---|
| 456 | OPTDEV="-Wall -fbounds-check $allow_arg_mismatch" |
---|
| 457 | fmod='I ' |
---|
| 458 | OPTPREC="$OPTPREC -cpp -ffree-line-length-0" |
---|
[4849] | 459 | if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE"; fi |
---|
[4267] | 460 | export F90FLAGS=" -ffree-form $OPTIMNC" |
---|
| 461 | export FFLAGS=" $OPTIMNC" |
---|
| 462 | export CC=gcc |
---|
| 463 | export CXX=g++ |
---|
| 464 | export fpp_flags="-P -C -traditional -ffreestanding" |
---|
[4210] | 465 | |
---|
[4849] | 466 | elif [[ $compiler = mpif90 ]]; then |
---|
[4215] | 467 | OPTIM='-O3' |
---|
| 468 | OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all" |
---|
| 469 | OPTDEV="-Wall -fbounds-check" |
---|
| 470 | BASE_LD="$BASE_LD -lblas" |
---|
| 471 | fmod='I ' |
---|
[4849] | 472 | if [[ $real = r8 ]]; then |
---|
[4405] | 473 | OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE -fcray-pointer" |
---|
[4218] | 474 | fi |
---|
[4215] | 475 | export F90FLAGS=" -ffree-form $OPTIMNC" |
---|
| 476 | export FFLAGS=" $OPTIMNC" |
---|
| 477 | export CC=gcc |
---|
| 478 | export CXX=g++ |
---|
[4210] | 479 | |
---|
[4849] | 480 | elif [[ $compiler = pgf90 ]]; then |
---|
[4215] | 481 | OPTIM='-O2 -Mipa -Munroll -Mnoframe -Mautoinline -Mcache_align' |
---|
| 482 | OPTDEB='-g -Mdclchk -Mbounds -Mchkfpstk -Mchkptr -Minform=inform -Mstandard -Ktrap=fp -traceback' |
---|
| 483 | OPTDEV='-g -Mbounds -Ktrap=fp -traceback' |
---|
| 484 | fmod='module ' |
---|
[4849] | 485 | if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -r8 -DNC_DOUBLE"; fi |
---|
[4215] | 486 | export CPPFLAGS="-DpgiFortran" |
---|
| 487 | export CC=pgcc |
---|
| 488 | export CFLAGS="-O2 -Msignextend" |
---|
| 489 | export CXX=pgCC |
---|
| 490 | export CXXFLAGS="-O2 -Msignextend" |
---|
| 491 | export FFLAGS="-O2 $OPTIMNC" |
---|
| 492 | export F90FLAGS="-O2 $OPTIMNC" |
---|
| 493 | compile_with_fcm=1 |
---|
[4210] | 494 | |
---|
[4849] | 495 | elif [[ $compiler = ifort || $compiler = mpiifort ]]; then |
---|
[4215] | 496 | OPTIM="-O2 -fp-model strict -ip -align all " |
---|
| 497 | OPTDEV="-p -g -O2 -traceback -fp-stack-check -ftrapuv -check" |
---|
| 498 | OPTDEB="-g -no-ftz -traceback -ftrapuv -fp-stack-check -check" |
---|
| 499 | fmod='module ' |
---|
[4849] | 500 | if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -real-size 64 -DNC_DOUBLE"; fi |
---|
[4215] | 501 | export CPP="icc -E" |
---|
| 502 | export FFLAGS="-O2 -ip -fpic -mcmodel=large" |
---|
| 503 | export FCFLAGS="-O2 -ip -fpic -mcmodel=large" |
---|
| 504 | export CC=icc |
---|
| 505 | export CFLAGS="-O2 -ip -fpic -mcmodel=large" |
---|
| 506 | export CXX=icpc |
---|
| 507 | export CXXFLAGS="-O2 -ip -fpic -mcmodel=large" |
---|
| 508 | export fpp_flags="-P -traditional" |
---|
| 509 | # Pourquoi forcer la compilation fcm. Marche mieux sans |
---|
| 510 | #compile_with_fcm=1 |
---|
[4210] | 511 | else |
---|
[4849] | 512 | echo "unexpected compiler $compiler"; exit 1 |
---|
[4210] | 513 | fi |
---|
| 514 | |
---|
| 515 | OPTIMGCM="$OPTIM $OPTPREC" |
---|
| 516 | |
---|
[4849] | 517 | hostname=$(hostname) |
---|
[4210] | 518 | |
---|
| 519 | ########################################################################## |
---|
| 520 | # If installing on known machines such as Jean-Zay at IDRIS, |
---|
| 521 | # don't check for available software and don't install netcdf |
---|
[4849] | 522 | if [[ ${hostname:0:5} = jean- ]]; then |
---|
[4215] | 523 | netcdf=0 # no need to recompile netcdf, alreday available |
---|
| 524 | check_linux=0 |
---|
| 525 | pclinux=0 |
---|
| 526 | ioipsl=0 # no need to recompile ioipsl, already available |
---|
| 527 | #netcdf="/smplocal/pub/NetCDF/4.1.3" |
---|
| 528 | compiler="mpiifort" |
---|
| 529 | fmod='module ' |
---|
[4849] | 530 | if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -i4 -r8 -DNC_DOUBLE"; fi |
---|
[4215] | 531 | OPTIM="-auto -align all -O2 -fp-model strict -xHost " |
---|
| 532 | OPTIMGCM="$OPTIM $OPTPREC" |
---|
[4210] | 533 | fi |
---|
| 534 | ########################################################################## |
---|
| 535 | |
---|
| 536 | |
---|
[4849] | 537 | mkdir -p "$MODEL" |
---|
| 538 | echo "$MODEL" |
---|
| 539 | MODEL=$( cd "$MODEL"; pwd ) # to get absolute path, if necessary |
---|
[4210] | 540 | |
---|
| 541 | |
---|
[4849] | 542 | if [[ "$check_linux" = 1 ]]; then |
---|
| 543 | echo "################################################################" |
---|
| 544 | echo "Check if required software is available" |
---|
| 545 | echo "################################################################" |
---|
[4210] | 546 | |
---|
[4215] | 547 | #### Ehouarn: test if the required shell is available |
---|
[4849] | 548 | #### Maj FH-LF-AS 2021-04 : default=bash; if bash missing, use ksh |
---|
[4215] | 549 | use_shell="bash" # default |
---|
[4849] | 550 | if [[ $(which bash) = "" ]]; then |
---|
| 551 | echo "no bash; we will use ksh" |
---|
[4405] | 552 | use_shell="ksh" |
---|
[4849] | 553 | if [[ $(which ksh) = "" ]]; then |
---|
[4405] | 554 | echo "bash (or ksh) needed!! Install it!" |
---|
[4849] | 555 | exit 1 |
---|
[4405] | 556 | fi |
---|
[4215] | 557 | fi |
---|
[4210] | 558 | |
---|
[4849] | 559 | for logiciel in wget tar gzip make $compiler gcc cmake m4 c++; do |
---|
| 560 | if [[ $(which $logiciel) = "" ]]; then |
---|
| 561 | echo "You must first install $logiciel on your system" |
---|
| 562 | exit 1 |
---|
[4405] | 563 | fi |
---|
[4215] | 564 | done |
---|
[4210] | 565 | |
---|
[4849] | 566 | if [[ $pclinux = 1 ]]; then |
---|
| 567 | cd "$MODEL" |
---|
[4405] | 568 | cat <<eod > tt.f90 |
---|
[4210] | 569 | print*,'coucou' |
---|
| 570 | end |
---|
| 571 | eod |
---|
[4849] | 572 | $compiler tt.f90 || a.out |
---|
[4405] | 573 | ./a.out >| tt |
---|
[4849] | 574 | if [[ $(< tt sed -e 's/ //g' ) != "coucou" ]]; then |
---|
| 575 | echo "problem installing with compiler $compiler"; exit 1; fi |
---|
[4405] | 576 | \rm tt a.out tt.f90 |
---|
[4215] | 577 | fi |
---|
[4210] | 578 | fi |
---|
| 579 | |
---|
| 580 | ########################################################################### |
---|
[4849] | 581 | if [[ $getlmdzor = 1 && ! -d $MODEL/modipsl ]]; then |
---|
[4267] | 582 | ########################################################################### |
---|
[4849] | 583 | echo "##########################################################" |
---|
| 584 | echo "Download a slightly modified version of LMDZ" |
---|
| 585 | echo "##########################################################" |
---|
| 586 | cd "$MODEL" |
---|
| 587 | getlog=$(pwd)/get.log |
---|
| 588 | echo logfile : "$getlog" |
---|
| 589 | myget "src_archives/$trusting/modipsl.$version.tar.gz" >> get.log 2>&1 |
---|
| 590 | echo install_lmdz.sh wget_OK "$(date)" |
---|
| 591 | gunzip "modipsl.$version.tar.gz" >> get.log 2>&1 |
---|
| 592 | tar xf "modipsl.$version.tar" >> get.log 2>&1 |
---|
| 593 | \rm "modipsl.$version.tar" |
---|
[4210] | 594 | fi |
---|
| 595 | |
---|
| 596 | ########################################################################### |
---|
[4546] | 597 | echo Installing Netcdf |
---|
[4405] | 598 | ########################################################################### |
---|
[4546] | 599 | |
---|
[4849] | 600 | if [[ $netcdf = 0 ]]; then |
---|
[4546] | 601 | ncdfdir=/usr |
---|
| 602 | |
---|
| 603 | else |
---|
[4849] | 604 | cd "$MODEL" |
---|
[4212] | 605 | |
---|
[4405] | 606 | case $compiler in |
---|
[4849] | 607 | gfortran) opt1="-compiler gnu"; opt2="-CC gcc -FC gfortran -CXX g++";; |
---|
| 608 | ifort) opt1="-compiler intel"; opt2="-CC icc -FC ifort -CXX icpc";; |
---|
| 609 | pgf90) opt1="-compiler pgf90"; opt2="-CC pgcc -FC pgf90 -CXX pgCC";; |
---|
| 610 | *) echo "unexpected compiler $compiler" for netcdf; exit 1 |
---|
[4405] | 611 | esac |
---|
[4212] | 612 | |
---|
[4405] | 613 | case $with_xios in |
---|
| 614 | n) script_install_netcdf=install_netcdf4_hdf5_seq.bash |
---|
[4546] | 615 | ncdfdir=netcdf4_hdf5_seq |
---|
[4849] | 616 | opt_=$opt1;; |
---|
[4405] | 617 | y) script_install_netcdf=install_netcdf4_hdf5.bash |
---|
[4546] | 618 | ncdfdir=netcdf4_hdf5 |
---|
[4849] | 619 | opt_="$opt2 -MPI $root_mpi";; |
---|
| 620 | *) echo with_xios=$with_xios, should be n or y; exit 1 |
---|
[4405] | 621 | esac |
---|
[4849] | 622 | if [[ $netcdf = 1 ]]; then |
---|
[4546] | 623 | ncdfdir=$MODEL/$ncdfdir |
---|
| 624 | else |
---|
[4849] | 625 | mkdir -p $netcdf; ncdfdir=$netcdf/$ncdfdir |
---|
[4546] | 626 | fi |
---|
[4405] | 627 | |
---|
[4849] | 628 | echo "Repertoire netcdf $ncdfdir" |
---|
| 629 | if [[ ! -d $ncdfdir ]]; then |
---|
| 630 | netcdflog=$(pwd)/netcdf.log |
---|
| 631 | echo "----------------------------------------------------------" |
---|
| 632 | echo "Compiling the Netcdf library" |
---|
| 633 | echo "----------------------------------------------------------" |
---|
| 634 | echo "log file : $netcdflog" |
---|
| 635 | myget script_install/$script_install_netcdf >> "$netcdflog" 2>&1 |
---|
[4405] | 636 | chmod u=rwx $script_install_netcdf |
---|
[4849] | 637 | # shellcheck disable=SC2086 |
---|
| 638 | ./$script_install_netcdf -prefix "$ncdfdir" $opt_ >> "$netcdflog" 2>&1 |
---|
[4405] | 639 | fi |
---|
| 640 | |
---|
| 641 | #---------------------------------------------------------------------------- |
---|
| 642 | # LF rajout d'une verrue, pour une raison non encore expliquee, |
---|
[4849] | 643 | # la librairie est parfois rang�e dans lib64 et non dans lib |
---|
[4405] | 644 | # par certains compilateurs |
---|
[4849] | 645 | if [[ ! -e lib && -d lib64 ]]; then ln -s lib64 lib; fi |
---|
[4405] | 646 | #---------------------------------------------------------------------------- |
---|
| 647 | |
---|
[4849] | 648 | echo install_lmdz.sh netcdf_OK "$(date)" |
---|
[4210] | 649 | |
---|
| 650 | fi |
---|
| 651 | |
---|
[4238] | 652 | cat >test_netcdf90.f90 <<EOF |
---|
[4239] | 653 | use netcdf |
---|
[4238] | 654 | print *, "NetCDF library version: ", nf90_inq_libvers() |
---|
| 655 | end |
---|
| 656 | EOF |
---|
| 657 | |
---|
[4849] | 658 | if $compiler -I"$ncdfdir"/include test_netcdf90.f90 -L"$ncdfdir"/lib -lnetcdff \ |
---|
| 659 | -lnetcdf -Wl,-rpath="$ncdfdir"/lib && ./a.out |
---|
[4238] | 660 | then |
---|
| 661 | rm test_netcdf90.f90 a.out |
---|
| 662 | else |
---|
| 663 | echo "Failed test program using NetCDF-Fortran." |
---|
| 664 | echo "You can:" |
---|
| 665 | echo "- check that you have NetCDF-Fortran installed in your system" |
---|
| 666 | echo "- or specify an installation directory with option -netcdf of" \ |
---|
[4405] | 667 | "install_lmdz.sh" |
---|
[4238] | 668 | echo "- or download and compile NetCDF-Fortran with option -netcdf 1 of" \ |
---|
[4405] | 669 | "install_lmdz.sh" |
---|
[4238] | 670 | exit 1 |
---|
| 671 | fi |
---|
| 672 | |
---|
[4210] | 673 | if [[ ! -f $MODEL/modipsl/lib/libioipsl.a ]] |
---|
| 674 | then |
---|
[4849] | 675 | if [[ $ioipsl = 1 ]]; then |
---|
| 676 | cat <<EOF |
---|
| 677 | OK ioipsl=$ioipsl |
---|
| 678 | ########################################################## |
---|
| 679 | Installing MODIPSL, the installation package manager for the |
---|
| 680 | IPSL models and tools |
---|
| 681 | ########################################################## |
---|
| 682 | $(date) |
---|
| 683 | EOF |
---|
| 684 | cd "$MODEL/modipsl" |
---|
[4405] | 685 | \rm -rf lib/* |
---|
| 686 | cd util |
---|
| 687 | cp AA_make.gdef AA_make.orig |
---|
| 688 | F_C="$compiler -c " |
---|
[4849] | 689 | if [[ $compiler = "$gfortran" || $compiler = "mpif90" ]] |
---|
[4405] | 690 | then |
---|
| 691 | F_C="$compiler -c -cpp " |
---|
| 692 | fi |
---|
[4849] | 693 | if [[ "$compiler" = "pgf90" ]]; then F_C="$compiler -c -Mpreprocess"; fi |
---|
[4405] | 694 | sed -e 's/^\#.*.g95.*.\#.*.$/\#/' AA_make.gdef > tmp |
---|
| 695 | sed -e "s:F_L = g95:F_L = $compiler:" \ |
---|
| 696 | -e "s:F_C = g95 -c -cpp:F_C = $F_C": \ |
---|
| 697 | -e 's/g95.*.w_w.*.(F_D)/g95 w_w = '"$OPTIMGCM"'/' \ |
---|
| 698 | -e 's:g95.*.NCDF_INC.*.$:g95 NCDF_INC= '"$ncdfdir"'/include:' \ |
---|
| 699 | -e 's:g95.*.NCDF_LIB.*.$:g95 NCDF_LIB= -L'"$ncdfdir"'/lib -lnetcdff -lnetcdf:' \ |
---|
| 700 | -e 's:g95 L_O =:g95 L_O = -Wl,-rpath='"$ncdfdir"'/lib:' \ |
---|
| 701 | -e "s:-fmod=:-$fmod:" -e 's/-fno-second-underscore//' \ |
---|
| 702 | -e 's:#-Q- g95 M_K = gmake:#-Q- g95 M_K = make:' \ |
---|
| 703 | tmp >| AA_make.gdef |
---|
[4210] | 704 | |
---|
[4849] | 705 | if [[ $pcmac == 1 ]] |
---|
[4405] | 706 | then |
---|
| 707 | cp AA_make.gdef tmp |
---|
| 708 | sed -e 's/rpath=/rpath,/g' tmp > AA_make.gdef |
---|
| 709 | fi |
---|
[4210] | 710 | |
---|
| 711 | |
---|
[4405] | 712 | # We use lines for g95 even for the other compilers to run ins_make |
---|
[4849] | 713 | if [[ "$use_shell" = "ksh" ]]; then |
---|
| 714 | ./ins_make "$o_ins_make" |
---|
[4405] | 715 | else # bash |
---|
| 716 | sed -e s:/bin/ksh:/bin/bash:g ins_make > ins_make.bash |
---|
[4849] | 717 | if [[ $(grep jeanzay AA_make.gdef) = "" ]]; then |
---|
[4405] | 718 | # Bidouille pour compiler sur ada des vieux modipsl.tar |
---|
| 719 | echo 'Warning jean-zay not in AA_make.gdef' |
---|
| 720 | echo 'Think about updating' |
---|
| 721 | exit 1 |
---|
| 722 | fi |
---|
[4210] | 723 | |
---|
[4405] | 724 | chmod u=rwx ins_make.bash |
---|
[4849] | 725 | ./ins_make.bash "$o_ins_make" |
---|
| 726 | fi # of if [[ "$use_shell" = "ksh" ]] |
---|
[4210] | 727 | |
---|
[4849] | 728 | echo "install_lmdz.sh MODIPSL_OK $(date)" |
---|
[4210] | 729 | |
---|
[4849] | 730 | cd "$MODEL/modipsl/modeles/IOIPSL/src" |
---|
| 731 | ioipsllog=$(pwd)/ioipsl.log |
---|
[4405] | 732 | echo '##########################################################' |
---|
| 733 | echo 'Compiling IOIPSL, the interface library with Netcdf' |
---|
| 734 | echo '##########################################################' |
---|
[4849] | 735 | echo "log file : $ioipsllog $(date)" |
---|
[4210] | 736 | |
---|
[4849] | 737 | if [[ "$use_shell" = "bash" ]]; then |
---|
[4405] | 738 | cp Makefile Makefile.ksh |
---|
| 739 | sed -e s:/bin/ksh:/bin/bash:g Makefile.ksh > Makefile |
---|
| 740 | fi |
---|
[4849] | 741 | ### if [[ "$pclinux" = 1 ]]; then |
---|
[4405] | 742 | # Build IOIPSL modules and library |
---|
| 743 | $make clean |
---|
[4849] | 744 | $make > "$ioipsllog" 2>&1 |
---|
| 745 | if [[ $compiler = "$gfortran" || $compiler = "mpif90" ]]; then |
---|
[4405] | 746 | # copy module files to lib |
---|
[4849] | 747 | cp -f -- *.mod ../../../lib |
---|
[4405] | 748 | fi |
---|
| 749 | # Build IOIPSL tools (ie: "rebuild", if present) |
---|
[4849] | 750 | # For IOIPSLv_2_2_2, "rebuild" files are in IOIPSL/tools |
---|
| 751 | rebuild_dir="" |
---|
| 752 | if [[ -f $MODEL/modipsl/modeles/IOIPSL/tools/rebuild ]]; then |
---|
[4542] | 753 | rebuild_dir=$MODEL/modipsl/modeles/IOIPSL/tools |
---|
[4849] | 754 | elif [[ -d $MODEL/modipsl/modeles/IOIPSL/rebuild ]]; then |
---|
[4542] | 755 | rebuild_dir=$MODEL/modipsl/modeles/IOIPSL/rebuild |
---|
| 756 | fi |
---|
[4849] | 757 | if [[ $rebuild_dir != "" ]]; then |
---|
| 758 | cd "$rebuild_dir" |
---|
[4405] | 759 | # adapt Makefile & rebuild script if in bash |
---|
[4849] | 760 | if [[ "$use_shell" = "bash" ]]; then |
---|
[4405] | 761 | cp Makefile Makefile.ksh |
---|
| 762 | sed -e s:/bin/ksh:/bin/bash:g Makefile.ksh > Makefile |
---|
| 763 | cp rebuild rebuild.ksh |
---|
| 764 | sed -e 's:/bin/ksh:/bin/bash:g' \ |
---|
| 765 | -e 's:print -u2:echo:g' \ |
---|
| 766 | -e 's:print:echo:g' rebuild.ksh > rebuild |
---|
| 767 | fi |
---|
| 768 | $make clean |
---|
[4849] | 769 | $make > "$ioipsllog" 2>&1 |
---|
[4405] | 770 | fi |
---|
[4849] | 771 | ### fi # of if [[ "$pclinux" = 1 ]] which is commented out |
---|
[4210] | 772 | |
---|
[4849] | 773 | else # of if [[ $ioipsl = 1 ]] |
---|
| 774 | if [[ ${hostname:0:5} = jean- ]]; then |
---|
| 775 | cd "$MODEL/modipsl" |
---|
[4405] | 776 | cd util |
---|
[4849] | 777 | if [[ $(grep jeanzay AA_make.gdef) = "" ]]; then |
---|
[4405] | 778 | echo 'Warning jean-zay not in AA_make.gdef' |
---|
| 779 | echo 'Think about updating' |
---|
| 780 | exit 1 |
---|
[4215] | 781 | fi |
---|
[4849] | 782 | ./ins_make "$o_ins_make" |
---|
[4405] | 783 | # Compile IOIPSL on jean-zay |
---|
[4849] | 784 | cd "$MODEL/modipsl/modeles/IOIPSL/src" |
---|
[4215] | 785 | gmake > ioipsl.log |
---|
[4508] | 786 | # For IOIPSLv_2_2_2, "rebuild" files are in IOIPSL/tools, so "gmake" in IOIPSL/tools is enough |
---|
| 787 | # For IOIPSLv_2_2_5, "rebuild" files are in a separate IOIPSL/rebuild folder , while "tools" only contains "FCM" |
---|
[4849] | 788 | if [[ -f $MODEL/modipsl/modeles/IOIPSL/tools/Makefile ]]; then |
---|
| 789 | cd "$MODEL/modipsl/modeles/IOIPSL/tools" |
---|
[4502] | 790 | gmake > ioipsl.log |
---|
| 791 | fi |
---|
[4849] | 792 | if [[ -d $MODEL/modipsl/modeles/IOIPSL/rebuild ]]; then |
---|
| 793 | cd "$MODEL/modipsl/modeles/IOIPSL/rebuild" |
---|
[4508] | 794 | gmake > ioipsl.log |
---|
| 795 | fi |
---|
| 796 | |
---|
[4405] | 797 | fi |
---|
[4849] | 798 | echo "install_lmdz.sh ioipsl_OK $(date)" |
---|
| 799 | fi # of if [[ $ioipsl = 1 ]] |
---|
[4508] | 800 | fi # of if [[ ! -f $MODEL/modipsl/lib/libioipsl.a ]] |
---|
[4210] | 801 | |
---|
| 802 | #========================================================================= |
---|
[4849] | 803 | if [[ "$with_xios" = "y" ]]; then |
---|
[4215] | 804 | echo '##########################################################' |
---|
| 805 | echo 'Compiling XIOS' |
---|
| 806 | echo '##########################################################' |
---|
[4849] | 807 | cd "$MODEL/modipsl/modeles" |
---|
| 808 | xioslog="$(pwd)/xios.log" |
---|
[4215] | 809 | #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/install_xios.bash |
---|
[4411] | 810 | myget script_install/install_xios.bash |
---|
[4215] | 811 | chmod u=rwx install_xios.bash |
---|
[4709] | 812 | # following will be recalculated later on once LMDZ is updated |
---|
[4849] | 813 | # mysvn=`svnversion LMDZ | egrep || "[0-9]+" 2>/dev/null` |
---|
| 814 | mysvn=$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null) |
---|
| 815 | if [[ $svn != "" ]]; then mysvn=$svn; fi |
---|
| 816 | echo "mysvn $mysvn" |
---|
[4709] | 817 | |
---|
[4849] | 818 | if [[ ${hostname:0:5} = jean- ]]; then |
---|
| 819 | if [[ $mysvn -ge 4619 ]]; then |
---|
[4708] | 820 | svn co http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.6 \ |
---|
[4405] | 821 | XIOS |
---|
[4708] | 822 | else |
---|
| 823 | svn co http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.5 \ |
---|
| 824 | XIOS |
---|
| 825 | fi |
---|
[4405] | 826 | cd XIOS/arch |
---|
| 827 | svn update |
---|
| 828 | cd .. |
---|
[4849] | 829 | echo "Compiling XIOS, start $(date) (it takes about 20 min on Jean-Zay)" |
---|
[4405] | 830 | echo "log file: $xioslog" |
---|
| 831 | ./make_xios --prod --arch $arch --job 4 > xios.log 2>&1 |
---|
[4215] | 832 | else |
---|
[4849] | 833 | ./install_xios.bash -prefix "$MODEL/modipsl/modeles" \ |
---|
| 834 | -netcdf "$ncdfdir" -hdf5 "$ncdfdir" \ |
---|
| 835 | -MPI "$root_mpi" -arch $arch > xios.log 2>&1 |
---|
[4215] | 836 | fi # of case Jean-Zay |
---|
[4849] | 837 | if [[ -f XIOS/lib/libxios.a ]]; then |
---|
[4405] | 838 | echo "XIOS library successfully generated" |
---|
[4849] | 839 | echo install_lmdz.sh XIOS_OK "$(date)" |
---|
[4215] | 840 | fi |
---|
[4210] | 841 | fi |
---|
| 842 | |
---|
| 843 | #============================================================================ |
---|
| 844 | veget_version=false |
---|
[4849] | 845 | if [[ "$veget" != 'NONE' ]]; then |
---|
| 846 | cd "$MODEL/modipsl/modeles/ORCHIDEE" |
---|
| 847 | set +e; svn upgrade; set -e |
---|
| 848 | if [[ "$veget" = "CMIP6" ]]; then |
---|
[4405] | 849 | veget_version=orchidee2.0 |
---|
| 850 | orchidee_rev=6592 |
---|
[4215] | 851 | else # specific orchidee revision newer than CMIP6, on 2_1 or 2_2 branches |
---|
[4405] | 852 | veget_version=orchidee2.1 |
---|
| 853 | orchidee_rev=$veget |
---|
[4849] | 854 | if [[ $veget -lt 4465 ]]; then |
---|
[4405] | 855 | echo 'Stopping, ORCHIDEE version too old, script needs work on ' \ |
---|
| 856 | 'the CPP flags to pass to makelmdz' |
---|
| 857 | exit 1 |
---|
| 858 | fi |
---|
| 859 | set +e |
---|
| 860 | # which branch is my version on? |
---|
[4849] | 861 | orcbranch=$(svn log -v -q svn://forge.ipsl.jussieu.fr/orchidee/ -r "$veget" |grep ORCHIDEE |head -1| sed -e 's:ORCHIDEE/.*$:ORCHIDEE:' | awk '{print $2}') |
---|
[4405] | 862 | # switch to that branch |
---|
| 863 | echo IF YOU INSTALL ORCHIDEE THE VERY FIRST TIME, ASK for PASSWORD at \ |
---|
| 864 | orchidee-help@listes.ipsl.fr |
---|
[4849] | 865 | svn switch -r "$veget" --accept theirs-full "svn://forge.ipsl.jussieu.fr/orchidee/$orcbranch" |
---|
| 866 | if ! (svn log -r "$veget" | grep "$veget"); then |
---|
| 867 | echo 'Cannot update ORCHIDEE as not on the right branch for ORCHIDEE' |
---|
| 868 | exit 1 |
---|
[4405] | 869 | fi |
---|
| 870 | set -e |
---|
[4849] | 871 | set +e; svn update -r "$veget"; set -e |
---|
[4215] | 872 | fi |
---|
| 873 | # Correctif suite debug Jean-Zay |
---|
[4218] | 874 | sed -i -e 's/9010 FORMAT(A52,F17.14)/9010 FORMAT(A52,F20.14)/' \ |
---|
[4405] | 875 | src_stomate/stomate.f90 |
---|
[4849] | 876 | opt_orc="-prod"; if [[ "$optim" = "-debug" ]]; then opt_orc="-debug"; fi |
---|
[4210] | 877 | |
---|
[4849] | 878 | orchideelog=$(pwd)/orchidee.log |
---|
[4215] | 879 | echo '########################################################' |
---|
| 880 | echo 'Compiling ORCHIDEE, the continental surface model ' |
---|
| 881 | echo '########################################################' |
---|
[4849] | 882 | echo "Start of the first compilation of orchidee, in sequential mode: $(date)" |
---|
| 883 | echo "log file : $orchideelog" |
---|
[4210] | 884 | |
---|
[4849] | 885 | ORCHPATH=$(pwd) |
---|
| 886 | export ORCHPATH=$ORCHPATH |
---|
[4215] | 887 | xios_orchid="-noxios" |
---|
[4849] | 888 | if [[ "$with_xios" = "y" ]]; then |
---|
[4405] | 889 | xios_orchid="-xios" |
---|
[4215] | 890 | fi |
---|
[4849] | 891 | if [[ -d tools ]]; then |
---|
[4405] | 892 | ################################################################### |
---|
| 893 | # Pour les experts qui voudraient changer de version d'orchidee. |
---|
| 894 | # Attention : necessite d'avoir le password pour orchidee |
---|
[4210] | 895 | |
---|
[4405] | 896 | # Correctif suite debug Jean-Zay |
---|
[4849] | 897 | if [[ -f src_global/time.f90 ]]; then |
---|
[4405] | 898 | sed -i -e 's/CALL tlen2itau/\!CALL tlen2itau/' src_global/time.f90 |
---|
| 899 | fi |
---|
| 900 | ################################################################### |
---|
[4849] | 901 | if [[ "$veget_version" == "false" ]]; then |
---|
[4405] | 902 | veget_version=orchidee2.0 |
---|
| 903 | fi |
---|
| 904 | cd arch |
---|
[4849] | 905 | sed -e s:"%COMPILER .*.$:%COMPILER $compiler":1 \ |
---|
| 906 | -e s:"%LINK .*.$:%LINK $compiler":1 \ |
---|
| 907 | -e s:"%FPP_FLAGS .*.$:%FPP_FLAGS $fpp_flags":1 \ |
---|
| 908 | -e s:"%PROD_FFLAGS .*.$:%PROD_FFLAGS $OPTIM":1 \ |
---|
| 909 | -e s:"%DEV_FFLAGS .*.$:%DEV_FFLAGS $OPTDEV":1 \ |
---|
| 910 | -e s:"%DEBUG_FFLAGS .*.$:%DEBUG_FFLAGS $OPTDEB":1 \ |
---|
| 911 | -e s:"%BASE_FFLAGS .*.$:%BASE_FFLAGS $OPTPREC":1 \ |
---|
| 912 | -e s:"%BASE_LD .*.$:%BASE_LD $BASE_LD":1 \ |
---|
| 913 | -e s:"%ARFLAGS .*.$:%ARFLAGS $ARFLAGS":1 \ |
---|
[4405] | 914 | arch-gfortran.fcm > arch-local.fcm |
---|
[4849] | 915 | cat <<EOF > arch-local.path |
---|
| 916 | NETCDF_LIBDIR="-L$ncdfdir/lib -lnetcdff -lnetcdf" |
---|
| 917 | NETCDF_INCDIR="$ncdfdir/include" |
---|
| 918 | IOIPSL_INCDIR="$ORCHPATH/../../lib" |
---|
| 919 | IOIPSL_LIBDIR="$ORCHPATH/../../lib" |
---|
| 920 | XIOS_INCDIR="\$ORCHDIR/../XIOS/inc" |
---|
| 921 | XIOS_LIBDIR="\$ORCHDIR/../XIOS/lib -lxios" |
---|
| 922 | EOF |
---|
[4405] | 923 | cd ../ |
---|
[4210] | 924 | |
---|
[4405] | 925 | echo ./makeorchidee_fcm -j $xios_orchid $opt_orc -parallel none \ |
---|
| 926 | -arch $arch |
---|
| 927 | ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc -parallel none \ |
---|
[4849] | 928 | -arch $arch > "$orchideelog" 2>&1 |
---|
[4405] | 929 | pwd |
---|
[4849] | 930 | else # of "if [[ -d tools ]]" |
---|
| 931 | if [[ -d src_parallel ]]; then |
---|
[4405] | 932 | liste_src="parallel parameters global stomate sechiba driver" |
---|
[4849] | 933 | if [[ "$veget_version" == "false" ]]; then |
---|
[4405] | 934 | veget_version=orchidee2.0 |
---|
| 935 | fi |
---|
| 936 | fi |
---|
[4849] | 937 | for d in $liste_src; do |
---|
[4405] | 938 | src_d=src_$d |
---|
[4849] | 939 | echo src_d "$src_d" |
---|
| 940 | echo ls; ls |
---|
| 941 | if [[ ! -d $src_d ]]; then |
---|
| 942 | echo "Problem orchidee : no $src_d"; exit 1 |
---|
[4405] | 943 | fi |
---|
[4849] | 944 | cd "$src_d"; \rm -f -- *.mod make; $make clean |
---|
| 945 | $make > "$orchideelog" 2>&1 |
---|
| 946 | if [[ "$compiler" = "$gfortran" || "$compiler" = "mpif90" ]]; then |
---|
| 947 | cp -f -- *.mod ../../../lib |
---|
[4405] | 948 | fi |
---|
| 949 | cd .. |
---|
| 950 | done |
---|
[4849] | 951 | fi # of "if [[ -d tools ]]" |
---|
| 952 | echo "install_lmdz.sh orchidee_compil_seq_OK $(date)" |
---|
| 953 | fi # of if [[ "$veget" != 'NONE' ]] |
---|
[4210] | 954 | |
---|
| 955 | |
---|
| 956 | #============================================================================ |
---|
| 957 | # Ehouarn: the directory name LMDZ* depends on version/tar file... |
---|
[4849] | 958 | if [[ -d $MODEL/modipsl/modeles/LMD* ]]; then |
---|
[4215] | 959 | echo '###############################################################' |
---|
| 960 | echo 'Preparing LMDZ compilation : arch file, svn switch if needed...' |
---|
| 961 | echo '###############################################################' |
---|
[4849] | 962 | cd "$MODEL/modipsl/modeles/"LMD* |
---|
| 963 | LMDZPATH=$(pwd) |
---|
[4210] | 964 | else |
---|
[4215] | 965 | echo "ERROR: No LMD* directory !!!" |
---|
[4849] | 966 | exit 1 |
---|
[4210] | 967 | fi |
---|
| 968 | |
---|
| 969 | ########################################################### |
---|
| 970 | # For those who want to use fcm to compile via : |
---|
| 971 | # makelmdz_fcm -arch local ..... |
---|
| 972 | ############################################################ |
---|
| 973 | |
---|
| 974 | |
---|
| 975 | |
---|
[4849] | 976 | cd "$MODEL/modipsl/modeles"/LMDZ* |
---|
| 977 | lmdzlog=$(pwd)/lmdz.log |
---|
[4210] | 978 | |
---|
| 979 | ################################################################## |
---|
| 980 | # Possibly update LMDZ if a specific svn release is requested |
---|
| 981 | ################################################################## |
---|
| 982 | |
---|
[4849] | 983 | set +e; svn upgrade; set -e |
---|
[4210] | 984 | |
---|
[4849] | 985 | if [[ $svn = "last" ]]; then svnopt=""; else svnopt="-r $svn"; fi |
---|
| 986 | if [[ $svn != "" ]]; then |
---|
| 987 | if set +e; svn info | grep -q 'https:'; then |
---|
[4634] | 988 | svn switch --relocate https://svn.lmd.jussieu.fr/LMDZ \ |
---|
| 989 | http://svn.lmd.jussieu.fr/LMDZ |
---|
[4210] | 990 | fi |
---|
[4849] | 991 | svn update "$svnopt" |
---|
[4372] | 992 | set -e |
---|
[4210] | 993 | fi |
---|
| 994 | |
---|
[4372] | 995 | #--------------------------------------------------------------------- |
---|
[4218] | 996 | # Retrieve the final svn release number, and adjust compilation |
---|
| 997 | # options accordingly |
---|
[4372] | 998 | # If svn not available, will use the svn writen in $MODEL/Readm*md |
---|
| 999 | # For old version it assumes that it is before 4185 (the version |
---|
| 1000 | # for which the test was introduced |
---|
| 1001 | #--------------------------------------------------------------------- |
---|
[4210] | 1002 | |
---|
[4849] | 1003 | set +e; mysvn=$(svnversion . | grep -E || "[0-9]+" 2>/dev/null); set -e |
---|
| 1004 | if [[ "$mysvn" = "" ]]; then mysvn=$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null); fi |
---|
| 1005 | if [[ "$mysvn" = "" ]]; then mysvn=4190; fi |
---|
[4372] | 1006 | |
---|
[4849] | 1007 | if [[ "$pclinux" = "1" && ! -f arch/arch-local.path ]]; then |
---|
[4427] | 1008 | |
---|
| 1009 | # create local 'arch' files (if on Linux PC): |
---|
| 1010 | cd arch |
---|
| 1011 | # arch-local.path file |
---|
| 1012 | # test for version as arch.pth file changed format with rev 4426 |
---|
[4849] | 1013 | if [[ "$mysvn" -gt 4425 ]]; then |
---|
| 1014 | cat <<EOF > arch-local.path |
---|
| 1015 | NETCDF_LIBDIR="-L$ncdfdir/lib" |
---|
| 1016 | NETCDF_LIB="-lnetcdff -lnetcdf\" |
---|
| 1017 | NETCDF_INCDIR=-I$ncdfdir/include |
---|
| 1018 | NETCDF95_INCDIR=-I\$LMDGCM/../../include |
---|
| 1019 | NETCDF95_LIBDIR=-L\$LMDGCM/../../lib |
---|
| 1020 | NETCDF95_LIB=-lnetcdf95 |
---|
| 1021 | IOIPSL_INCDIR=-I\$LMDGCM/../../lib |
---|
| 1022 | IOIPSL_LIBDIR=-L\$LMDGCM/../../lib |
---|
| 1023 | IOIPSL_LIB=-lioipsl |
---|
| 1024 | XIOS_INCDIR=-I\$LMDGCM/../XIOS/inc |
---|
| 1025 | XIOS_LIBDIR=-L\$LMDGCM/../XIOS/lib |
---|
| 1026 | XIOS_LIB="-lxios -lstdc++" |
---|
| 1027 | ORCH_INCDIR=-I\$LMDGCM/../../lib |
---|
| 1028 | ORCH_LIBDIR=-L\$LMDGCM/../../lib |
---|
| 1029 | EOF |
---|
[4427] | 1030 | else |
---|
[4849] | 1031 | cat <<EOF > arch-local.path |
---|
| 1032 | NETCDF_LIBDIR="-L$ncdfdir/lib -lnetcdff -lnetcdf" |
---|
| 1033 | NETCDF_INCDIR=-I$ncdfdir/include |
---|
| 1034 | NETCDF95_INCDIR=\$LMDGCM/../../include |
---|
| 1035 | NETCDF95_LIBDIR=\$LMDGCM/../../lib |
---|
| 1036 | IOIPSL_INCDIR=\$LMDGCM/../../lib |
---|
| 1037 | IOIPSL_LIBDIR=\$LMDGCM/../../lib |
---|
| 1038 | XIOS_INCDIR=\$LMDGCM/../XIOS/inc |
---|
| 1039 | XIOS_LIBDIR=\$LMDGCM/../XIOS/lib |
---|
| 1040 | ORCH_INCDIR=\$LMDGCM/../../lib |
---|
| 1041 | ORCH_LIBDIR=\$LMDGCM/../../lib |
---|
| 1042 | EOF |
---|
[4427] | 1043 | fi |
---|
| 1044 | |
---|
[4849] | 1045 | if [[ $pcmac == 1 ]]; then |
---|
[4427] | 1046 | BASE_LD="$BASE_LD -Wl,-rpath,${ncdfdir}/lib" |
---|
| 1047 | else |
---|
| 1048 | BASE_LD="$BASE_LD -Wl,-rpath=${ncdfdir}/lib" |
---|
| 1049 | fi |
---|
| 1050 | # Arch-local.fcm file (adapted from arch-linux-32bit.fcm) |
---|
| 1051 | |
---|
[4849] | 1052 | if [[ $real = r8 ]]; then FPP_DEF=NC_DOUBLE; else FPP_DEF=""; fi |
---|
| 1053 | sed -e s:"%COMPILER .*.$:%COMPILER $compiler":1 \ |
---|
| 1054 | -e s:"%LINK .*.$:%LINK $compiler":1 \ |
---|
| 1055 | -e s:"%PROD_FFLAGS .*.$:%PROD_FFLAGS $OPTIM":1 \ |
---|
| 1056 | -e s:"%DEV_FFLAGS .*.$:%DEV_FFLAGS $OPTDEV":1 \ |
---|
| 1057 | -e s:"%DEBUG_FFLAGS .*.$:%DEBUG_FFLAGS $OPTDEB":1 \ |
---|
| 1058 | -e s:"%BASE_FFLAGS .*.$:%BASE_FFLAGS $OPTPREC":1 \ |
---|
| 1059 | -e s:"%FPP_DEF .*.$:%FPP_DEF $FPP_DEF":1 \ |
---|
| 1060 | -e s:"%BASE_LD .*.$:%BASE_LD $BASE_LD":1 \ |
---|
| 1061 | -e s:"%ARFLAGS .*.$:%ARFLAGS $ARFLAGS":1 \ |
---|
[4427] | 1062 | arch-linux-32bit.fcm > arch-local.fcm |
---|
| 1063 | |
---|
| 1064 | cd .. |
---|
| 1065 | ### Adapt "bld.cfg" (add the shell): |
---|
| 1066 | #whereisthatshell=$(which ${use_shell}) |
---|
| 1067 | #echo "bld::tool::SHELL $whereisthatshell" >> bld.cfg |
---|
| 1068 | |
---|
[4849] | 1069 | fi # of if [[ "$pclinux" = 1 ]] |
---|
[4372] | 1070 | #--------------------------------------------------------------------- |
---|
[4210] | 1071 | # Option de compilation du rayonnement : depend de $mysvn ><= r4185 |
---|
[4372] | 1072 | #--------------------------------------------------------------------- |
---|
[4210] | 1073 | opt_rad="" |
---|
| 1074 | |
---|
| 1075 | case $rad in |
---|
[4849] | 1076 | oldrad) iflag_rrtm=0; NSW=2; opt_rad="";; |
---|
| 1077 | rrtm) iflag_rrtm=1; NSW=6 |
---|
| 1078 | if [[ $mysvn -le 4185 ]]; then |
---|
[4405] | 1079 | opt_rad="-rrtm true" |
---|
| 1080 | else |
---|
| 1081 | opt_rad="-rad rrtm" |
---|
[4849] | 1082 | fi;; |
---|
| 1083 | ecrad) iflag_rrtm=2; NSW=6; opt_rad="-rad ecrad";; |
---|
| 1084 | *) echo "Only oldrad rrtm ecrad for rad option"; exit 1 |
---|
[4210] | 1085 | esac |
---|
| 1086 | |
---|
[4849] | 1087 | if [[ $mysvn -le 4185 && $rad = "ecrad" ]]; then |
---|
| 1088 | echo "ecrad only available for LMDZ rev starting with 4186 "; exit 1 |
---|
[4218] | 1089 | fi |
---|
[4210] | 1090 | |
---|
| 1091 | ################################################################## |
---|
| 1092 | |
---|
[4213] | 1093 | |
---|
[4849] | 1094 | if [[ ! -f libf/misc/netcdf95.F90 && ! -d $MODEL/NetCDF95-0.3 ]]; then |
---|
| 1095 | cd "$MODEL" |
---|
[4577] | 1096 | myget src_archives/netcdf/NetCDF95-0.3.tar.gz |
---|
| 1097 | tar -xf NetCDF95-0.3.tar.gz |
---|
| 1098 | rm NetCDF95-0.3.tar.gz |
---|
| 1099 | cd NetCDF95-0.3 |
---|
[4213] | 1100 | mkdir build |
---|
| 1101 | cd build |
---|
[4849] | 1102 | cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$ncdfdir" \ |
---|
| 1103 | -DCMAKE_INSTALL_PREFIX="$MODEL/modipsl" |
---|
[4213] | 1104 | make install |
---|
[4849] | 1105 | cd "$MODEL/modipsl/modeles/"LMDZ* |
---|
[4213] | 1106 | fi |
---|
| 1107 | |
---|
[4210] | 1108 | echo '##################################################################' |
---|
| 1109 | echo "Preparing script compile.sh for LMDZ compilation" |
---|
| 1110 | echo "It will only be run automatically if bench=1/tuto" |
---|
[4849] | 1111 | echo "Here bench=$bench" |
---|
[4210] | 1112 | echo '##################################################################' |
---|
| 1113 | |
---|
[4849] | 1114 | if [[ $env_file != "" ]]; then |
---|
[4218] | 1115 | mv arch/arch-${arch}.env arch/arch-${arch}.orig |
---|
[4849] | 1116 | \cp -f "$env_file" arch/arch-${arch}.env |
---|
[4218] | 1117 | fi |
---|
[4210] | 1118 | |
---|
[4849] | 1119 | if [[ $compile_with_fcm = 1 ]]; then |
---|
[4218] | 1120 | makelmdz="makelmdz_fcm $optim -arch $arch -j 8 " |
---|
| 1121 | else |
---|
| 1122 | makelmdz="makelmdz $optim -arch $arch" |
---|
| 1123 | fi |
---|
[4210] | 1124 | |
---|
| 1125 | # sequential compilation |
---|
[4849] | 1126 | if [[ "$sequential" = 1 ]]; then |
---|
[4215] | 1127 | echo Sequential compilation command, saved in compile.sh: |
---|
[4218] | 1128 | echo "./$makelmdz $optim $OPT_MAKELMDZ $optim $opt_rad $opt_cosp " \ |
---|
[4405] | 1129 | "-d ${grid_resolution} -v $veget_version gcm " |
---|
[4218] | 1130 | echo "./$makelmdz $optim $OPT_MAKELMDZ $optim $opt_rad $opt_cosp " \ |
---|
[4405] | 1131 | "-d ${grid_resolution} -v $veget_version gcm " > compile.sh |
---|
[4215] | 1132 | chmod +x ./compile.sh |
---|
[4849] | 1133 | if [[ $bench = 1 ]]; then |
---|
| 1134 | echo "install_lmdz.sh start_lmdz_seq_compilation $(date)" |
---|
| 1135 | echo "log file: $lmdzlog" |
---|
| 1136 | ./compile.sh > "$lmdzlog" 2>&1 |
---|
| 1137 | echo "install_lmdz.sh end_lmdz_seq_compilation $(date)" |
---|
[4215] | 1138 | fi |
---|
[4210] | 1139 | fi # fin sequential |
---|
| 1140 | |
---|
| 1141 | # compiling in parallel mode |
---|
[4849] | 1142 | if [[ $parallel != "none" ]]; then |
---|
[4210] | 1143 | echo '##########################################################' |
---|
[4215] | 1144 | echo ' Parallel compile ' |
---|
[4210] | 1145 | echo '##########################################################' |
---|
[4215] | 1146 | echo "(after saving the sequential libs and binaries)" |
---|
[4849] | 1147 | cd "$MODEL/modipsl" |
---|
[4215] | 1148 | tar cf sequential.tar bin/ lib/ |
---|
| 1149 | # |
---|
| 1150 | # Orchidee |
---|
| 1151 | # |
---|
[4849] | 1152 | cd "$ORCHPATH" |
---|
| 1153 | if [[ -d src_parallel && $veget != 'NONE' ]]; then |
---|
[4405] | 1154 | cd arch |
---|
| 1155 | sed \ |
---|
[4849] | 1156 | -e s:"%COMPILER.*.$:%COMPILER $par_comp":1 \ |
---|
| 1157 | -e s:"%LINK.*.$:%LINK $par_comp":1 \ |
---|
| 1158 | -e s:"%MPI_FFLAG.*.$:%MPI_FFLAGS $MPI_FLAGS":1 \ |
---|
| 1159 | -e s:"%OMP_FFLAG.*.$:%OMP_FFLAGS $OMP_FLAGS":1 \ |
---|
| 1160 | -e s:"%MPI_LD.*.$:%MPI_LD $MPI_LD":1 \ |
---|
| 1161 | -e s:"%OMP_LD.*.$:%OMP_LD $OMP_LD":1 \ |
---|
[4405] | 1162 | arch-local.fcm > tmp.fcm |
---|
[4210] | 1163 | |
---|
[4405] | 1164 | mv tmp.fcm arch-local.fcm |
---|
| 1165 | cd ../ |
---|
[4849] | 1166 | echo "Compiling ORCHIDEE in parallel mode $(date)" |
---|
| 1167 | echo "logfile $orchideelog" |
---|
[4405] | 1168 | echo "NOTE : to recompile it when necessary, use ./compile_orc.sh " \ |
---|
| 1169 | "in modipsl/modeles/ORCHIDEE" |
---|
| 1170 | echo ./makeorchidee_fcm -j 8 -clean $xios_orchid $opt_orc \ |
---|
[4849] | 1171 | -parallel "$parallel" -arch $arch > compile_orc.sh |
---|
[4405] | 1172 | echo ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc \ |
---|
[4849] | 1173 | -parallel "$parallel" -arch $arch >> compile_orc.sh |
---|
[4405] | 1174 | echo echo Now you must also recompile LMDZ, by running ./compile.sh \ |
---|
| 1175 | in modeles/LMDZ >> compile_orc.sh |
---|
| 1176 | chmod u+x compile_orc.sh |
---|
| 1177 | ./makeorchidee_fcm -j 8 -clean $xios_orchid $opt_orc \ |
---|
[4849] | 1178 | -parallel "$parallel" -arch $arch > "$orchideelog" 2>&1 |
---|
| 1179 | ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc -parallel "$parallel" \ |
---|
| 1180 | -arch $arch >> "$orchideelog" 2>&1 |
---|
| 1181 | echo "End of ORCHIDEE compilation in parallel mode $(date)" |
---|
| 1182 | elif [[ $veget != 'NONE' ]]; then |
---|
[4405] | 1183 | echo '##########################################################' |
---|
| 1184 | echo ' Orchidee version too old ' |
---|
| 1185 | echo ' Please update to new version ' |
---|
| 1186 | echo '##########################################################' |
---|
[4849] | 1187 | exit 1 |
---|
| 1188 | fi #�of [ -d src_parallel && $veget != 'NONE' ] |
---|
[4210] | 1189 | |
---|
[4215] | 1190 | # LMDZ |
---|
[4849] | 1191 | cd "$LMDZPATH" |
---|
| 1192 | if [[ $arch = local ]]; then |
---|
[4405] | 1193 | cd arch |
---|
[4849] | 1194 | sed -e s:"%COMPILER.*.$:%COMPILER $par_comp":1 \ |
---|
| 1195 | -e s:"%LINK.*.$:%LINK $par_comp":1 \ |
---|
| 1196 | -e s:"%MPI_FFLAG.*.$:%MPI_FFLAGS $MPI_FLAGS":1 \ |
---|
| 1197 | -e s:"%OMP_FFLAG.*.$:%OMP_FFLAGS $OMP_FLAGS":1 \ |
---|
| 1198 | -e s:"%ARFLAGS.*.$:%ARFLAGS $ARFLAGS":1 \ |
---|
| 1199 | -e "s§%BASE_LD.*.$§%BASE_LD -Wl,-rpath=${root_mpi}/lib:${ncdfdir}/lib§1" \ |
---|
| 1200 | -e s:"%MPI_LD.*.$:%MPI_LD $MPI_LD":1 \ |
---|
| 1201 | -e s:"%OMP_LD.*.$:%OMP_LD $OMP_LD":1 \ |
---|
[4405] | 1202 | arch-local.fcm > tmp.fcm |
---|
| 1203 | mv tmp.fcm arch-local.fcm |
---|
| 1204 | cd ../ |
---|
[4215] | 1205 | fi |
---|
| 1206 | rm -f compile.sh |
---|
[4849] | 1207 | echo resol="$grid_resolution" >> compile.sh |
---|
| 1208 | if [[ ${hostname:0:5} = jean- && "$cosp" = "v2" ]]; then |
---|
[4210] | 1209 | |
---|
[4849] | 1210 | echo "LMDZ compilation command in parallel mode, saved in compile.sh, is :" |
---|
[4405] | 1211 | echo "(ATTENTION le probleme de cospv2 sur jean-zay en mode prod " \ |
---|
| 1212 | "n est pas corrige ! )" |
---|
| 1213 | # ATTENTION le probleme de cospv2 sur jean-zay en mode prod n |
---|
| 1214 | # est pas corrige |
---|
[4849] | 1215 | echo ./"$makelmdz" -dev $optim "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ |
---|
| 1216 | "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ |
---|
| 1217 | -parallel "$parallel" gcm >> compile.sh |
---|
| 1218 | echo ./"$makelmdz" -dev $optim "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ |
---|
| 1219 | "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ |
---|
| 1220 | -parallel "$parallel" gcm |
---|
[4215] | 1221 | else |
---|
[4849] | 1222 | echo ./"$makelmdz" $optim "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ |
---|
| 1223 | "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ |
---|
| 1224 | -parallel "$parallel" gcm >> compile.sh |
---|
| 1225 | echo ./"$makelmdz" $optim "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ |
---|
| 1226 | "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ |
---|
| 1227 | -parallel "$parallel" gcm |
---|
[4215] | 1228 | fi |
---|
| 1229 | chmod +x ./compile.sh |
---|
[4210] | 1230 | |
---|
[4849] | 1231 | if [[ $bench = 1 ]]; then |
---|
| 1232 | echo "Compiling LMDZ in parallel mode $(date), LMDZ log file: $lmdzlog" |
---|
| 1233 | ./compile.sh > "$lmdzlog" 2>&1 |
---|
[4215] | 1234 | fi |
---|
| 1235 | |
---|
[4849] | 1236 | fi # of if [[ $parallel != "none" ]] |
---|
[4210] | 1237 | |
---|
| 1238 | |
---|
| 1239 | ################################################################## |
---|
| 1240 | # Verification du succes de la compilation |
---|
| 1241 | ################################################################## |
---|
| 1242 | |
---|
| 1243 | # Recherche de l'executable dont le nom a change au fil du temps ... |
---|
| 1244 | # suffix contains radiative option starting with revision 4186 |
---|
[4849] | 1245 | if [[ $mysvn -ge 4186 ]]; then suff_exe=_${rad}${suff_exe}; fi |
---|
[4210] | 1246 | gcm="" |
---|
[4219] | 1247 | |
---|
[4218] | 1248 | for exe in gcm.e bin/gcm_${grid_resolution}_phylmd${suff_exe}${suff_orc}.e |
---|
| 1249 | do |
---|
[4849] | 1250 | if [[ -f $exe ]]; then gcm=$exe; fi |
---|
[4210] | 1251 | done |
---|
| 1252 | |
---|
[4849] | 1253 | if [[ "$gcm" = "" ]]; then |
---|
| 1254 | if [[ $bench = 1 ]]; then |
---|
[4405] | 1255 | echo 'Compilation failed !! Cannot run the benchmark;' |
---|
[4849] | 1256 | exit 1 |
---|
[4215] | 1257 | else |
---|
[4405] | 1258 | echo 'Compilation not done (only done when bench=1)' |
---|
[4215] | 1259 | fi |
---|
[4210] | 1260 | else |
---|
[4215] | 1261 | echo '##########################################################' |
---|
[4849] | 1262 | echo "Compilation successfull !! $(date)" |
---|
[4215] | 1263 | echo '##########################################################' |
---|
[4849] | 1264 | echo "The executable is $gcm" |
---|
[4210] | 1265 | fi |
---|
| 1266 | |
---|
| 1267 | ################################################################## |
---|
| 1268 | # Below, we run a benchmark if bench=1 or tuto |
---|
| 1269 | ################################################################## |
---|
| 1270 | |
---|
[4849] | 1271 | if [[ $bench = tuto ]]; then |
---|
| 1272 | myget Training/tutorial.tar; tar xf tutorial.tar; cd TUTORIAL |
---|
[4218] | 1273 | ./init.sh |
---|
[4210] | 1274 | |
---|
[4849] | 1275 | elif [[ $bench = 1 && ! -d BENCH${grid_resolution} ]]; then |
---|
[4215] | 1276 | # TOUTE CETTE SECTION DEVRAIT DISPARAITRE POUR UNE COMMANDE |
---|
| 1277 | # OU DES BENCHS PAR MOTS CLES COMME tuto |
---|
[4210] | 1278 | |
---|
[4215] | 1279 | echo '##########################################################' |
---|
| 1280 | echo ' Running a test run ' |
---|
| 1281 | echo '##########################################################' |
---|
[4210] | 1282 | |
---|
[4849] | 1283 | \rm -rf "BENCH${grid_resolution}" |
---|
[4215] | 1284 | bench=bench_lmdz_${grid_resolution} |
---|
[4849] | 1285 | echo "install_lmdz.sh before bench download $(date)" |
---|
[4215] | 1286 | #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/$bench.tar.gz |
---|
[4849] | 1287 | myget "3DBenchs/$bench.tar.gz" |
---|
| 1288 | echo "install_lmdz.sh after bench download $(date)" |
---|
| 1289 | tar xf "$bench.tar.gz" |
---|
[4210] | 1290 | |
---|
[4849] | 1291 | if [[ "$cosp" = "v1" || "$cosp" = "v2" ]]; then |
---|
| 1292 | cd "BENCH${grid_resolution}" |
---|
[4405] | 1293 | # copier les fichiers namelist input et output our COSP |
---|
| 1294 | cp ../DefLists/cosp*_input_nl.txt . |
---|
| 1295 | cp ../DefLists/cosp*_output_nl.txt . |
---|
| 1296 | # Activer la cles ok_cosp pour tourner avec COSP |
---|
| 1297 | sed -e 's@ok_cosp=n@ok_cosp=y@' config.def > tmp |
---|
| 1298 | \mv -f tmp config.def |
---|
| 1299 | cd .. |
---|
[4215] | 1300 | fi |
---|
[4210] | 1301 | |
---|
[4849] | 1302 | if [[ -n "$physiq" ]]; then |
---|
| 1303 | cd "BENCH${grid_resolution}" |
---|
| 1304 | if [[ -f "physiq.def_${physiq}" ]]; then |
---|
| 1305 | cp "physiq.def_${physiq}" physiq.def |
---|
| 1306 | echo using "physiq.def_${physiq}" |
---|
[4405] | 1307 | else |
---|
| 1308 | echo using standard physiq.def |
---|
| 1309 | fi |
---|
| 1310 | cd .. |
---|
[4215] | 1311 | else |
---|
[4405] | 1312 | echo using standard physiq.def |
---|
[4215] | 1313 | fi |
---|
[4210] | 1314 | |
---|
[4849] | 1315 | if [[ "$with_xios" = "y" ]]; then |
---|
| 1316 | cd "BENCH${grid_resolution}" |
---|
[4405] | 1317 | cp ../DefLists/iodef.xml . |
---|
| 1318 | cp ../DefLists/context_lmdz.xml . |
---|
| 1319 | cp ../DefLists/field_def_lmdz.xml . |
---|
| 1320 | # A raffiner par la suite |
---|
[4849] | 1321 | echo "A FAIRE : Copier les *xml en fonction de l option cosp" |
---|
[4405] | 1322 | cp ../DefLists/field_def_cosp*.xml . |
---|
| 1323 | cp ../DefLists/file_def_hist*xml . |
---|
| 1324 | # adapt iodef.xml to use attached mode |
---|
| 1325 | sed -e 's@"using_server" type="bool">true@"using_server" type="bool">false@' \ |
---|
| 1326 | iodef.xml > tmp |
---|
| 1327 | \mv -f tmp iodef.xml |
---|
[4210] | 1328 | |
---|
[4405] | 1329 | # and convert all the enabled="_AUTO_" (for libIGCM) to enabled=.FALSE. |
---|
| 1330 | # except for histday |
---|
| 1331 | for histfile in file_def_hist*xml |
---|
| 1332 | do |
---|
[4849] | 1333 | if [[ "$histfile" = "file_def_histday_lmdz.xml" ]]; then |
---|
[4405] | 1334 | sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".TRUE."@' \ |
---|
[4849] | 1335 | "$histfile" > tmp |
---|
| 1336 | \mv -f tmp "$histfile" |
---|
| 1337 | sed -e 's@output_level="_AUTO_"@output_level="5"@' "$histfile" \ |
---|
[4405] | 1338 | > tmp |
---|
[4849] | 1339 | \mv -f tmp "$histfile" |
---|
[4405] | 1340 | sed -e 's@compression_level="2"@compression_level="0"@' \ |
---|
[4849] | 1341 | "$histfile" > tmp |
---|
| 1342 | \mv -f tmp "$histfile" |
---|
[4405] | 1343 | else |
---|
| 1344 | sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".FALSE."@' \ |
---|
[4849] | 1345 | "$histfile" > tmp |
---|
| 1346 | \mv -f tmp "$histfile" |
---|
[4405] | 1347 | fi |
---|
| 1348 | done |
---|
| 1349 | # and add option "ok_all_xml=y" in config.def |
---|
| 1350 | echo "### XIOS outputs" >> config.def |
---|
| 1351 | echo 'ok_all_xml=.true.' >> config.def |
---|
[4210] | 1352 | |
---|
[4405] | 1353 | #activer les sorties pour Cosp |
---|
[4849] | 1354 | if [[ "$cosp" = "v1" ]]; then |
---|
[4807] | 1355 | sed -i'' -e 's@enabled=".FALSE."@enabled=".TRUE."@' \ |
---|
| 1356 | -e 's@output_level="_AUTO_"@output_level="5"@' \ |
---|
| 1357 | -e 's@compression_level="2"@compression_level="0"@' \ |
---|
| 1358 | file_def_histdayCOSP_lmdz.xml |
---|
[4405] | 1359 | fi |
---|
[4849] | 1360 | if [[ "$cosp" = "v2" ]]; then |
---|
[4807] | 1361 | sed -e 's@compression_level="2"@compression_level="0"@' file_def_histdayCOSPv2_lmdz.xml |
---|
[4849] | 1362 | for type_ in hf day mth; do |
---|
[4807] | 1363 | file=file_def_hist${type_}COSP |
---|
| 1364 | sed -i'' -e 's@src="./'${file}'_lmdz.xml"@src="./'${file}'v2_lmdz.xml"@' context_lmdz.xml |
---|
| 1365 | done |
---|
| 1366 | sed -i '' -e 's@field_def_cosp1.xml@field_def_cospv2.xml@' field_def_lmdz.xml |
---|
[4405] | 1367 | fi |
---|
[4210] | 1368 | |
---|
[4405] | 1369 | cd .. |
---|
[4215] | 1370 | fi |
---|
[4210] | 1371 | |
---|
[4215] | 1372 | # Cas Bensh avec ecrad |
---|
[4849] | 1373 | if [[ "$rad" = "ecrad" ]]; then |
---|
| 1374 | cd "BENCH${grid_resolution}" |
---|
[4405] | 1375 | cp ../DefLists/namelist_ecrad . |
---|
| 1376 | cp -r ../libf/phylmd/ecrad/data . |
---|
| 1377 | cd .. |
---|
[4215] | 1378 | fi |
---|
[4210] | 1379 | |
---|
[4215] | 1380 | # Adjusting bench physiq.def to radiative code chosen |
---|
[4849] | 1381 | cd "BENCH${grid_resolution}" |
---|
[4218] | 1382 | sed -e 's/iflag_rrtm=.*.$/iflag_rrtm='$iflag_rrtm'/' \ |
---|
[4405] | 1383 | -e 's/NSW=.*.$/NSW='$NSW'/' physiq.def > tmpdef |
---|
[4215] | 1384 | \mv tmpdef physiq.def |
---|
| 1385 | cd .. |
---|
[4210] | 1386 | |
---|
[4849] | 1387 | cp "$gcm" "BENCH${grid_resolution}/gcm.e" |
---|
[4210] | 1388 | |
---|
[4849] | 1389 | cd "BENCH${grid_resolution}" |
---|
[4215] | 1390 | # On cree le fichier bench.sh au besoin |
---|
| 1391 | # Dans le cas 48x36x39 le bench.sh existe deja en parallele |
---|
[4210] | 1392 | |
---|
[4849] | 1393 | if [[ "$grid_resolution" = "48x36x39" ]]; then |
---|
[4405] | 1394 | echo On ne touche pas au bench.sh |
---|
| 1395 | # But we have to adapt "run_local.sh" for $mpirun |
---|
| 1396 | sed -e "s@mpirun@$mpirun@g" run_local.sh > tmp |
---|
| 1397 | mv -f tmp run_local.sh |
---|
| 1398 | chmod u=rwx run_local.sh |
---|
[4849] | 1399 | elif [[ "${parallel:0:3}" = "mpi" ]]; then |
---|
[4405] | 1400 | # Lancement avec deux procs mpi et 2 openMP |
---|
| 1401 | echo "export OMP_STACKSIZE=800M" > bench.sh |
---|
[4849] | 1402 | if [[ "${parallel:4:3}" = "omp" ]]; then |
---|
[4215] | 1403 | echo "export OMP_NUM_THREADS=2" >> bench.sh |
---|
[4405] | 1404 | fi |
---|
[4849] | 1405 | if [[ "$cosp" = "v1" || "$cosp" = "v2" ]]; then |
---|
| 1406 | if [[ ${hostname:0:5} = jean- ]]; then |
---|
[4405] | 1407 | chmod +x ../arch.env |
---|
| 1408 | ../arch.env |
---|
| 1409 | echo "ulimit -s 2000000" >> bench.sh |
---|
[4215] | 1410 | else |
---|
[4405] | 1411 | echo "ulimit -s 200000" >> bench.sh |
---|
| 1412 | fi |
---|
| 1413 | else |
---|
[4215] | 1414 | echo "ulimit -s unlimited" >> bench.sh |
---|
[4405] | 1415 | fi |
---|
[4849] | 1416 | if [[ ${hostname:0:5} = jean- ]]; then |
---|
[4215] | 1417 | . ../arch/arch-${arch}.env |
---|
[4849] | 1418 | echo "srun -n 2 && $idris_acct@cpu gcm.e > listing 2>&1" \ |
---|
[4405] | 1419 | >> bench.sh |
---|
| 1420 | else |
---|
[4215] | 1421 | echo "$mpirun -np 2 gcm.e > listing 2>&1" >> bench.sh |
---|
[4405] | 1422 | fi |
---|
| 1423 | # Add rebuild, using reb.sh if it is there |
---|
[4849] | 1424 | cat <<EOF >> bench.sh |
---|
| 1425 | if [[ -f reb.sh ]]; then |
---|
| 1426 | ./reb.sh histday; ./reb.sh histmth; ./reb.sh histhf; |
---|
| 1427 | ./reb.sh histins; ./reb.sh stomate_history; |
---|
| 1428 | ./reb.sh sechiba_history; ./reb.sh sechiba_out_2 |
---|
| 1429 | fi |
---|
| 1430 | EOF |
---|
[4215] | 1431 | else |
---|
[4405] | 1432 | echo "./gcm.e > listing 2>&1" > bench.sh |
---|
[4215] | 1433 | fi |
---|
| 1434 | # Getting orchidee stuff |
---|
[4849] | 1435 | if [[ $veget == 'CMIP6' ]]; then |
---|
[4405] | 1436 | #echo 'myget 3DBenchs/BENCHorch11.tar.gz' |
---|
| 1437 | #myget 3DBenchs/BENCHorch11.tar.gz |
---|
| 1438 | #tar xvzf BENCHorch11.tar.gz |
---|
| 1439 | echo 'myget 3DBenchs/BENCHCMIP6.tar.gz' |
---|
| 1440 | myget 3DBenchs/BENCHCMIP6.tar.gz |
---|
| 1441 | tar xvzf BENCHCMIP6.tar.gz |
---|
| 1442 | sed -e "s:VEGET=n:VEGET=y:" config.def > tmp |
---|
| 1443 | mv -f tmp config.def |
---|
[4849] | 1444 | if [[ "$with_xios" = "y" ]]; then |
---|
[4215] | 1445 | cp ../../ORCHIDEE/src_xml/context_orchidee.xml . |
---|
[4218] | 1446 | echo '<context id="orchidee" src="./context_orchidee.xml"/>' \ |
---|
[4405] | 1447 | > add.tmp |
---|
[4215] | 1448 | cp ../../ORCHIDEE/src_xml/field_def_orchidee.xml . |
---|
| 1449 | cp ../../ORCHIDEE/src_xml/file_def_orchidee.xml . |
---|
| 1450 | cp ../../ORCHIDEE/src_xml/file_def_input_orchidee.xml . |
---|
[4849] | 1451 | if [[ -f ../../ORCHIDEE/src_xml/context_input_orchidee.xml ]]; then |
---|
[4405] | 1452 | cp ../../ORCHIDEE/src_xml/context_input_orchidee.xml . |
---|
| 1453 | echo '<context id="orchidee" ' \ |
---|
| 1454 | 'src="./context_input_orchidee.xml"/>' >> add.tmp |
---|
[4215] | 1455 | fi |
---|
| 1456 | sed -e '/id="LMDZ"/r add.tmp' iodef.xml > tmp |
---|
| 1457 | mv tmp iodef.xml |
---|
[4218] | 1458 | sed -e'{/sechiba1/ s/enabled="_AUTO_"/type="one_file" enabled=".TRUE."/}' \ |
---|
[4405] | 1459 | file_def_orchidee.xml > tmp |
---|
| 1460 | \mv -f tmp file_def_orchidee.xml |
---|
[4218] | 1461 | sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".FALSE."@' \ |
---|
[4405] | 1462 | file_def_orchidee.xml > tmp |
---|
| 1463 | \mv -f tmp file_def_orchidee.xml |
---|
[4218] | 1464 | sed -e 's@output_level="_AUTO_"@output_level="1"@' \ |
---|
[4405] | 1465 | file_def_orchidee.xml > tmp |
---|
| 1466 | \mv -f tmp file_def_orchidee.xml |
---|
[4218] | 1467 | sed -e 's@output_freq="_AUTO_"@output_freq="1d"@' \ |
---|
[4405] | 1468 | file_def_orchidee.xml > tmp |
---|
| 1469 | \mv -f tmp file_def_orchidee.xml |
---|
[4218] | 1470 | sed -e 's@compression_level="4"@compression_level="0"@' \ |
---|
[4405] | 1471 | file_def_orchidee.xml > tmp |
---|
| 1472 | \mv -f tmp file_def_orchidee.xml |
---|
[4218] | 1473 | sed -e 's@XIOS_ORCHIDEE_OK = n@XIOS_ORCHIDEE_OK = y@' \ |
---|
[4405] | 1474 | orchidee.def > tmp |
---|
| 1475 | \mv -f tmp orchidee.def |
---|
| 1476 | fi |
---|
[4215] | 1477 | fi |
---|
[4220] | 1478 | |
---|
| 1479 | if [[ -f ../arch.env ]] |
---|
| 1480 | then |
---|
[4405] | 1481 | source ../arch.env |
---|
[4220] | 1482 | fi |
---|
| 1483 | |
---|
[4215] | 1484 | echo EXECUTION DU BENCH |
---|
| 1485 | set +e |
---|
[4849] | 1486 | date; ./bench.sh > out.bench 2>&1; date |
---|
[4215] | 1487 | set -e |
---|
| 1488 | tail listing |
---|
[4210] | 1489 | |
---|
| 1490 | |
---|
[4849] | 1491 | echo "##########################################################" |
---|
| 1492 | echo "Simulation finished in $(pwd)" |
---|
| 1493 | echo "You have compiled with:" |
---|
[4215] | 1494 | cat ../compile.sh |
---|
[4849] | 1495 | if [[ $parallel = "none" ]]; then |
---|
| 1496 | echo "You may re-run it with : cd $(pwd) ; gcm.e" |
---|
| 1497 | echo "or ./bench.sh" |
---|
[4215] | 1498 | else |
---|
[4849] | 1499 | echo "You may re-run it with : " |
---|
| 1500 | echo "cd $(pwd) ; ./bench.sh" |
---|
[4405] | 1501 | # echo 'ulimit -s unlimited' |
---|
| 1502 | # echo 'export OMP_NUM_THREADS=2' |
---|
| 1503 | # echo 'export OMP_STACKSIZE=800M' |
---|
| 1504 | # echo "$mpirun -np 2 gcm.e " |
---|
[4215] | 1505 | fi |
---|
| 1506 | echo '##########################################################' |
---|
[4210] | 1507 | |
---|
| 1508 | fi # bench |
---|
| 1509 | |
---|
| 1510 | |
---|
| 1511 | ################################################################# |
---|
| 1512 | # Installation eventuelle du 1D |
---|
| 1513 | ################################################################# |
---|
| 1514 | |
---|
[4849] | 1515 | if [[ $SCM = 1 ]]; then |
---|
| 1516 | cd "$MODEL" |
---|
[4215] | 1517 | myget 1D/1D.tar.gz |
---|
[4286] | 1518 | tar xf 1D.tar.gz |
---|
[4215] | 1519 | cd 1D |
---|
[4849] | 1520 | if [[ $rad = oldrad ]]; then |
---|
[4422] | 1521 | sed -i'' -e 's/^rad=.*$/rad=oldrad/' run.sh |
---|
| 1522 | sed -i'' -e 's/^rad=.*$/rad=oldrad/' bin/compile |
---|
| 1523 | fi |
---|
[4849] | 1524 | echo "Running 1D/run.sh, log in $(pwd)/run1d.log" |
---|
| 1525 | ./run.sh > "$(pwd)/run1d.log" 2>&1 |
---|
[4210] | 1526 | fi |
---|
| 1527 | |
---|
[4409] | 1528 | |
---|
[4210] | 1529 | ################################################################# |
---|
| 1530 | # sauvegarde des options veget pour utilisation eventuelle tutorial_prod |
---|
| 1531 | ################################################################# |
---|
[4849] | 1532 | cd "$MODEL/modipsl/modeles" |
---|
[4210] | 1533 | #echo surface_env file created in $MODEL |
---|
[4849] | 1534 | cat <<EOF >surface_env |
---|
| 1535 | veget=$veget |
---|
| 1536 | opt_veget="-v $veget_version" |
---|
| 1537 | orchidee_rev=$orchidee_rev |
---|
| 1538 | suforch=$suff_orc |
---|
| 1539 | EOF |
---|