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