source: BOL/script_install/install.sh @ 2030

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

Simplification

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