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