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