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