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