source: BOL/script_install/install.sh @ 1710

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

Make install.sh modify the makelmdz script (just like was already done for makelmdz_fcm) so that one can compile with the distributed version of ORCHIDEE using "-v true".
EM

File size: 20.9 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:"%DEV_FFLAGS          -g -O1":"%DEV_FFLAGS          -g -O1 -Wall":1 \
490    -e s:"%DEBUG_FFLAGS        -g -O0 -Kieee -Ktrap=fp -Mbounds":"%DEBUG_FFLAGS        -g -O0 -Wall -ftrace=full -fbounds-check -freal=nan":1 \
491    -e s:"%BASE_FFLAGS         ":"%BASE_FFLAGS         $OPTPREC":1 \
492   arch-linux-32bit.fcm > arch-local.fcm
493   if [ $real = r8 ] ; then
494     sed -e s:"%FPP_DEF             ":"%FPP_DEF             NC_DOUBLE":1 \
495     arch-local.fcm > arch-local.fcm.new
496     mv -f arch-local.fcm.new arch-local.fcm
497   fi
498elif [ $compilo = gfortran ] ; then
499sed -e s:"%COMPILER            pgf95":"%COMPILER            gfortran":1 \
500    -e s:"%LINK                pgf95":"%LINK                gfortran":1 \
501    -e s:"%PROD_FFLAGS         -fast":"%PROD_FFLAGS         $OPTIM":1 \
502    -e s:"%DEV_FFLAGS          -g -O1":"%DEV_FFLAGS          -Wall -fbounds-check":1 \
503    -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 \
504    -e s:"%BASE_FFLAGS         ":"%BASE_FFLAGS         $OPTPREC":1 \
505   arch-linux-32bit.fcm > arch-local.fcm
506   if [ $real = r8 ] ; then
507     sed -e s:"%FPP_DEF             ":"%FPP_DEF             NC_DOUBLE":1 \
508     arch-local.fcm > arch-local.fcm.new
509     mv -f arch-local.fcm.new arch-local.fcm
510   fi
511elif [ $compilo = pgf90 ] ; then
512sed -e s:"-Wl,-Bstatic -L/usr/lib/gcc-lib/i386-linux/2.95.2":" ":1 \
513    -e s:"%PROD_FFLAGS         -fast":"%PROD_FFLAGS         $OPTIM":1 \
514    -e s:"%BASE_FFLAGS         ":"%BASE_FFLAGS         $OPTPREC":1 \
515   arch-linux-32bit.fcm > arch-local.fcm
516   if [ $real = r8 ] ; then
517     sed -e s:"%FPP_DEF             ":"%FPP_DEF             NC_DOUBLE":1 \
518     arch-local.fcm > arch-local.fcm.new
519     mv -f arch-local.fcm.new arch-local.fcm
520   fi
521elif [ $compilo = ifort ] ; then
522sed -e s:"%COMPILER            pgf95":"%COMPILER            ifort":1 \
523    -e s:"%LINK                pgf95":"%LINK                ifort":1 \
524    -e s:"-Wl,-Bstatic -L/usr/lib/gcc-lib/i386-linux/2.95.2":" ":1 \
525    -e s:"%PROD_FFLAGS         -fast":"%PROD_FFLAGS         $OPTIM":1 \
526    -e s:"%BASE_FFLAGS         ":"%BASE_FFLAGS         $OPTPREC":1 \
527    -e s:"%DEV_FFLAGS          -g -O1":"%DEV_FFLAGS          -p -g -O2 -traceback -fp-stack-check -ftrapuv -check":1 \
528    -e s:"%DEBUG_FFLAGS        -g -O0 -Kieee -Ktrap=fp -Mbounds":"%DEBUG_FFLAGS        -g -no-ftz -traceback -ftrapuv -fp-stack-check -check":1 \
529   arch-linux-32bit.fcm > arch-local.fcm
530   if [ $real = r8 ] ; then
531     sed -e s:"%FPP_DEF             ":"%FPP_DEF             NC_DOUBLE":1 \
532     arch-local.fcm > arch-local.fcm.new
533     mv -f arch-local.fcm.new arch-local.fcm
534   fi
535else
536   echo Unexpected compiler $compilo ; exit
537fi # of if [ $compilo = g95 ] elif [ $compilo = pgf90 ]
538cd ..
539### Adapt "bld.cfg" (add the shell):
540whereisthatshell=$(which ${use_shell})
541echo "bld::tool::SHELL   $whereisthatshell" >> bld.cfg
542
543### Modify makelmdz_fcm and makelmdz to use ORCHIDEE in the bench:
544### remove liborglob.a and libparallel.a
545cp makelmdz_fcm makelmdz_fcm.orig
546sed -e "s/-l\${LIBPREFIX}parallel//" \
547sed -e "s/-l\${LIBPREFIX}orglob//" \
548    makelmdz_fcm.orig > makelmdz_fcm
549cp makelmdz makelmdz.orig
550sed -e "s/-l\${LIBPREFIX}parallel//" \
551sed -e "s/-l\${LIBPREFIX}orglob//" \
552    makelmdz.orig > makelmdz
553
554fi # of if [ "$pclinux" = 1 ]
555
556##################################################################
557# Compile LMDZ
558##################################################################
559ok_veget=false
560if [ "$veget" = 1 ] ; then $ok_veget = true; fi
561if [ $compile_with_fcm = 1 ] ; then
562# Compile with makelmdz_fcm
563        ./makelmdz_fcm -d ${grid_resolution} -arch local -v $ok_veget gcm
564else
565# Comple with makegcm:
566#       3 times! because some dependecies are not well resolved with makegcm
567        ./makegcm -d ${grid_resolution} -v $ok_veget gcm
568        ./makegcm -d ${grid_resolution} -v $ok_veget gcm
569        ./makegcm -d ${grid_resolution} -v $ok_veget gcm
570fi
571
572if [ -f gcm.e ] || [ -f bin/gcm_${grid_resolution}_phylmd_seq_orch.e ] || [ -f bin/gcm_${grid_resolution}_phylmd_seq.e ]  ; then
573echo '##########################################################'
574echo Compilation successfull !!
575echo '##########################################################'
576else
577echo Compilation failed !!
578exit
579fi
580
581##################################################################
582# Below, we run a benchmark test (if bench=0)
583##################################################################
584if [ $bench = 0 ] ; then
585                exit
586fi
587
588echo '##########################################################'
589echo Running a test run
590echo '##########################################################'
591
592\rm -r BENCH${grid_resolution}
593bench=bench_lmdz_${grid_resolution}
594wget http://www.lmd.jussieu.fr/~lmdz/DistribG95/$bench.tar.gz
595gunzip $bench.tar.gz
596tar xvf $bench.tar
597
598if [ -f gcm.e ] ; then 
599    cp gcm.e BENCH${grid_resolution}/
600elif [ -f bin/gcm_${grid_resolution}_phylmd_seq_orch.e ] ; then
601    cp bin/gcm_${grid_resolution}_phylmd_seq_orch.e  BENCH${grid_resolution}/gcm.e
602elif [ -f bin/gcm_${grid_resolution}_phylmd_seq.e ] ; then
603    cp bin/gcm_${grid_resolution}_phylmd_seq.e  BENCH${grid_resolution}/gcm.e
604else
605    echo "No gcm.e found"
606    exit
607fi
608
609if [ $hostname = brodie ] ; then
610echo to run the bench, you must log on to Brodie01
611echo and then change directory to `pwd`/BENCH${grid_resolution}
612echo and run the gcm
613exit
614fi
615
616cd BENCH${grid_resolution}
617./bench.sh > bench.out  2>&1
618
619echo '##########################################################'
620echo ' Bench results '
621echo '##########################################################'
622
623cat ./bench.out
624
625echo '##########################################################'
626echo 'Simulation finished in' `pwd`
627echo 'You may re-run it with : cd ' `pwd` ' ; gcm.e'
628echo 'or ./bench.sh'
629echo '##########################################################'
630
Note: See TracBrowser for help on using the repository browser.