source: BOL/script_install/install.sh @ 2405

Last change on this file since 2405 was 2404, checked in by fhourdin, 10 years ago

Updated install.sh, for LMDZ 2015 tutorial session.
EM

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