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