[1588] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | ########################################################################### |
---|
[1708] | 4 | # Author : Frédéric Hourdin/LMD/hourdin@lmd.jussieu.fr |
---|
[1588] | 5 | # Usage : install.sh |
---|
| 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 | # |
---|
[1708] | 24 | # Prerequisites : g95/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 | |
---|
[1588] | 38 | echo '################################################################' |
---|
[1708] | 39 | echo Choice of installation options |
---|
[1588] | 40 | echo '################################################################' |
---|
| 41 | |
---|
| 42 | |
---|
[1590] | 43 | #real=r4 |
---|
[1589] | 44 | real=r8 |
---|
| 45 | |
---|
[1708] | 46 | # WARNING !!!! For versions before october 2009, use |
---|
| 47 | # install.v2.sh instead of install.sh |
---|
[1588] | 48 | |
---|
[1800] | 49 | version=20130716.trunk |
---|
[1693] | 50 | version=testing |
---|
[2031] | 51 | compilo=gfortran # compilo=pgf90 or g95 or gfortran or ifort sur PC linux |
---|
[1693] | 52 | |
---|
[1588] | 53 | #Chemin pour placer le modele |
---|
| 54 | MODEL=./LMDZ$version |
---|
| 55 | |
---|
[2031] | 56 | |
---|
[1588] | 57 | getlmdzor=1 |
---|
| 58 | netcdf=1 # 1 for automatic installation |
---|
| 59 | # 0 for no installation |
---|
| 60 | # /.../../netcdf-4.0.1 if wanting to link with an already |
---|
| 61 | # compiled netcdf library (implies to check option compatibility) |
---|
| 62 | check_linux=1 |
---|
| 63 | ioipsl=1 |
---|
[1693] | 64 | veget=1 |
---|
[1588] | 65 | bench=1 |
---|
| 66 | pclinux=1 |
---|
| 67 | |
---|
[2031] | 68 | # choose the resolution for the bench runs |
---|
| 69 | # grid_resolution= 32x24x11 or 48x36x19 for tests (test without ORCHIDEE) |
---|
| 70 | # 96x71x19 standard configuration |
---|
| 71 | grid_resolution=48x36x19 |
---|
[1693] | 72 | |
---|
[2031] | 73 | ## compile_with_fcm=1 : use makelmdz_fcm, possible a of version 20111103.trunk (LMDZ5/trunk rev 1578) |
---|
| 74 | ## compile_with_fcm=0 : use makelmdz |
---|
| 75 | compile_with_fcm=0 |
---|
| 76 | |
---|
| 77 | |
---|
[1693] | 78 | ##################################################################### |
---|
| 79 | # Test for old gfortran compilers |
---|
[2030] | 80 | # If the compiler is too old (older than 4.3.x) we test if the |
---|
| 81 | # temporary gfortran44 patch is available on the computer in which |
---|
| 82 | # case the compiler is changed from gfortran to gfortran44 |
---|
| 83 | # Must be aware than parallelism can not be activated in this case |
---|
| 84 | ##################################################################### |
---|
| 85 | |
---|
[1693] | 86 | if [ $compilo = gfortran ] ; then |
---|
[2030] | 87 | gfortran=gfortran |
---|
[1693] | 88 | gfortranv=`gfortran --version | \ |
---|
| 89 | head -1 | awk ' { print $NF } ' | awk -F. ' { print $1 * 10 + $2 } '` |
---|
| 90 | if [ $gfortranv -le 43 ] ; then |
---|
[1708] | 91 | echo ERROR : Your gfortran compiler is too old |
---|
[1693] | 92 | echo 'Please choose a new one (g95, ifort) and change the line' |
---|
| 93 | echo compilo=xxx |
---|
| 94 | echo in the install.sh script and rerun it |
---|
[2030] | 95 | if [ `which gfortran44 | wc -w` -ne 0 ] ; then |
---|
| 96 | gfortran=gfortran44 |
---|
| 97 | else |
---|
| 98 | echo gfotran trop vieux ; exit |
---|
| 99 | fi |
---|
[1693] | 100 | fi |
---|
[2030] | 101 | compilo=$gfortran |
---|
[1693] | 102 | fi |
---|
| 103 | ##################################################################### |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | |
---|
[1589] | 107 | OPTPREC="" |
---|
[1588] | 108 | echo '################################################################' |
---|
| 109 | echo Choix des options de compilation |
---|
| 110 | echo '################################################################' |
---|
[1589] | 111 | |
---|
[2031] | 112 | OPTIMNC=$OPTIM |
---|
| 113 | export FC=$compilo |
---|
| 114 | export F90=$compilo |
---|
| 115 | export F77=$compilo |
---|
| 116 | export CPPFLAGS= |
---|
| 117 | BASE_LD= |
---|
[1588] | 118 | if [ $compilo = g95 ] ; then |
---|
[2031] | 119 | # Set the appropriate compilation options |
---|
| 120 | OPTIM='-i4 -O3' |
---|
| 121 | OPTDEB="-g -O0 -Wall -ftrace=full -fbounds-check -freal=nan" |
---|
| 122 | OPTDEV="-g -O1 -Wall" |
---|
| 123 | fmod='fmod=' |
---|
| 124 | BASE_LD="" |
---|
[1589] | 125 | if [ $real = r8 ] ; then OPTPREC="-r8 -DNC_DOUBLE" ; fi |
---|
[2031] | 126 | export F90FLAGS=" -cpp -ffree-form $OPTIMNC" |
---|
| 127 | export FFLAGS=" -cpp $OPTIMNC" |
---|
| 128 | export CPPFLAGS=-Df2cFortran |
---|
| 129 | export CC=gcc |
---|
| 130 | export CXX=g++ |
---|
[2030] | 131 | elif [ $compilo = $gfortran ] ; then |
---|
[2031] | 132 | OPTIM='-O3' |
---|
| 133 | OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all" |
---|
| 134 | OPTDEV="-Wall -fbounds-check" |
---|
| 135 | fmod='I ' |
---|
[1589] | 136 | if [ $real = r8 ] ; then OPTPREC="-fdefault-real-8 -DNC_DOUBLE" ; fi |
---|
[2031] | 137 | export F90FLAGS=" -ffree-form $OPTIMNC" |
---|
| 138 | export FFLAGS=" $OPTIMNC" |
---|
| 139 | export CC=gcc |
---|
| 140 | export CXX=g++ |
---|
| 141 | elif [ $compilo = mpif90 ] ; then |
---|
[1589] | 142 | OPTIM='-O3' |
---|
[2031] | 143 | OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all" |
---|
| 144 | OPTDEV="-Wall -fbounds-check" |
---|
| 145 | BASE_LD="-lblas" |
---|
| 146 | fmod='I ' |
---|
| 147 | if [ $real = r8 ] ; then OPTPREC="-fdefault-real-8 -DNC_DOUBLE -fcray-pointer" ; fi |
---|
| 148 | export F90FLAGS=" -ffree-form $OPTIMNC" |
---|
| 149 | export FFLAGS=" $OPTIMNC" |
---|
| 150 | export CC=gcc |
---|
| 151 | export CXX=g++ |
---|
[1590] | 152 | elif [ $compilo = pgf90 ] ; then |
---|
[2031] | 153 | OPTIM='-O2 -Munroll -Mnoframe -Mautoinline -Mcache_align' |
---|
| 154 | fmod='module ' |
---|
[1590] | 155 | if [ $real = r8 ] ; then OPTPREC="-r8 -DNC_DOUBLE" ; fi |
---|
[2031] | 156 | export CPPFLAGS="-DNDEBUG -DpgiFortran" |
---|
| 157 | export CC=pgcc |
---|
| 158 | export CFLAGS="-Msignextend" |
---|
| 159 | export CXX=pgCC |
---|
| 160 | export CXXFLAGS="-Msignextend" |
---|
| 161 | export FFLAGS="$OPTIMNC" |
---|
| 162 | export F90FLAGS="$OPTIMNC" |
---|
[1590] | 163 | compile_with_fcm=1 |
---|
[2031] | 164 | elif [ $compilo = ifort ] ; then |
---|
| 165 | OPTIM="-O2 -fp-model strict -ip -align all " |
---|
| 166 | OPTDEV="-p -g -O2 -traceback -fp-stack-check -ftrapuv -check" |
---|
| 167 | OPTDEB="-g -no-ftz -traceback -ftrapuv -fp-stack-check -check" |
---|
| 168 | fmod='module ' |
---|
[1590] | 169 | if [ $real = r8 ] ; then OPTPREC="-real-size 64 -DNC_DOUBLE" ; fi |
---|
[2031] | 170 | export CPP="icc -E" |
---|
| 171 | export FFLAGS="-O2 -ip -fpic -mcmodel=large" |
---|
| 172 | export FCFLAGS="-O2 -ip -fpic -mcmodel=large" |
---|
| 173 | export CC=icc |
---|
| 174 | export CFLAGS="-O2 -ip -fpic -mcmodel=large" |
---|
| 175 | export CXX=icpc |
---|
| 176 | export CXXFLAGS="-O2 -ip -fpic -mcmodel=large" |
---|
[1590] | 177 | compile_with_fcm=1 |
---|
[2031] | 178 | else |
---|
| 179 | echo unexpected compiler $compilo ; exit |
---|
[1588] | 180 | fi |
---|
[2031] | 181 | |
---|
[1589] | 182 | OPTIMGCM="$OPTIM $OPTPREC" |
---|
[1588] | 183 | |
---|
| 184 | hostname=`hostname` |
---|
| 185 | |
---|
| 186 | ########################################################################## |
---|
[1731] | 187 | # If installing on know machines such as IBM x3750 (Ada) |
---|
[1708] | 188 | # at IDRIS, don't check for available software and don"t install netcdf |
---|
[1777] | 189 | if [ ${hostname:0:5} = ada33 ] ; then |
---|
[1731] | 190 | netcdf=0 # no need to recompile netcdf, alreday available |
---|
| 191 | check_linux=0 |
---|
| 192 | pclinux=0 |
---|
| 193 | ioipsl=0 # no need to recompile ioipsl, already available |
---|
| 194 | #netcdf="/smplocal/pub/NetCDF/4.1.3" |
---|
| 195 | compilo="ifort" |
---|
| 196 | fmod='module ' |
---|
| 197 | if [ $real = r8 ] ; then OPTPREC="-real-size 64 -DNC_DOUBLE" ; fi |
---|
| 198 | OPTIM="-O2 -fp-model strict -ip -axAVX,SSE4.2 -align all " |
---|
| 199 | OPTIMGCM="$OPTIM $OPTPREC" |
---|
[1588] | 200 | fi |
---|
| 201 | ########################################################################## |
---|
| 202 | |
---|
| 203 | |
---|
| 204 | mkdir -p $MODEL |
---|
| 205 | echo $MODEL |
---|
[1708] | 206 | MODEL=`( cd $MODEL ; pwd )` # to get absolute path, if necessary |
---|
[1588] | 207 | |
---|
| 208 | |
---|
| 209 | |
---|
[1708] | 210 | # Option -fendian=big is only to be used with ARPEGE1D. |
---|
| 211 | # The -r8 should probably be avoided if running on 32 bit machines |
---|
| 212 | # Option r8 is not mandatory and generates larger executables. |
---|
| 213 | # It is however mandatory if using ARPEGE1D |
---|
| 214 | # Better optimization options might be a better choice (e.g. -O3) |
---|
[1588] | 215 | |
---|
| 216 | |
---|
| 217 | echo '################################################################' |
---|
| 218 | if [ "$check_linux" = 1 ] ; then |
---|
[1708] | 219 | echo Check if required software is available |
---|
[1588] | 220 | echo '################################################################' |
---|
| 221 | |
---|
| 222 | #### Ehouarn: test if ksh and/or bash are available |
---|
| 223 | use_shell="ksh" # default: use ksh |
---|
| 224 | if [ "`which ksh`" = "" ] ; then |
---|
[1708] | 225 | echo "no ksh ... we will use bash" |
---|
[1588] | 226 | use_shell="bash" |
---|
| 227 | if [ "`which bash`" = "" ] ; then |
---|
[1708] | 228 | echo "ksh (or bash) needed!! Install it!" |
---|
[1588] | 229 | fi |
---|
| 230 | fi |
---|
| 231 | |
---|
| 232 | |
---|
| 233 | for logiciel in csh wget tar gzip make $compilo gcc ; do |
---|
| 234 | if [ "`which $logiciel`" = "" ] ; then |
---|
[1708] | 235 | echo You must first install $logiciel on your system |
---|
[1588] | 236 | exit |
---|
| 237 | fi |
---|
| 238 | done |
---|
| 239 | |
---|
| 240 | if [ $pclinux = 1 ] ; then |
---|
| 241 | cd $MODEL |
---|
[2030] | 242 | cat <<eod > tt.f90 |
---|
[1588] | 243 | print*,'coucou' |
---|
| 244 | end |
---|
| 245 | eod |
---|
[1708] | 246 | $compilo tt.f90 -o a.out |
---|
[1588] | 247 | ./a.out >| tt |
---|
| 248 | if [ "`cat tt | sed -e 's/ //g' `" != "coucou" ] ; then |
---|
[1708] | 249 | echo problem installing with compiler $compilo ; exit ; fi |
---|
[1588] | 250 | \rm tt a.out tt.f90 |
---|
| 251 | fi |
---|
| 252 | fi |
---|
| 253 | |
---|
| 254 | ########################################################################### |
---|
| 255 | if [ $getlmdzor = 1 ] ; then |
---|
| 256 | echo '##########################################################' |
---|
[1708] | 257 | echo Download a slightly modified version of LMDZ |
---|
[1588] | 258 | echo '##########################################################' |
---|
| 259 | cd $MODEL |
---|
| 260 | wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/modipsl.$version.tar.gz |
---|
[2030] | 261 | echo install.sh wget_OK `date` |
---|
[1588] | 262 | gunzip modipsl.$version.tar.gz |
---|
| 263 | tar xvf modipsl.$version.tar |
---|
| 264 | \rm modipsl.$version.tar |
---|
| 265 | |
---|
[1708] | 266 | # We download LMDZ and make some modifications to make it |
---|
| 267 | #compatible with $compilo |
---|
| 268 | # and we use an old stable but robust and well tested version of ORCHIDEE |
---|
| 269 | # That version of ORCHIDEE can be obtained using |
---|
[1588] | 270 | # wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/getlmdzor.x |
---|
| 271 | fi |
---|
| 272 | |
---|
| 273 | echo OK1 |
---|
| 274 | |
---|
| 275 | if [ $netcdf = 1 ] ; then |
---|
| 276 | echo '##########################################################' |
---|
[1708] | 277 | echo Compiling the Netcdf library |
---|
[1588] | 278 | echo '##########################################################' |
---|
| 279 | cd $MODEL |
---|
| 280 | wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/netcdf-4.0.1.tar.gz |
---|
| 281 | gunzip netcdf-4.0.1.tar.gz |
---|
| 282 | tar xvf netcdf-4.0.1.tar |
---|
| 283 | \rm -f netcdf-4.0.1.tar |
---|
| 284 | |
---|
| 285 | cd netcdf-4.0.1 |
---|
| 286 | |
---|
[2030] | 287 | sed -e 's/gfortran/'$gfortran'/g' configure >| tmp ; mv -f tmp configure ; chmod +x configure |
---|
[1588] | 288 | localdir=`pwd -P` |
---|
| 289 | ./configure --prefix=$localdir |
---|
[2030] | 290 | sed -e 's/gfortran/'$gfortran'/g' Makefile >| tmp ; mv -f tmp Makefile |
---|
[1588] | 291 | make check |
---|
| 292 | make install |
---|
[2030] | 293 | echo install.sh netcdf_OK `date` |
---|
[1731] | 294 | fi # of if [ $netcdf = 1 ] |
---|
[1588] | 295 | |
---|
[2030] | 296 | |
---|
[1800] | 297 | #======================================================================================= |
---|
[1588] | 298 | echo OK2 ioipsl=$ioipsl |
---|
| 299 | echo '##########################################################' |
---|
[1731] | 300 | echo 'Installing MODIPSL, the installation package manager for the ' |
---|
| 301 | echo 'IPSL models and tools' |
---|
[1588] | 302 | echo '##########################################################' |
---|
| 303 | |
---|
| 304 | if [ $netcdf = 0 -o $netcdf = 1 ] ; then |
---|
| 305 | ncdfdir=$MODEL/netcdf-4.0.1 |
---|
| 306 | else |
---|
| 307 | ncdfdir=$netcdf |
---|
| 308 | fi |
---|
| 309 | |
---|
| 310 | if [ $ioipsl = 1 ] ; then |
---|
[1731] | 311 | cd $MODEL/modipsl |
---|
[2030] | 312 | \rm -rf lib/* |
---|
[2031] | 313 | |
---|
[1731] | 314 | cd util |
---|
[1588] | 315 | |
---|
[1731] | 316 | cp AA_make.gdef AA_make.orig |
---|
[2031] | 317 | F_C="$compilo -c " ; if [ "$compilo" = "$gfortran" -o "$compilo" = "mpif90" ] ; then F_C="$compilo -c -cpp " ; fi |
---|
[1731] | 318 | sed -e 's/^\#.*.g95.*.\#.*.$/\#/' AA_make.gdef > tmp |
---|
[1800] | 319 | sed -e "s:F_L = g95:F_L = $compilo:" -e "s:F_C = g95 -c:F_C = $F_C": \ |
---|
[1731] | 320 | -e 's/g95.*.w_w.*.(F_D)/g95 w_w = '"$OPTIMGCM"'/' \ |
---|
| 321 | -e 's:g95.*.NCDF_INC.*.$:g95 NCDF_INC= '"$ncdfdir"'/include:' \ |
---|
| 322 | -e 's:g95.*.NCDF_LIB.*.$:g95 NCDF_LIB= -L'"$ncdfdir"'/lib -lnetcdf:' \ |
---|
| 323 | -e "s:-fmod=:-$fmod:" -e 's/-fno-second-underscore//' \ |
---|
| 324 | -e 's:#-Q- g95 M_K = gmake:#-Q- g95 M_K = make:' \ |
---|
| 325 | tmp >| AA_make.gdef |
---|
[1588] | 326 | |
---|
| 327 | |
---|
[1731] | 328 | if [ "$use_shell" = "ksh" ] ; then |
---|
| 329 | if [ "$pclinux" = 1 ] ; then |
---|
| 330 | ./ins_make -t g95 # We use lines for g95 even for the other compilers |
---|
| 331 | fi |
---|
| 332 | else # bash |
---|
| 333 | sed -e s:/bin/ksh:/bin/bash:g ins_make > ins_make.bash |
---|
| 334 | chmod u=rwx ins_make.bash |
---|
| 335 | if [ "$pclinux" = 1 ] ; then |
---|
| 336 | ./ins_make.bash -t g95 # We use lines for g95 even for the other compilers |
---|
| 337 | else |
---|
| 338 | ./ins_make.bash |
---|
| 339 | fi |
---|
| 340 | fi # of if [ "$use_shell" = "ksh" ] |
---|
| 341 | |
---|
[2031] | 342 | #======================================================================================= |
---|
[1731] | 343 | echo '##########################################################' |
---|
| 344 | echo 'Compiling IOIPSL, the interface library with Netcdf' |
---|
| 345 | echo '##########################################################' |
---|
| 346 | |
---|
| 347 | cd $MODEL/modipsl/modeles/IOIPSL/src |
---|
| 348 | if [ "$use_shell" = "bash" ] ; then |
---|
| 349 | cp Makefile Makefile.ksh |
---|
| 350 | sed -e s:/bin/ksh:/bin/bash:g Makefile.ksh > Makefile |
---|
[1588] | 351 | fi |
---|
| 352 | if [ "$pclinux" = 1 ] ; then |
---|
[1731] | 353 | # Build IOIPSL modules and library |
---|
[1800] | 354 | if [ $compilo = g95 ] ; then |
---|
| 355 | cp restcom.f90 restcom.f90.orig |
---|
| 356 | sed -e 's:cmode=or(NF90_NOCLOBBER,NF90_64BIT_OFFSET):cmode=NF90_NOCLOBBER:' restcom.f90.orig > restcom.f90 |
---|
| 357 | fi |
---|
[1731] | 358 | make clean |
---|
| 359 | make |
---|
[2031] | 360 | if [ "$compilo" = "$gfortran" -o "$compilo" = "mpif90" ] ; then # copy module files to lib |
---|
[1731] | 361 | cp -f *.mod ../../../lib |
---|
| 362 | fi |
---|
| 363 | # Build IOIPSL tools (ie: "rebuild", if present) |
---|
| 364 | if [ -f $MODEL/modipsl/modeles/IOIPSL/tools/rebuild ] ; then |
---|
| 365 | cd $MODEL/modipsl/modeles/IOIPSL/tools |
---|
| 366 | # adapt Makefile & rebuild script if in bash |
---|
| 367 | if [ "$use_shell" = "bash" ] ; then |
---|
| 368 | cp Makefile Makefile.ksh |
---|
| 369 | sed -e s:/bin/ksh:/bin/bash:g Makefile.ksh > Makefile |
---|
| 370 | cp rebuild rebuild.ksh |
---|
| 371 | sed -e 's:/bin/ksh:/bin/bash:g' \ |
---|
| 372 | -e 's:print -u2:echo:g' \ |
---|
| 373 | -e 's:print:echo:g' rebuild.ksh > rebuild |
---|
| 374 | fi |
---|
| 375 | make clean |
---|
| 376 | make |
---|
| 377 | fi |
---|
| 378 | fi # of if [ "$pclinux" = 1 ] |
---|
[1588] | 379 | |
---|
[1731] | 380 | else # of if [ $ioipsl = 1 ] |
---|
[1777] | 381 | if [ ${hostname:0:5} = ada33 ] ; then |
---|
[1731] | 382 | cd $MODEL/modipsl |
---|
| 383 | cd util |
---|
[1588] | 384 | |
---|
[1731] | 385 | cp AA_make.gdef AA_make.orig |
---|
| 386 | sed -e 's/^\#.*.g95.*.\#.*.$/\#/' AA_make.gdef > tmp |
---|
| 387 | sed -e "s:F_L = g95:F_L = $compilo:" -e "s:F_C = g95 -c:F_C = $compilo -c": \ |
---|
| 388 | -e 's/g95.*.w_w.*.(F_D)/g95 w_w = '"$OPTIMGCM"'/' \ |
---|
| 389 | -e 's:g95.*.NCDF_INC.*.$:g95 NCDF_INC= -I/smplocal/pub/HDF5/1.8.9/seq/include -I/smplocal/pub/NetCDF/4.1.3/include:' \ |
---|
| 390 | -e 's:g95.*.NCDF_LIB.*.$:g95 NCDF_LIB= -L/smplocal/pub/NetCDF/4.1.3/lib -lnetcdff -lnetcdf:' \ |
---|
| 391 | -e "s:-fmod=:-$fmod:" -e 's/-fno-second-underscore//' \ |
---|
| 392 | -e 's:#-Q- g95 M_K = gmake:#-Q- g95 M_K = make:' \ |
---|
| 393 | tmp >| AA_make.gdef |
---|
| 394 | |
---|
| 395 | ./ins_make -t g95 # We use lines for g95 even for the other compilers |
---|
| 396 | |
---|
| 397 | # on Ada, IOIPSL is already installed in ~rpsl035/IOIPSL_PLUS |
---|
| 398 | # so link it to current settings |
---|
| 399 | cd $MODEL/modipsl/modeles/ |
---|
| 400 | \rm -r -f IOIPSL |
---|
| 401 | ln -s ~rpsl035/IOIPSL_PLUS IOIPSL |
---|
| 402 | cd .. |
---|
| 403 | ln -s ~rpsl035/IOIPSL_PLUS/modipsl/bin/* bin/ |
---|
| 404 | ln -s ~rpsl035/IOIPSL_PLUS/modipsl/lib/* lib/ |
---|
| 405 | |
---|
[1777] | 406 | fi # of if [ ${hostname:0:5} = ada33 ] |
---|
[2030] | 407 | echo install.sh ioipsl_OK `date` |
---|
[1731] | 408 | fi # of if [ $ioipsl = 1 ] |
---|
| 409 | |
---|
[2030] | 410 | |
---|
[1800] | 411 | #============================================================================ |
---|
[1837] | 412 | veget_version=false |
---|
[1731] | 413 | if [ "$veget" = 1 ] ; then |
---|
| 414 | echo '########################################################' |
---|
| 415 | echo 'Compiling ORCHIDEE, the continental surfaces model ' |
---|
| 416 | echo '########################################################' |
---|
| 417 | cd $MODEL/modipsl/modeles/ORCHIDEE |
---|
[1800] | 418 | echo OKpwd ; pwd |
---|
| 419 | if [ -d src_parallel ] ; then |
---|
| 420 | liste_src="parallel parameters global stomate sechiba driver" |
---|
[1837] | 421 | veget_version=orchidee2.0 |
---|
[1800] | 422 | else |
---|
| 423 | # Obsolete, for ORCHIDEE_beton only |
---|
| 424 | liste_src="parameters stomate sechiba " |
---|
| 425 | # A trick to compile ORCHIDEE depending on if we are using real*4 or real*8 |
---|
| 426 | cd src_parameters ; \cp reqdprec.$real reqdprec.f90 ; cd .. |
---|
[1837] | 427 | veget_version=orchidee1.9 |
---|
[1800] | 428 | fi |
---|
| 429 | echo liste_strc $liste_src |
---|
[1731] | 430 | |
---|
[1800] | 431 | for d in $liste_src ; do src_d=src_$d |
---|
| 432 | echo src_d $src_d |
---|
| 433 | echo ls ; ls |
---|
| 434 | if [ ! -d $src_d ] ; then echo Problem orchidee : no $src_d ; exit ; fi |
---|
| 435 | cd $src_d ; \rm -f *.mod make ; make clean |
---|
[2031] | 436 | make ; if [ "$compilo" = "$gfortran" -o "$compilo" = "mpif90" ] ; then cp -f *.mod ../../../lib ; fi |
---|
[1800] | 437 | cd .. |
---|
| 438 | done |
---|
[2030] | 439 | echo install.sh orchidee_OK `date` |
---|
[1731] | 440 | fi # of if [ "$veget" = 1 ] |
---|
[1588] | 441 | |
---|
[2030] | 442 | |
---|
[1800] | 443 | #============================================================================ |
---|
[1588] | 444 | # Ehouarn: it may be directory LMDZ4 or LMDZ5 depending on tar file... |
---|
[1800] | 445 | if [ -d $MODEL/modipsl/modeles/LMDZ[45] ] ; then |
---|
[1588] | 446 | echo '##########################################################' |
---|
[1800] | 447 | echo 'Compiling LMDZ' |
---|
[1588] | 448 | echo '##########################################################' |
---|
[1800] | 449 | cd $MODEL/modipsl/modeles/LMDZ[45] |
---|
[1588] | 450 | else |
---|
[1800] | 451 | echo "ERROR: No LMDZ4 (or LMDZ5) directory !!!" |
---|
| 452 | exit |
---|
[1588] | 453 | fi |
---|
| 454 | |
---|
| 455 | ########################################################### |
---|
[1708] | 456 | # For those who want to use fcm to compile via : |
---|
[1588] | 457 | # makelmdz_fcm -arch local ..... |
---|
| 458 | ############################################################ |
---|
| 459 | |
---|
[2031] | 460 | if [ "$pclinux" = "1" ] ; then |
---|
| 461 | |
---|
[1708] | 462 | # create local 'arch' files (if on Linux PC): |
---|
[1588] | 463 | cd arch |
---|
[1708] | 464 | # arch-local.path file |
---|
[1590] | 465 | echo "NETCDF_LIBDIR=\"-L${ncdfdir}/lib -lnetcdf\"" > arch-local.path |
---|
[2031] | 466 | echo OK3 |
---|
[1590] | 467 | echo "NETCDF_INCDIR=-I${ncdfdir}/include" >> arch-local.path |
---|
[1588] | 468 | echo 'IOIPSL_INCDIR=$LMDGCM/../../lib' >> arch-local.path |
---|
| 469 | echo 'IOIPSL_LIBDIR=$LMDGCM/../../lib' >> arch-local.path |
---|
| 470 | echo 'ORCH_INCDIR=$LMDGCM/../../lib' >> arch-local.path |
---|
| 471 | echo 'ORCH_LIBDIR=$LMDGCM/../../lib' >> arch-local.path |
---|
[1708] | 472 | # arch-local.fcm file (adapted from arch-linux-32bit.fcm) |
---|
[2031] | 473 | |
---|
| 474 | if [ $real = r8 ] ; then FPP_DEF=NC_DOUBLE ; else FPP_DEF="" ; fi |
---|
| 475 | sed -e s:"%COMPILER .*.$":"%COMPILER $compilo":1 \ |
---|
| 476 | -e s:"%LINK .*.$":"%LINK $compilo":1 \ |
---|
| 477 | -e s:"%PROD_FFLAGS .*.$":"%PROD_FFLAGS $OPTIM":1 \ |
---|
| 478 | -e s:"%DEV_FFLAGS .*.$":"%DEV_FFLAGS $OPTDEV":1 \ |
---|
| 479 | -e s:"%DEBUG_FFLAGS .*.$":"%DEBUG_FFLAGS $OPTDEB":1 \ |
---|
| 480 | -e s:"%BASE_FFLAGS .*.$":"%BASE_FFLAGS $OPTPREC":1 \ |
---|
| 481 | arch-linux-32bit.fcm > arch-local.fcm |
---|
| 482 | |
---|
[1588] | 483 | cd .. |
---|
[1708] | 484 | ### Adapt "bld.cfg" (add the shell): |
---|
[1588] | 485 | whereisthatshell=$(which ${use_shell}) |
---|
| 486 | echo "bld::tool::SHELL $whereisthatshell" >> bld.cfg |
---|
| 487 | |
---|
[1731] | 488 | fi # of if [ "$pclinux" = 1 ] |
---|
| 489 | |
---|
| 490 | |
---|
| 491 | cd $MODEL/modipsl/modeles/LMDZ? |
---|
| 492 | |
---|
[1588] | 493 | ################################################################## |
---|
[1708] | 494 | # Compile LMDZ |
---|
[1588] | 495 | ################################################################## |
---|
[2030] | 496 | echo install.sh avant_compilation `date` |
---|
[1800] | 497 | if [ $compile_with_fcm = 1 ] ; then makelmdz=makelmdz_fcm ; else makelmdz=makelmdz ; fi |
---|
[2031] | 498 | |
---|
| 499 | ./$makelmdz -d ${grid_resolution} -v $veget_version gcm |
---|
[2030] | 500 | echo install.sh apres_compilation `date` |
---|
[1588] | 501 | |
---|
[2030] | 502 | |
---|
[1731] | 503 | if [ -f gcm.e ] || [ -f bin/gcm_${grid_resolution}_phylmd_seq_orch.e ] || [ -f bin/gcm_${grid_resolution}_phylmd_seq.e ] ; then |
---|
[1588] | 504 | echo '##########################################################' |
---|
[1731] | 505 | echo 'Compilation successfull !! ' |
---|
[1588] | 506 | echo '##########################################################' |
---|
| 507 | else |
---|
[1731] | 508 | echo 'Compilation failed !!' |
---|
[1588] | 509 | exit |
---|
| 510 | fi |
---|
| 511 | |
---|
| 512 | ################################################################## |
---|
[1708] | 513 | # Below, we run a benchmark test (if bench=0) |
---|
[1588] | 514 | ################################################################## |
---|
| 515 | if [ $bench = 0 ] ; then |
---|
| 516 | exit |
---|
| 517 | fi |
---|
| 518 | |
---|
| 519 | echo '##########################################################' |
---|
[1731] | 520 | echo ' Running a test run ' |
---|
[1588] | 521 | echo '##########################################################' |
---|
| 522 | |
---|
[2030] | 523 | \rm -rf BENCH${grid_resolution} |
---|
[1588] | 524 | bench=bench_lmdz_${grid_resolution} |
---|
[2030] | 525 | echo install.sh avant_chargement_bench `date` |
---|
[1588] | 526 | wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/$bench.tar.gz |
---|
[2030] | 527 | echo install.sh apres_chargement_bench `date` |
---|
[1588] | 528 | gunzip $bench.tar.gz |
---|
| 529 | tar xvf $bench.tar |
---|
| 530 | |
---|
| 531 | if [ -f gcm.e ] ; then |
---|
| 532 | cp gcm.e BENCH${grid_resolution}/ |
---|
| 533 | elif [ -f bin/gcm_${grid_resolution}_phylmd_seq_orch.e ] ; then |
---|
| 534 | cp bin/gcm_${grid_resolution}_phylmd_seq_orch.e BENCH${grid_resolution}/gcm.e |
---|
| 535 | elif [ -f bin/gcm_${grid_resolution}_phylmd_seq.e ] ; then |
---|
| 536 | cp bin/gcm_${grid_resolution}_phylmd_seq.e BENCH${grid_resolution}/gcm.e |
---|
| 537 | else |
---|
| 538 | echo "No gcm.e found" |
---|
| 539 | exit |
---|
| 540 | fi |
---|
| 541 | |
---|
[2030] | 542 | |
---|
[1588] | 543 | cd BENCH${grid_resolution} |
---|
| 544 | ./bench.sh > bench.out 2>&1 |
---|
| 545 | |
---|
[2030] | 546 | |
---|
[1588] | 547 | echo '##########################################################' |
---|
[1708] | 548 | echo ' Bench results ' |
---|
[1588] | 549 | echo '##########################################################' |
---|
| 550 | |
---|
| 551 | cat ./bench.out |
---|
[2030] | 552 | echo install.sh FIN_du_BENCH `date` |
---|
[1588] | 553 | |
---|
| 554 | echo '##########################################################' |
---|
[1708] | 555 | echo 'Simulation finished in' `pwd` |
---|
| 556 | echo 'You may re-run it with : cd ' `pwd` ' ; gcm.e' |
---|
| 557 | echo 'or ./bench.sh' |
---|
[1588] | 558 | echo '##########################################################' |
---|
[2030] | 559 | |
---|
[2031] | 560 | if [ "$gfortran" = "gfortran44" ] ; then |
---|
[2030] | 561 | echo Your gfortran compiler was too old so that the model was automatically |
---|
| 562 | echo compiled with gfortran44 instead. It can not be used in parallel mode. |
---|
| 563 | echo You can change the compiler at the begining of the install.sh |
---|
| 564 | echo script and reinstall. |
---|
| 565 | fi |
---|