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