source: BOL/script_install/install.sh @ 1708

Last change on this file since 1708 was 1708, checked in by Ehouarn Millour, 11 years ago

Install in English please!
EM

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