1 | #!/bin/bash |
---|
2 | |
---|
3 | ########################################################################### |
---|
4 | # Author : Laurent Fairhead et Frédéric Hourdin |
---|
5 | # Usage : install_lmdz.sh -help |
---|
6 | # |
---|
7 | # bash installation script of the LMDZ model on different computer types : |
---|
8 | # Linux PC, "mesocentre" (IPSL-UPMC, IPSL-X), super-computer (IDRIS) |
---|
9 | # |
---|
10 | # The model is downloaded in the following directory tree |
---|
11 | # $MODEL/modipsl/modeles/... |
---|
12 | # using the "modipsl" infrastructure created by the "IPSL" |
---|
13 | # for coupled (atmosphere/ocean/vegetation/chemistry) climate modeling |
---|
14 | # activities. |
---|
15 | # Here we only download atmospheric (LMDZ) and vegetation (ORCHIDEE) |
---|
16 | # components. |
---|
17 | # |
---|
18 | # The sources of the models can be found in the "modeles" directory. |
---|
19 | # In the present case, LMDZ, ORCHIDEE, and IOIPSL or XIOS (handling of input-outputs |
---|
20 | # using the NetCDF library). |
---|
21 | # |
---|
22 | # The script downloads various source files (including a version of NetCDF) |
---|
23 | # and utilities, compiles the model, and runs a test simulation in a |
---|
24 | # minimal configuration. |
---|
25 | # |
---|
26 | # Prerequisites : pgf90/gfortran, bash or ksh, wget , gunzip, tar, ... |
---|
27 | # |
---|
28 | # Modif 18/11/2011 |
---|
29 | # changes for option real 8. |
---|
30 | # We compile with -r8 (or equivalent) and -DNC_DOUBLE for the GCM |
---|
31 | # but with -r4 for netcdf. Variable real must be set to |
---|
32 | # r4 or r8 at the beginning of the script below. |
---|
33 | # |
---|
34 | ########################################################################### |
---|
35 | |
---|
36 | echo install_lmdz.sh DEBUT `date` |
---|
37 | set -e |
---|
38 | |
---|
39 | ################################################################ |
---|
40 | # Choice of installation options |
---|
41 | ################################################################ |
---|
42 | |
---|
43 | ################################################################ |
---|
44 | # A function to fetch files either locally or on the internet |
---|
45 | ################################################################ |
---|
46 | function myget { #1st and only argument should be file name |
---|
47 | # Path on local computer where to look for the datafile |
---|
48 | if [ -f /u/lmdz/WWW/LMDZ/pub/$1 ] ; then |
---|
49 | \cp -f -p /u/lmdz/WWW/LMDZ/pub/$1 . |
---|
50 | elif [ -f ~/LMDZ/pub/$1 ] ; then |
---|
51 | \cp -f -p ~/LMDZ/pub/$1 . |
---|
52 | else |
---|
53 | wget -nv http://www.lmd.jussieu.fr/~lmdz/pub/$1 |
---|
54 | save_pub_locally=0 |
---|
55 | if [ $save_pub_locally = 1 ] ; then # saving wget files on ~/LMDZ/pub |
---|
56 | dir=~/LMDZ/pub/`dirname $1` ; mkdir -p $dir ; cp -r `basename $1` $dir |
---|
57 | fi |
---|
58 | fi |
---|
59 | } |
---|
60 | |
---|
61 | # 04_2021 : tester si r4 marche encore ! |
---|
62 | #real=r4 |
---|
63 | real=r8 |
---|
64 | |
---|
65 | ######################################################################### |
---|
66 | # Valeur par défaut des parametres |
---|
67 | ######################################################################### |
---|
68 | svn="" |
---|
69 | #version=trunk |
---|
70 | version=20220131.trunk |
---|
71 | |
---|
72 | getlmdzor=1 |
---|
73 | netcdf=1 # 1 for automatic installation |
---|
74 | # 0 for no installation |
---|
75 | # /.../../netcdf-4.0.1 if wanting to link with an already |
---|
76 | # compiled netcdf library (implies to check option compatibility) |
---|
77 | check_linux=1 |
---|
78 | ioipsl=1 |
---|
79 | bench=1 |
---|
80 | pclinux=1 |
---|
81 | pcmac=0 # default: not on a Mac |
---|
82 | compiler=gfortran |
---|
83 | SCM=0 |
---|
84 | # surface/vegetation scheme treatment |
---|
85 | # controlled by the single variable veget which can have the following values |
---|
86 | # - NONE: bucket scheme (default) |
---|
87 | # - CMIP6: orchidee version used in CMIP exercise, rev 5661 |
---|
88 | # - number: orchidee version number |
---|
89 | veget=NONE |
---|
90 | # choose the resolution for the bench runs |
---|
91 | # grid_resolution= 32x24x11 or 48x36x19 for tests (test without ORCHIDEE) |
---|
92 | # 96x71x19 standard configuration |
---|
93 | grid_resolution=144x142x79 |
---|
94 | grid_resolution=96x95x39 |
---|
95 | grid_resolution=48x36x19 |
---|
96 | grid_resolution=32x32x39 |
---|
97 | # choose the physiq version you want to test |
---|
98 | #physiq=NPv6.0.14splith |
---|
99 | physiq= |
---|
100 | |
---|
101 | ## parallel can take the values none/mpi/omp/mpi_omp |
---|
102 | parallel=mpi_omp |
---|
103 | parallel=none |
---|
104 | idris_acct=lmd |
---|
105 | OPT_GPROF="" |
---|
106 | OPT_MAKELMDZ="" |
---|
107 | MODEL="" |
---|
108 | |
---|
109 | ## also compile XIOS? (and more recent NetCDF/HDF5 libraries) Default=no |
---|
110 | with_xios="n" |
---|
111 | opt_makelmdz_xios="" |
---|
112 | |
---|
113 | ## compile with old/rrtm/ecrad radiatif code (Default=rrtm) |
---|
114 | rad=rrtm |
---|
115 | |
---|
116 | ## compile_with_fcm=1 : use makelmdz_fcm (1) or makelmdz (0) |
---|
117 | compile_with_fcm=1 |
---|
118 | |
---|
119 | #Compilation with Cosp (cosp=NONE/v1/v2 ; default=NONE) |
---|
120 | cosp=NONE |
---|
121 | opt_cosp="" |
---|
122 | |
---|
123 | # Check if on a Mac |
---|
124 | if [ `uname` = "Darwin" ] |
---|
125 | then |
---|
126 | pcmac=1 |
---|
127 | export MAKE=make |
---|
128 | fi |
---|
129 | #echo "pcmac="$pcmac |
---|
130 | |
---|
131 | env_file="" |
---|
132 | |
---|
133 | ######################################################################### |
---|
134 | # Options interactives |
---|
135 | ######################################################################### |
---|
136 | while (($# > 0)) |
---|
137 | do |
---|
138 | case $1 in |
---|
139 | "-h") cat <<........fin |
---|
140 | $0 [ -v version ] [ -r svn_release ] |
---|
141 | [ -parallel PARA ] [ -d GRID_RESOLUTION ] [ -bench 0/1 ] |
---|
142 | [-name LOCAL_MODEL_NAME] [-gprof] [-opt_makelmdz] [-rad RADIATIF] |
---|
143 | |
---|
144 | -v "version" like 20150828.trunk |
---|
145 | see http://www.lmd.jussieu.fr/~lmdz/Distrib/LISMOI.trunk |
---|
146 | |
---|
147 | -r "svn_release" : either the svn release number or "last" |
---|
148 | |
---|
149 | -compiler gfortran|ifort|pgf90 (default: gfortran) |
---|
150 | |
---|
151 | -parallel PARA : can be mpi_omp (mpi with openMP) or none (for sequential) |
---|
152 | |
---|
153 | -d GRID_RESOLUTION should be among the available benchs if -bench 1 |
---|
154 | among which : 48x36x19, 48x36x39 |
---|
155 | if wanting to run a bench simulation in addition to compilation |
---|
156 | default : 48x36x19 |
---|
157 | |
---|
158 | -bench activating the bench or not (0/1). Default 1 |
---|
159 | |
---|
160 | -name LOCAL_MODEL_NAME : default = LMDZversion.release |
---|
161 | |
---|
162 | -netcdf PATH : full path to an existing installed NetCDF library |
---|
163 | (without -netcdf: also download and install the NetCDF library) |
---|
164 | |
---|
165 | -xios also download and compile the XIOS library |
---|
166 | (requires the NetCDF4-HDF5 library, also installed by default) |
---|
167 | (requires to also have -parallel mpi_omp) |
---|
168 | |
---|
169 | -gprof to compile with -pg to enable profiling with gprof |
---|
170 | |
---|
171 | -cosp to run without our with cospv1 or cospv2 [none/v1/v2] |
---|
172 | |
---|
173 | -rad RADIATIF can be old, rrtm or ecrad radiatif code |
---|
174 | |
---|
175 | -nofcm to compile without fcm |
---|
176 | |
---|
177 | -SCM install 1D version automatically |
---|
178 | |
---|
179 | -debug compile everything in debug mode |
---|
180 | |
---|
181 | -opt_makelmdz to call makelmdz or makelmdz_fcm with additional options |
---|
182 | |
---|
183 | -physiq to choose which physics package to use |
---|
184 | |
---|
185 | -env_file specify an arch.env file to overwrite the existing one |
---|
186 | |
---|
187 | -veget surface model to run [NONE/CMIP6/xxxx] |
---|
188 | |
---|
189 | ........fin |
---|
190 | exit ;; |
---|
191 | "-v") version=$2 ; shift ; shift ;; |
---|
192 | "-r") svn=$2 ; shift ; shift ;; |
---|
193 | "-compiler") compiler=$2 |
---|
194 | case $compiler in |
---|
195 | "gfortran"|"ifort"|"pgf90") compiler=$2 ; shift ; shift ;; |
---|
196 | *) echo "Only gfortran , ifort or pgf90 for the compiler option" ; exit |
---|
197 | esac ;; |
---|
198 | "-d") grid_resolution=$2 ; shift ; shift ;; |
---|
199 | "-gprof") OPT_GPROF="-pg" ; shift ;; |
---|
200 | "-cosp") cosp=$2 |
---|
201 | case $cosp in |
---|
202 | "none"|"v1"|"v2") cosp=$2 ; shift ; shift ;; |
---|
203 | *) echo Only none v1 v2 for cosp option ; exit |
---|
204 | esac ;; |
---|
205 | "-nofcm") compile_with_fcm=0 ; shift ;; |
---|
206 | "-SCM") SCM=1 ; shift ;; |
---|
207 | "-opt_makelmdz") OPT_MAKELMDZ="$2" ; shift ; shift ;; |
---|
208 | "-rad") rad=$2 |
---|
209 | case $rad in |
---|
210 | "old"|"rrtm"|"ecrad") rad=$2 ; shift ; shift ;; |
---|
211 | *) echo Only old rrtm ecrad for rad option ; exit |
---|
212 | esac ;; |
---|
213 | "-parallel") parallel=$2 |
---|
214 | case $parallel in |
---|
215 | "none"|"mpi"|"omp"|"mpi_omp") parallel=$2 ; shift ; shift ;; |
---|
216 | *) echo Only none mpi omp mpi_omp for the parallel option ; exit |
---|
217 | esac ;; |
---|
218 | "-bench") bench=$2 ; shift ; shift ;; |
---|
219 | "-debug") optim=-debug ; shift ;; |
---|
220 | "-name") MODEL=$2 ; shift ; shift ;; |
---|
221 | "-netcdf") netcdf=$2 ; shift ; shift ;; |
---|
222 | "-physiq") physiq=$2 ; shift ; shift ;; |
---|
223 | "-xios") with_xios="y" ; shift ;; |
---|
224 | "-env_file") env_file=$2 ; shift ; shift ;; |
---|
225 | "-veget") veget=$2 ; shift ; shift ;; |
---|
226 | *) ./install_lmdz.sh -h ; exit |
---|
227 | esac |
---|
228 | done |
---|
229 | |
---|
230 | # Option de compilation du rayonnement |
---|
231 | opt_rad="" |
---|
232 | case $rad in |
---|
233 | rrtm) opt_rad="-rad rrtm" ;; |
---|
234 | ecrad) opt_rad="-rad ecrad" ;; |
---|
235 | esac |
---|
236 | |
---|
237 | |
---|
238 | # Option de compilation pour Cosp |
---|
239 | opt_cosp="" |
---|
240 | case cosp in |
---|
241 | v1) opt_cosp="-cosp true" ;; |
---|
242 | v2) opt_cosp="-cospv2 true" ;; |
---|
243 | esac |
---|
244 | |
---|
245 | # Check on veget version |
---|
246 | #if [ "$veget" != 'NONE' -a "$veget" != "CMIP6" -a "$veget" != +([0-9]) ] ; then |
---|
247 | if [ $veget != 'NONE' -a $veget != "CMIP6" ] ; then |
---|
248 | re='^[0-9]+$' |
---|
249 | if ! [[ $veget =~ $re ]] ; then |
---|
250 | echo 'Valeur de l option veget non valable' |
---|
251 | exit |
---|
252 | fi |
---|
253 | fi |
---|
254 | |
---|
255 | #Define veget-related suffix for gcm name |
---|
256 | if [ "$veget" = 'NONE' ] ; then |
---|
257 | suff_orc='' |
---|
258 | #For use with tutorial, orchidee_rev is also defined (will be written in surface_env at the end of the script) |
---|
259 | orchidee_rev='' |
---|
260 | else |
---|
261 | suff_orc='_orch' |
---|
262 | fi |
---|
263 | |
---|
264 | |
---|
265 | if [ $parallel = none ] ; then sequential=1; suff_exe='_seq' ; else sequential=0; suff_exe='_para_mem' ; fi |
---|
266 | |
---|
267 | #Chemin pour placer le modele |
---|
268 | if [ "$MODEL" = "" ] ; then MODEL=./LMDZ$version$svn$optim ; fi |
---|
269 | |
---|
270 | |
---|
271 | arch=local |
---|
272 | |
---|
273 | |
---|
274 | if [ $compiler = g95 ] ; then echo g95 is not supported anymore ; exit ; fi |
---|
275 | |
---|
276 | ################################################################ |
---|
277 | # Specificite des machines |
---|
278 | ################################################################ |
---|
279 | |
---|
280 | hostname=`hostname` |
---|
281 | if [ "$pclinux" = 1 ] ; then o_ins_make="-t g95" ; else o_ins_make="" ; fi |
---|
282 | |
---|
283 | case ${hostname:0:5} in |
---|
284 | |
---|
285 | jean-) compiler="mpiifort" ; |
---|
286 | par_comp="mpiifort" ; |
---|
287 | o_ins_make="-t jeanzay" ; |
---|
288 | make=gmake ; |
---|
289 | module purge |
---|
290 | module load intel-compilers/19.0.4 ; |
---|
291 | #module load intel-mpi/19.0.4 ; |
---|
292 | #module load intel-mkl/19.0.4 ; |
---|
293 | module load hdf5/1.10.5-mpi ; |
---|
294 | module load netcdf/4.7.2-mpi ; |
---|
295 | module load netcdf-fortran/4.5.2-mpi ; |
---|
296 | module load subversion/1.9.7 ; |
---|
297 | export NETCDF_LIBDIR=./ |
---|
298 | export NETCDFFORTRAN_INCDIR=./ |
---|
299 | export NETCDFFORTRAN_LIBDIR=./ |
---|
300 | arch=X64_JEANZAY ;; |
---|
301 | |
---|
302 | cicla|camel) compiler="gfortran" ; |
---|
303 | if [ $parallel != none ] ; then |
---|
304 | module load openmpi/1.6.5-gfortran ; |
---|
305 | root_mpi=$MPI_HOME ; |
---|
306 | path_mpi=$root_mpi/bin ; |
---|
307 | par_comp=${path_mpi}/mpif90 ; |
---|
308 | mpirun=${path_mpi}/mpirun ; |
---|
309 | fi ; |
---|
310 | arch=local ; |
---|
311 | make=make ; |
---|
312 | o_ins_make="-t g95" ;; |
---|
313 | |
---|
314 | *) if [ $parallel = none -o -f /usr/bin/mpif90 ] ; then |
---|
315 | path_mpi=`which mpif90 | sed -e s:/mpif90::` ; |
---|
316 | if [ -d /usr/lib64/openmpi ] ; then |
---|
317 | root_mpi="/usr/lib64/openmpi" |
---|
318 | else |
---|
319 | root_mpi="/usr" |
---|
320 | fi |
---|
321 | else |
---|
322 | echo "Cannot find mpif90" ; |
---|
323 | if [ $parallel = none ] ; then exit ; fi ; |
---|
324 | fi ; |
---|
325 | if [ $parallel != none ] ; then |
---|
326 | root_mpi=$(which mpif90 | sed -e s:/bin/mpif90::) |
---|
327 | path_mpi=$(which mpif90 | sed -e s:/mpif90::) |
---|
328 | export LD_LIBRARY_PATH=${root_mpi}/lib:$LD_LIBRARY_PATH |
---|
329 | fi |
---|
330 | par_comp=${path_mpi}/mpif90 ; |
---|
331 | mpirun=${path_mpi}/mpirun ; |
---|
332 | arch=local ; |
---|
333 | make=make ; |
---|
334 | o_ins_make="-t g95" |
---|
335 | esac |
---|
336 | |
---|
337 | # Flags for parallelism: |
---|
338 | if [ $parallel != none ] ; then |
---|
339 | # MPI_LD are the flags needed for linking with MPI |
---|
340 | MPI_LD="-L${root_mpi}/lib -lmpi" |
---|
341 | if [ "$compiler" = "gfortran" ] ; then |
---|
342 | # MPI_FLAGS are the flags needed for compilation with MPI |
---|
343 | MPI_FLAGS="-fcray-pointer" |
---|
344 | # OMP_FLAGS are the flags needed for compilation with OpenMP |
---|
345 | OMP_FLAGS="-fopenmp -fcray-pointer" |
---|
346 | # OMP_LD are the flags needed for linking with OpenMP |
---|
347 | OMP_LD="-fopenmp" |
---|
348 | elif [ "$compiler" = "ifort" ] ; then |
---|
349 | MPI_FLAGS="" |
---|
350 | OMP_FLAGS="-openmp" |
---|
351 | OMP_LD="-openmp" |
---|
352 | else # pgf90 |
---|
353 | MPI_FLAGS="" |
---|
354 | OMP_FLAGS="-mp" |
---|
355 | OMP_LD="-mp" |
---|
356 | fi |
---|
357 | fi |
---|
358 | |
---|
359 | ##################################################################### |
---|
360 | # Test for old gfortran compilers |
---|
361 | # If the compiler is too old (older than 4.3.x) we test if the |
---|
362 | # temporary gfortran44 patch is available on the computer in which |
---|
363 | # case the compiler is changed from gfortran to gfortran44 |
---|
364 | # Must be aware than parallelism can not be activated in this case |
---|
365 | ##################################################################### |
---|
366 | |
---|
367 | if [ "$compiler" = "gfortran" ] ; then |
---|
368 | gfortran=gfortran |
---|
369 | gfortranv=`gfortran --version | \ |
---|
370 | head -1 | awk ' { print $NF } ' | awk -F. ' { print $1 * 10 + $2 } '` |
---|
371 | if [ $gfortranv -le 43 ] ; then |
---|
372 | echo ERROR : Your gfortran compiler is too old |
---|
373 | echo 'Please choose a new one (ifort) and change the line' |
---|
374 | echo compiler=xxx |
---|
375 | echo in the install_lmdz.sh script and rerun it |
---|
376 | if [ `which gfortran44 | wc -w` -ne 0 ] ; then |
---|
377 | gfortran=gfortran44 |
---|
378 | else |
---|
379 | echo gfotran trop vieux ; exit |
---|
380 | fi |
---|
381 | fi |
---|
382 | compiler=$gfortran |
---|
383 | fi |
---|
384 | ##################################################################### |
---|
385 | |
---|
386 | ## if also compiling XIOS, parallel must be mpi_omp |
---|
387 | if [ "$with_xios" = "y" -a "$parallel" != "mpi_omp" ] ; then |
---|
388 | echo "Error, you must set -parallel mpi_omp if you want XIOS" |
---|
389 | exit |
---|
390 | fi |
---|
391 | |
---|
392 | if [ "$with_xios" = "y" ] ; then |
---|
393 | opt_makelmdz_xios="-io xios" |
---|
394 | fi |
---|
395 | |
---|
396 | if [ "$cosp" = "v2" -a "$with_xios" = "n" ] ; then |
---|
397 | echo "Error, Cospv2 cannot run without Xios" |
---|
398 | exit |
---|
399 | fi |
---|
400 | |
---|
401 | echo '################################################################' |
---|
402 | echo Choix des options de compilation |
---|
403 | echo '################################################################' |
---|
404 | |
---|
405 | export FC=$compiler |
---|
406 | export F90=$compiler |
---|
407 | export F77=$compiler |
---|
408 | export CPPFLAGS= |
---|
409 | OPTIMNC=$OPTIM |
---|
410 | BASE_LD="$OPT_GPROF" |
---|
411 | OPTPREC="$OPT_GPROF" |
---|
412 | ARFLAGS="rs" ; if [ -f /etc/issue ] ; then if [ "`grep -i ubuntu /etc/issue`" != "" ] ; then if [ "`grep -i ubuntu /etc/issue | awk ' { print $2 } ' | cut -d. -f1`" -ge 16 ] ; then ARFLAGS="rU" ; fi ; fi ; fi |
---|
413 | |
---|
414 | |
---|
415 | |
---|
416 | if [ "$compiler" = "$gfortran" ] ; then |
---|
417 | OPTIM='-O3' |
---|
418 | OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all -fbacktrace -finit-real=snan" |
---|
419 | OPTDEV="-Wall -fbounds-check" |
---|
420 | fmod='I ' |
---|
421 | OPTPREC="$OPTPREC -cpp -ffree-line-length-0" |
---|
422 | if [ $real = r8 ] ; then OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE" ; fi |
---|
423 | export F90FLAGS=" -ffree-form $OPTIMNC" |
---|
424 | export FFLAGS=" $OPTIMNC" |
---|
425 | export CC=gcc |
---|
426 | export CXX=g++ |
---|
427 | export fpp_flags="-P -C -traditional -ffreestanding" |
---|
428 | |
---|
429 | elif [ $compiler = mpif90 ] ; then |
---|
430 | OPTIM='-O3' |
---|
431 | OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all" |
---|
432 | OPTDEV="-Wall -fbounds-check" |
---|
433 | BASE_LD="$BASE_LD -lblas" |
---|
434 | fmod='I ' |
---|
435 | if [ $real = r8 ] ; then OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE -fcray-pointer" ; fi |
---|
436 | export F90FLAGS=" -ffree-form $OPTIMNC" |
---|
437 | export FFLAGS=" $OPTIMNC" |
---|
438 | export CC=gcc |
---|
439 | export CXX=g++ |
---|
440 | |
---|
441 | elif [ $compiler = pgf90 ] ; then |
---|
442 | OPTIM='-O2 -Mipa -Munroll -Mnoframe -Mautoinline -Mcache_align' |
---|
443 | OPTDEB='-g -Mdclchk -Mbounds -Mchkfpstk -Mchkptr -Minform=inform -Mstandard -Ktrap=fp -traceback' |
---|
444 | OPTDEV='-g -Mbounds -Ktrap=fp -traceback' |
---|
445 | fmod='module ' |
---|
446 | if [ $real = r8 ] ; then OPTPREC="$OPTPREC -r8 -DNC_DOUBLE" ; fi |
---|
447 | export CPPFLAGS="-DpgiFortran" |
---|
448 | export CC=pgcc |
---|
449 | export CFLAGS="-O2 -Msignextend" |
---|
450 | export CXX=pgCC |
---|
451 | export CXXFLAGS="-O2 -Msignextend" |
---|
452 | export FFLAGS="-O2 $OPTIMNC" |
---|
453 | export F90FLAGS="-O2 $OPTIMNC" |
---|
454 | compile_with_fcm=1 |
---|
455 | |
---|
456 | elif [ $compiler = ifort ] ; then |
---|
457 | OPTIM="-O2 -fp-model strict -ip -align all " |
---|
458 | OPTDEV="-p -g -O2 -traceback -fp-stack-check -ftrapuv -check" |
---|
459 | OPTDEB="-g -no-ftz -traceback -ftrapuv -fp-stack-check -check" |
---|
460 | fmod='module ' |
---|
461 | if [ $real = r8 ] ; then OPTPREC="$OPTPREC -real-size 64 -DNC_DOUBLE" ; fi |
---|
462 | export CPP="icc -E" |
---|
463 | export FFLAGS="-O2 -ip -fpic -mcmodel=large" |
---|
464 | export FCFLAGS="-O2 -ip -fpic -mcmodel=large" |
---|
465 | export CC=icc |
---|
466 | export CFLAGS="-O2 -ip -fpic -mcmodel=large" |
---|
467 | export CXX=icpc |
---|
468 | export CXXFLAGS="-O2 -ip -fpic -mcmodel=large" |
---|
469 | export fpp_flags="-P -traditional" |
---|
470 | # Pourquoi forcer la compilation fcm. Marche mieux sans |
---|
471 | #compile_with_fcm=1 |
---|
472 | |
---|
473 | elif [ $compiler = mpiifort ] ; then |
---|
474 | echo on ne fait rien la |
---|
475 | # Pourquoi forcer la compilation fcm. Marche mieux sans |
---|
476 | #compile_with_fcm=1 |
---|
477 | |
---|
478 | else |
---|
479 | echo unexpected compiler $compiler ; exit |
---|
480 | fi |
---|
481 | |
---|
482 | OPTIMGCM="$OPTIM $OPTPREC" |
---|
483 | |
---|
484 | hostname=`hostname` |
---|
485 | |
---|
486 | ########################################################################## |
---|
487 | # If installing on known machines such as Jean-Zay at IDRIS, |
---|
488 | # don't check for available software and don't install netcdf |
---|
489 | if [ ${hostname:0:5} = jean- ] ; then |
---|
490 | netcdf=0 # no need to recompile netcdf, alreday available |
---|
491 | check_linux=0 |
---|
492 | pclinux=0 |
---|
493 | ioipsl=0 # no need to recompile ioipsl, already available |
---|
494 | #netcdf="/smplocal/pub/NetCDF/4.1.3" |
---|
495 | compiler="mpiifort" |
---|
496 | fmod='module ' |
---|
497 | if [ $real = r8 ] ; then OPTPREC="$OPTPREC -i4 -r8 -DNC_DOUBLE" ; fi |
---|
498 | OPTIM="-auto -align all -O2 -fp-model strict -xHost " |
---|
499 | OPTIMGCM="$OPTIM $OPTPREC" |
---|
500 | fi |
---|
501 | ########################################################################## |
---|
502 | |
---|
503 | |
---|
504 | mkdir -p $MODEL |
---|
505 | echo $MODEL |
---|
506 | MODEL=`( cd $MODEL ; pwd )` # to get absolute path, if necessary |
---|
507 | |
---|
508 | |
---|
509 | echo '################################################################' |
---|
510 | if [ "$check_linux" = 1 ] ; then |
---|
511 | echo Check if required software is available |
---|
512 | echo '################################################################' |
---|
513 | |
---|
514 | #### Ehouarn: test if the required shell is available |
---|
515 | #### Maj FH-LF-AS 2021-04 : default=bash ; if bash missing, use ksh |
---|
516 | use_shell="bash" # default |
---|
517 | if [ "`which bash`" = "" ] ; then |
---|
518 | echo "no bash ; we will use ksh" |
---|
519 | use_shell="ksh" |
---|
520 | if [ "`which ksh`" = "" ] ; then |
---|
521 | echo "bash (or ksh) needed!! Install it!" |
---|
522 | exit |
---|
523 | fi |
---|
524 | fi |
---|
525 | |
---|
526 | for logiciel in wget tar gzip make $compiler gcc ; do |
---|
527 | if [ "`which $logiciel`" = "" ] ; then |
---|
528 | echo You must first install $logiciel on your system |
---|
529 | exit |
---|
530 | fi |
---|
531 | done |
---|
532 | |
---|
533 | if [ $pclinux = 1 ] ; then |
---|
534 | cd $MODEL |
---|
535 | cat <<eod > tt.f90 |
---|
536 | print*,'coucou' |
---|
537 | end |
---|
538 | eod |
---|
539 | $compiler tt.f90 -o a.out |
---|
540 | ./a.out >| tt |
---|
541 | if [ "`cat tt | sed -e 's/ //g' `" != "coucou" ] ; then |
---|
542 | echo problem installing with compiler $compiler ; exit ; fi |
---|
543 | \rm tt a.out tt.f90 |
---|
544 | fi |
---|
545 | fi |
---|
546 | |
---|
547 | ########################################################################### |
---|
548 | if [ $getlmdzor = 1 -a ! -d $MODEL/modipsl ] ; then |
---|
549 | ########################################################################### |
---|
550 | echo '##########################################################' |
---|
551 | echo Download a slightly modified version of LMDZ |
---|
552 | echo '##########################################################' |
---|
553 | cd $MODEL |
---|
554 | myget src/modipsl_orc_cmip6.$version.tar.gz |
---|
555 | echo install_lmdz.sh wget_OK `date` |
---|
556 | gunzip modipsl_orc_cmip6.$version.tar.gz |
---|
557 | tar xvf modipsl_orc_cmip6.$version.tar |
---|
558 | \rm modipsl_orc_cmip6.$version.tar |
---|
559 | fi |
---|
560 | |
---|
561 | ########################################################################### |
---|
562 | if [ $netcdf = 1 -a ! -d $MODEL/netcdf ] ; then |
---|
563 | ########################################################################### |
---|
564 | cd $MODEL |
---|
565 | netcdflog=`pwd`/netcdf.log |
---|
566 | echo '##########################################################' |
---|
567 | echo Compiling the Netcdf library |
---|
568 | echo '##########################################################' |
---|
569 | echo log file : $netcdflog |
---|
570 | if [ "$with_xios" = "n" ] ; then |
---|
571 | # keep it simple |
---|
572 | #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/netcdf-4.0.1.tar.gz |
---|
573 | myget import/netcdf-4.0.1.tar.gz |
---|
574 | gunzip netcdf-4.0.1.tar.gz |
---|
575 | tar xvf netcdf-4.0.1.tar |
---|
576 | \rm -f netcdf-4.0.1.tar |
---|
577 | |
---|
578 | cd netcdf-4.0.1 |
---|
579 | |
---|
580 | localdir=`pwd -P` |
---|
581 | ./configure --prefix=$localdir --enable-shared --disable-cxx |
---|
582 | #sed -e 's/gfortran/'$gfortran'/g' Makefile >| tmp ; mv -f tmp Makefile |
---|
583 | $make check > $netcdflog 2>&1 |
---|
584 | $make install >> $netcdflog 2>&1 |
---|
585 | #LF rajout d'une verrue, pour une raison non encore expliquee, la librairie est parfois rangée dans lib64 |
---|
586 | # et non dans lib par certains compilateurs |
---|
587 | if [ ! -e lib -a -d lib64 ] ; then ln -s lib64 lib; fi |
---|
588 | else |
---|
589 | # download and compile hdf5 and netcdf, etc. using the install_netcdf4_hdf5.bash script |
---|
590 | #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/install_netcdf4_hdf5.bash |
---|
591 | myget import/install_netcdf4_hdf5.bash |
---|
592 | chmod u=rwx install_netcdf4_hdf5.bash |
---|
593 | if [ "$compiler" = "gfortran" ] ; then |
---|
594 | ./install_netcdf4_hdf5.bash -prefix $MODEL/netcdf4_hdf5 -CC gcc -FC gfortran -CXX g++ -MPI $root_mpi > $netcdflog 2>&1 |
---|
595 | elif [ "$compiler" = "ifort" ] ; then |
---|
596 | ./install_netcdf4_hdf5.bash -prefix $MODEL/netcdf4_hdf5 -CC icc -FC ifort -CXX icpc -MPI $root_mpi > $netcdflog 2>&1 |
---|
597 | elif [ "$compiler" = "pgf90" ] ; then |
---|
598 | ./install_netcdf4_hdf5.bash -prefix $MODEL/netcdf4_hdf5 -CC pgcc -FC pgf90 -CXX pgCC -MPI $root_mpi > $netcdflog 2>&1 |
---|
599 | else |
---|
600 | echo "unexpected compiler $compiler" ; exit |
---|
601 | fi |
---|
602 | fi # of if [ "$with_xios" = "n" ] |
---|
603 | echo install_lmdz.sh netcdf_OK `date` |
---|
604 | fi # of if [ $netcdf = 1 ] |
---|
605 | |
---|
606 | # ncdfdir contains the directory where netcdfd is installed |
---|
607 | if [ $netcdf = 0 -o $netcdf = 1 ] ; then |
---|
608 | if [ "$with_xios" = "y" ] ; then |
---|
609 | ncdfdir=$MODEL/netcdf4_hdf5 |
---|
610 | else |
---|
611 | ncdfdir=$MODEL/netcdf-4.0.1 |
---|
612 | fi |
---|
613 | else |
---|
614 | ncdfdir=$netcdf |
---|
615 | fi |
---|
616 | |
---|
617 | #========================================================================= |
---|
618 | if [ $ioipsl = 1 ] ; then |
---|
619 | #========================================================================= |
---|
620 | echo OK ioipsl=$ioipsl |
---|
621 | echo '##########################################################' |
---|
622 | echo 'Installing MODIPSL, the installation package manager for the ' |
---|
623 | echo 'IPSL models and tools' |
---|
624 | echo '##########################################################' |
---|
625 | echo `date` |
---|
626 | |
---|
627 | cd $MODEL/modipsl |
---|
628 | \rm -rf lib/* |
---|
629 | cd util |
---|
630 | cp AA_make.gdef AA_make.orig |
---|
631 | F_C="$compiler -c " ; if [ "$compiler" = "$gfortran" -o "$compiler" = "mpif90" ] ; then F_C="$compiler -c -cpp " ; fi |
---|
632 | if [ "$compiler" = "pgf90" ] ; then F_C="$compiler -c -Mpreprocess" ; fi |
---|
633 | sed -e 's/^\#.*.g95.*.\#.*.$/\#/' AA_make.gdef > tmp |
---|
634 | sed -e "s:F_L = g95:F_L = $compiler:" -e "s:F_C = g95 -c -cpp:F_C = $F_C": \ |
---|
635 | -e 's/g95.*.w_w.*.(F_D)/g95 w_w = '"$OPTIMGCM"'/' \ |
---|
636 | -e 's:g95.*.NCDF_INC.*.$:g95 NCDF_INC= '"$ncdfdir"'/include:' \ |
---|
637 | -e 's:g95.*.NCDF_LIB.*.$:g95 NCDF_LIB= -L'"$ncdfdir"'/lib -lnetcdff -lnetcdf:' \ |
---|
638 | -e 's:g95 L_O =:g95 L_O = -Wl,-rpath='"$ncdfdir"'/lib:' \ |
---|
639 | -e "s:-fmod=:-$fmod:" -e 's/-fno-second-underscore//' \ |
---|
640 | -e 's:#-Q- g95 M_K = gmake:#-Q- g95 M_K = make:' \ |
---|
641 | tmp >| AA_make.gdef |
---|
642 | |
---|
643 | if [ $pcmac == 1 ] |
---|
644 | then |
---|
645 | cp AA_make.gdef tmp |
---|
646 | sed -e 's/rpath=/rpath,/g' tmp > AA_make.gdef |
---|
647 | fi |
---|
648 | |
---|
649 | |
---|
650 | # We use lines for g95 even for the other compilers to run ins_make |
---|
651 | if [ "$use_shell" = "ksh" ] ; then |
---|
652 | ./ins_make $o_ins_make |
---|
653 | else # bash |
---|
654 | sed -e s:/bin/ksh:/bin/bash:g ins_make > ins_make.bash |
---|
655 | if [ "`grep jeanzay AA_make.gdef`" = "" ] ; then # Bidouille pour compiler sur ada des vieux modipsl.tar |
---|
656 | echo 'Warning jean-zay not in AA_make.gdef' |
---|
657 | echo 'Think about updating' |
---|
658 | exit 1 |
---|
659 | fi |
---|
660 | |
---|
661 | chmod u=rwx ins_make.bash |
---|
662 | ./ins_make.bash $o_ins_make |
---|
663 | fi # of if [ "$use_shell" = "ksh" ] |
---|
664 | |
---|
665 | echo install_lmdz.sh MODIPSL_OK `date` |
---|
666 | |
---|
667 | cd $MODEL/modipsl/modeles/IOIPSL/src |
---|
668 | ioipsllog=`pwd`/ioipsl.log |
---|
669 | echo '##########################################################' |
---|
670 | echo 'Compiling IOIPSL, the interface library with Netcdf' |
---|
671 | echo '##########################################################' |
---|
672 | echo `date` |
---|
673 | echo log file : $ioipsllog |
---|
674 | |
---|
675 | if [ "$use_shell" = "bash" ] ; then |
---|
676 | cp Makefile Makefile.ksh |
---|
677 | sed -e s:/bin/ksh:/bin/bash:g Makefile.ksh > Makefile |
---|
678 | fi |
---|
679 | # if [ "$pclinux" = 1 ] ; then |
---|
680 | # Build IOIPSL modules and library |
---|
681 | $make clean |
---|
682 | $make > $ioipsllog 2>&1 |
---|
683 | if [ "$compiler" = "$gfortran" -o "$compiler" = "mpif90" ] ; then # copy module files to lib |
---|
684 | cp -f *.mod ../../../lib |
---|
685 | fi |
---|
686 | # Build IOIPSL tools (ie: "rebuild", if present) |
---|
687 | if [ -f $MODEL/modipsl/modeles/IOIPSL/tools/rebuild ] ; then |
---|
688 | cd $MODEL/modipsl/modeles/IOIPSL/tools |
---|
689 | # adapt Makefile & rebuild script if in bash |
---|
690 | if [ "$use_shell" = "bash" ] ; then |
---|
691 | cp Makefile Makefile.ksh |
---|
692 | sed -e s:/bin/ksh:/bin/bash:g Makefile.ksh > Makefile |
---|
693 | cp rebuild rebuild.ksh |
---|
694 | sed -e 's:/bin/ksh:/bin/bash:g' \ |
---|
695 | -e 's:print -u2:echo:g' \ |
---|
696 | -e 's:print:echo:g' rebuild.ksh > rebuild |
---|
697 | fi |
---|
698 | $make clean |
---|
699 | $make > $ioipsllog 2>&1 |
---|
700 | fi |
---|
701 | # fi # of if [ "$pclinux" = 1 ] |
---|
702 | |
---|
703 | else # of if [ $ioipsl = 1 ] |
---|
704 | if [ ${hostname:0:5} = jean- ] ; then |
---|
705 | cd $MODEL/modipsl |
---|
706 | cd util |
---|
707 | if [ "`grep jeanzay AA_make.gdef`" = "" ] ; then |
---|
708 | echo 'Warning jean-zay not in AA_make.gdef' |
---|
709 | echo 'Think about updating' |
---|
710 | exit 1 |
---|
711 | fi |
---|
712 | ./ins_make $o_ins_make |
---|
713 | # Compile IOIPSL on jean-zay |
---|
714 | cd $MODEL/modipsl/modeles/IOIPSL/src |
---|
715 | gmake > ioipsl.log |
---|
716 | cd $MODEL/modipsl/modeles/IOIPSL/tools |
---|
717 | gmake > ioipsl.log |
---|
718 | |
---|
719 | fi |
---|
720 | echo install_lmdz.sh ioipsl_OK `date` |
---|
721 | fi # of if [ $ioipsl = 1 ] |
---|
722 | # Saving ioipsl lib for possible parallel compile |
---|
723 | cd $MODEL/modipsl |
---|
724 | tar cf ioipsl.tar lib/ bin/ |
---|
725 | |
---|
726 | #========================================================================= |
---|
727 | if [ "$with_xios" = "y" ] ; then |
---|
728 | echo '##########################################################' |
---|
729 | echo 'Compiling XIOS' |
---|
730 | echo '##########################################################' |
---|
731 | cd $MODEL/modipsl/modeles |
---|
732 | xioslog=`pwd`/xios.log |
---|
733 | #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/install_xios.bash |
---|
734 | myget import/install_xios.bash |
---|
735 | chmod u=rwx install_xios.bash |
---|
736 | if [ ${hostname:0:5} = jean- ] ; then |
---|
737 | svn co http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/branchs/xios-2.5 XIOS |
---|
738 | cd XIOS/arch |
---|
739 | svn update |
---|
740 | cd .. |
---|
741 | echo "Compiling XIOS, start" `date` "(it takes about 20 min on Jean-Zay)" |
---|
742 | echo "log file: $xioslog" |
---|
743 | ./make_xios --prod --arch $arch --job 4 > xios.log 2>&1 |
---|
744 | else |
---|
745 | ./install_xios.bash -prefix $MODEL/modipsl/modeles \ |
---|
746 | -netcdf ${ncdfdir} -hdf5 ${ncdfdir} \ |
---|
747 | -MPI $root_mpi -arch $arch > xios.log 2>&1 |
---|
748 | fi # of case Jean-Zay |
---|
749 | if [ -f XIOS/lib/libxios.a ] ; then |
---|
750 | echo "XIOS library successfully generated" |
---|
751 | echo install_lmdz.sh XIOS_OK `date` |
---|
752 | fi |
---|
753 | fi |
---|
754 | |
---|
755 | #============================================================================ |
---|
756 | veget_version=false |
---|
757 | if [ "$veget" != 'NONE' ] ; then |
---|
758 | cd $MODEL/modipsl/modeles/ORCHIDEE |
---|
759 | set +e ; svn upgrade ; set -e |
---|
760 | if [ "$veget" = "CMIP6" ] ; then |
---|
761 | veget_version=orchidee2.0 |
---|
762 | orchidee_rev=6592 |
---|
763 | else # specific orchidee revision newer than CMIP6, on 2_1 or 2_2 branches |
---|
764 | veget_version=orchidee2.1 |
---|
765 | orchidee_rev=$veget |
---|
766 | if [ $veget -lt 4465 ] ; then |
---|
767 | echo 'Stopping, ORCHIDEE version too old, script needs work on the CPP flags to pass to makelmdz' |
---|
768 | exit 1 |
---|
769 | fi |
---|
770 | set +e |
---|
771 | # which branch is my version on? |
---|
772 | orcbranch=`svn log -v -q svn://forge.ipsl.jussieu.fr/orchidee/ -r $veget |grep ORCHIDEE |head -1| sed -e 's:ORCHIDEE/.*$:ORCHIDEE:' | awk '{print $2}'` |
---|
773 | # switch to that branch |
---|
774 | echo IF YOU INSTALL ORCHIDEE THE VERY FIRST TIME, ASK for PASSWORD at orchidee-help@listes.ipsl.fr |
---|
775 | svn switch -r $veget --accept theirs-full svn://forge.ipsl.jussieu.fr/orchidee/$orcbranch |
---|
776 | svn log -r $veget | grep $veget |
---|
777 | if [ $? -gt 0 ] ; then |
---|
778 | echo 'Cannot update ORCHIDEE as not on the right branch for ORCHIDEE' |
---|
779 | exit |
---|
780 | fi |
---|
781 | set -e |
---|
782 | set +e ; svn update -r $veget ; set -e |
---|
783 | fi |
---|
784 | # Correctif suite debug Jean-Zay |
---|
785 | sed -i -e 's/9010 FORMAT(A52,F17.14)/9010 FORMAT(A52,F20.14)/' src_stomate/stomate.f90 |
---|
786 | opt_orc="-prod" ; if [ "$optim" = "-debug" ] ; then opt_orc="-debug" ; fi |
---|
787 | |
---|
788 | orchideelog=`pwd`/orchidee.log |
---|
789 | echo '########################################################' |
---|
790 | echo 'Compiling ORCHIDEE, the continental surface model ' |
---|
791 | echo '########################################################' |
---|
792 | echo Start of the first compilation of orchidee, in sequential mode: `date` |
---|
793 | echo log file : $orchideelog |
---|
794 | |
---|
795 | export ORCHPATH=`pwd` |
---|
796 | xios_orchid="-noxios" |
---|
797 | if [ "$with_xios" = "y" ] ; then |
---|
798 | xios_orchid="-xios" |
---|
799 | fi |
---|
800 | if [ -d tools ] ; then |
---|
801 | ################################################################### |
---|
802 | # Pour les experts qui voudraient changer de version d'orchidee. |
---|
803 | # Attention : necessite d'avoir le password pour orchidee |
---|
804 | |
---|
805 | # Correctif suite debug Jean-Zay |
---|
806 | if [ -f src_global/time.f90 ] ; then sed -i -e 's/CALL tlen2itau/\!CALL tlen2itau/' src_global/time.f90 ; fi |
---|
807 | ################################################################### |
---|
808 | if [ "$veget_version" == "false" ] ; then veget_version=orchidee2.0 ; fi |
---|
809 | cd arch |
---|
810 | sed -e s:"%COMPILER .*.$":"%COMPILER $compiler":1 \ |
---|
811 | -e s:"%LINK .*.$":"%LINK $compiler":1 \ |
---|
812 | -e s:"%FPP_FLAGS .*.$":"%FPP_FLAGS $fpp_flags":1 \ |
---|
813 | -e s:"%PROD_FFLAGS .*.$":"%PROD_FFLAGS $OPTIM":1 \ |
---|
814 | -e s:"%DEV_FFLAGS .*.$":"%DEV_FFLAGS $OPTDEV":1 \ |
---|
815 | -e s:"%DEBUG_FFLAGS .*.$":"%DEBUG_FFLAGS $OPTDEB":1 \ |
---|
816 | -e s:"%BASE_FFLAGS .*.$":"%BASE_FFLAGS $OPTPREC":1 \ |
---|
817 | -e s:"%BASE_LD .*.$":"%BASE_LD $BASE_LD":1 \ |
---|
818 | -e s:"%ARFLAGS .*.$":"%ARFLAGS $ARFLAGS":1 \ |
---|
819 | arch-gfortran.fcm > arch-local.fcm |
---|
820 | echo "NETCDF_LIBDIR=\"-L${ncdfdir}/lib -lnetcdff -lnetcdf\"" > arch-local.path |
---|
821 | echo "NETCDF_INCDIR=${ncdfdir}/include" >> arch-local.path |
---|
822 | echo "IOIPSL_INCDIR=$ORCHPATH/../../lib" >> arch-local.path |
---|
823 | echo "IOIPSL_LIBDIR=$ORCHPATH/../../lib" >> arch-local.path |
---|
824 | echo 'XIOS_INCDIR=${ORCHDIR}/../XIOS/inc' >> arch-local.path |
---|
825 | echo 'XIOS_LIBDIR="${ORCHDIR}/../XIOS/lib -lxios"' >> arch-local.path |
---|
826 | cd ../ |
---|
827 | |
---|
828 | echo ./makeorchidee_fcm -j $xios_orchid $opt_orc -parallel none -arch $arch |
---|
829 | ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc -parallel none -arch $arch > $orchideelog 2>&1 |
---|
830 | pwd |
---|
831 | else # of "if [ -d tools ]" |
---|
832 | if [ -d src_parallel ] ; then |
---|
833 | liste_src="parallel parameters global stomate sechiba driver" |
---|
834 | if [ "$veget_version" == "false" ] ; then veget_version=orchidee2.0 ; fi |
---|
835 | fi |
---|
836 | for d in $liste_src ; do src_d=src_$d |
---|
837 | echo src_d $src_d |
---|
838 | echo ls ; ls |
---|
839 | if [ ! -d $src_d ] ; then echo Problem orchidee : no $src_d ; exit ; fi |
---|
840 | cd $src_d ; \rm -f *.mod make ; $make clean |
---|
841 | $make > $orchideelog 2>&1 ; if [ "$compiler" = "$gfortran" -o "$compiler" = "mpif90" ] ; then cp -f *.mod ../../../lib ; fi |
---|
842 | cd .. |
---|
843 | done |
---|
844 | fi # of "if [ -d tools ]" |
---|
845 | echo install_lmdz.sh orchidee_compil_seq_OK `date` |
---|
846 | fi # of if [ "$veget" != 'NONE' ] |
---|
847 | |
---|
848 | |
---|
849 | #============================================================================ |
---|
850 | # Ehouarn: the directory name LMDZ* depends on version/tar file... |
---|
851 | if [ -d $MODEL/modipsl/modeles/LMD* ] ; then |
---|
852 | echo '###############################################################' |
---|
853 | echo 'Preparing LMDZ compilation : arch file, svn switch if needed...' |
---|
854 | echo '###############################################################' |
---|
855 | cd $MODEL/modipsl/modeles/LMD* |
---|
856 | LMDZPATH=`pwd` |
---|
857 | else |
---|
858 | echo "ERROR: No LMD* directory !!!" |
---|
859 | exit |
---|
860 | fi |
---|
861 | |
---|
862 | ########################################################### |
---|
863 | # For those who want to use fcm to compile via : |
---|
864 | # makelmdz_fcm -arch local ..... |
---|
865 | ############################################################ |
---|
866 | |
---|
867 | if [ "$pclinux" = "1" ] ; then |
---|
868 | |
---|
869 | # create local 'arch' files (if on Linux PC): |
---|
870 | cd arch |
---|
871 | # arch-local.path file |
---|
872 | echo "NETCDF_LIBDIR=\"-L${ncdfdir}/lib -lnetcdff -lnetcdf\"" > arch-local.path |
---|
873 | echo "NETCDF_INCDIR=-I${ncdfdir}/include" >> arch-local.path |
---|
874 | echo 'IOIPSL_INCDIR=$LMDGCM/../../lib' >> arch-local.path |
---|
875 | echo 'IOIPSL_LIBDIR=$LMDGCM/../../lib' >> arch-local.path |
---|
876 | echo 'XIOS_INCDIR=$LMDGCM/../XIOS/inc' >> arch-local.path |
---|
877 | echo 'XIOS_LIBDIR=$LMDGCM/../XIOS/lib' >> arch-local.path |
---|
878 | echo 'ORCH_INCDIR=$LMDGCM/../../lib' >> arch-local.path |
---|
879 | echo 'ORCH_LIBDIR=$LMDGCM/../../lib' >> arch-local.path |
---|
880 | |
---|
881 | if [ $pcmac == 1 ] ; then |
---|
882 | BASE_LD="$BASE_LD -Wl,-rpath,${ncdfdir}/lib" |
---|
883 | else |
---|
884 | BASE_LD="$BASE_LD -Wl,-rpath=${ncdfdir}/lib" |
---|
885 | fi |
---|
886 | # Arch-local.fcm file (adapted from arch-linux-32bit.fcm) |
---|
887 | |
---|
888 | if [ $real = r8 ] ; then FPP_DEF=NC_DOUBLE ; else FPP_DEF="" ; fi |
---|
889 | sed -e s:"%COMPILER .*.$":"%COMPILER $compiler":1 \ |
---|
890 | -e s:"%LINK .*.$":"%LINK $compiler":1 \ |
---|
891 | -e s:"%PROD_FFLAGS .*.$":"%PROD_FFLAGS $OPTIM":1 \ |
---|
892 | -e s:"%DEV_FFLAGS .*.$":"%DEV_FFLAGS $OPTDEV":1 \ |
---|
893 | -e s:"%DEBUG_FFLAGS .*.$":"%DEBUG_FFLAGS $OPTDEB":1 \ |
---|
894 | -e s:"%BASE_FFLAGS .*.$":"%BASE_FFLAGS $OPTPREC":1 \ |
---|
895 | -e s:"%FPP_DEF .*.$":"%FPP_DEF $FPP_DEF":1 \ |
---|
896 | -e s:"%BASE_LD .*.$":"%BASE_LD $BASE_LD":1 \ |
---|
897 | -e s:"%ARFLAGS .*.$":"%ARFLAGS $ARFLAGS":1 \ |
---|
898 | arch-linux-32bit.fcm > arch-local.fcm |
---|
899 | |
---|
900 | cd .. |
---|
901 | ### Adapt "bld.cfg" (add the shell): |
---|
902 | whereisthatshell=$(which ${use_shell}) |
---|
903 | echo "bld::tool::SHELL $whereisthatshell" >> bld.cfg |
---|
904 | |
---|
905 | fi # of if [ "$pclinux" = 1 ] |
---|
906 | |
---|
907 | |
---|
908 | cd $MODEL/modipsl/modeles/LMDZ* |
---|
909 | lmdzlog=`pwd`/lmdz.log |
---|
910 | |
---|
911 | ################################################################## |
---|
912 | # Possibly update LMDZ if a specific svn release is requested |
---|
913 | ################################################################## |
---|
914 | |
---|
915 | |
---|
916 | set +e ; svn upgrade ; set -e |
---|
917 | if [ "$svn" = "last" ] ; then svnopt="" ; else svnopt="-r $svn" ; fi |
---|
918 | if [ "$svn" != "" ] ; then |
---|
919 | svn info | grep -q 'http:' |
---|
920 | if [ $? = 0 ] ; then |
---|
921 | svn switch --relocate http://svn.lmd.jussieu.fr/LMDZ https://svn.lmd.jussieu.fr/LMDZ |
---|
922 | fi |
---|
923 | svn update $svnopt |
---|
924 | fi |
---|
925 | set -e |
---|
926 | |
---|
927 | echo '##################################################################' |
---|
928 | echo "Preparing script compile.sh for LMDZ compilation" |
---|
929 | echo "It will only be run automatically if bench=1/tuto" |
---|
930 | echo Here bench=$bench |
---|
931 | echo '##################################################################' |
---|
932 | |
---|
933 | if [ "$env_file" != "" ] ; then mv arch/arch-${arch}.env arch/arch-${arch}.orig ; \cp -f $env_file arch/arch-${arch}.env ; fi |
---|
934 | |
---|
935 | if [ $compile_with_fcm = 1 ] ; then makelmdz="makelmdz_fcm $optim -arch $arch -j 8 " ; else makelmdz="makelmdz $optim -arch $arch" ; fi |
---|
936 | |
---|
937 | # sequential compilation |
---|
938 | if [ "$sequential" = 1 ] ; then |
---|
939 | echo Sequential compilation command, saved in compile.sh: |
---|
940 | echo "./$makelmdz $optim $OPT_MAKELMDZ $optim $opt_rad $opt_cosp -d ${grid_resolution} -v $veget_version gcm " |
---|
941 | echo "./$makelmdz $optim $OPT_MAKELMDZ $optim $opt_rad $opt_cosp -d ${grid_resolution} -v $veget_version gcm " >> compile.sh |
---|
942 | chmod +x ./compile.sh |
---|
943 | if [ $bench = 1 ] ; then |
---|
944 | echo install_lmdz.sh start_lmdz_seq_compilation `date` |
---|
945 | echo log file: $lmdzlog |
---|
946 | ./compile.sh > $lmdzlog 2>&1 |
---|
947 | echo install_lmdz.sh end_lmdz_seq_compilation `date` |
---|
948 | fi |
---|
949 | fi # fin sequential |
---|
950 | |
---|
951 | # compiling in parallel mode |
---|
952 | if [ $parallel != "none" ] ; then |
---|
953 | echo '##########################################################' |
---|
954 | echo ' Parallel compile ' |
---|
955 | echo '##########################################################' |
---|
956 | echo "(after saving the sequential libs and binaries)" |
---|
957 | cd $MODEL/modipsl |
---|
958 | tar cf sequential.tar bin/ lib/ |
---|
959 | \rm -rf bin/ lib/ |
---|
960 | tar xf ioipsl.tar |
---|
961 | # |
---|
962 | # Orchidee |
---|
963 | # |
---|
964 | cd $ORCHPATH |
---|
965 | if [ -d src_parallel -a $veget != 'NONE' ] ; then |
---|
966 | cd arch |
---|
967 | sed \ |
---|
968 | -e s:"%COMPILER.*.$":"%COMPILER $par_comp":1 \ |
---|
969 | -e s:"%LINK.*.$":"%LINK $par_comp":1 \ |
---|
970 | -e s:"%MPI_FFLAG.*.$":"%MPI_FFLAGS $MPI_FLAGS":1 \ |
---|
971 | -e s:"%OMP_FFLAG.*.$":"%OMP_FFLAGS $OMP_FLAGS":1 \ |
---|
972 | -e s:"%MPI_LD.*.$":"%MPI_LD $MPI_LD":1 \ |
---|
973 | -e s:"%OMP_LD.*.$":"%OMP_LD $OMP_LD":1 \ |
---|
974 | arch-local.fcm > tmp.fcm |
---|
975 | |
---|
976 | mv tmp.fcm arch-local.fcm |
---|
977 | cd ../ |
---|
978 | echo Compiling ORCHIDEE in parallel mode `date` |
---|
979 | echo logfile $orchideelog |
---|
980 | echo "NOTE : to recompile it when necessary, use ./compile_orc.sh in modipsl/modeles/ORCHIDEE" |
---|
981 | echo ./makeorchidee_fcm -j 8 -clean $xios_orchid $opt_orc -parallel $parallel -arch $arch > compile_orc.sh |
---|
982 | echo ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc -parallel $parallel -arch $arch >> compile_orc.sh |
---|
983 | echo echo Now you must also recompile LMDZ, by running ./compile.sh in modeles/LMDZ >> compile_orc.sh |
---|
984 | chmod u+x compile_orc.sh |
---|
985 | ./makeorchidee_fcm -j 8 -clean $xios_orchid $opt_orc -parallel $parallel -arch $arch > $orchideelog 2>&1 |
---|
986 | ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc -parallel $parallel -arch $arch >> $orchideelog 2>&1 |
---|
987 | echo End of ORCHIDEE compilation in parallel mode `date` |
---|
988 | elif [ $veget != 'NONE' ] ; then |
---|
989 | echo '##########################################################' |
---|
990 | echo ' Orchidee version too old ' |
---|
991 | echo ' Please update to new version ' |
---|
992 | echo '##########################################################' |
---|
993 | exit |
---|
994 | fi # of [ -d src_parallel -a $veget != 'NONE' ] |
---|
995 | |
---|
996 | # LMDZ |
---|
997 | cd $LMDZPATH |
---|
998 | if [ $arch = local ] ; then |
---|
999 | cd arch |
---|
1000 | sed -e s:"%COMPILER.*.$":"%COMPILER $par_comp":1 \ |
---|
1001 | -e s:"%LINK.*.$":"%LINK $par_comp":1 \ |
---|
1002 | -e s:"%MPI_FFLAG.*.$":"%MPI_FFLAGS $MPI_FLAGS":1 \ |
---|
1003 | -e s:"%OMP_FFLAG.*.$":"%OMP_FFLAGS $OMP_FLAGS":1 \ |
---|
1004 | -e s:"%ARFLAGS.*.$":"%ARFLAGS $ARFLAGS":1 \ |
---|
1005 | -e s@"%BASE_LD.*.$"@"%BASE_LD -Wl,-rpath=${root_mpi}/lib:${ncdfdir}/lib"@1 \ |
---|
1006 | -e s:"%MPI_LD.*.$":"%MPI_LD $MPI_LD":1 \ |
---|
1007 | -e s:"%OMP_LD.*.$":"%OMP_LD $OMP_LD":1 \ |
---|
1008 | arch-local.fcm > tmp.fcm |
---|
1009 | mv tmp.fcm arch-local.fcm |
---|
1010 | cd ../ |
---|
1011 | fi |
---|
1012 | rm -f compile.sh |
---|
1013 | echo resol=${grid_resolution} >> compile.sh |
---|
1014 | if [ ${hostname:0:5} = jean- -a "$cosp" = "v2" ] ; then |
---|
1015 | |
---|
1016 | echo LMDZ compilation command in parallel mode, saved in compile.sh, is : |
---|
1017 | echo "(ATTENTION le probleme de cospv2 sur jean-zay en mode prod n est pas corrige ! )" |
---|
1018 | # ATTENTION le probleme de cospv2 sur jean-zay en mode prod n est pas corrige |
---|
1019 | echo ./$makelmdz -dev $optim $OPT_MAKELMDZ $opt_rad $opt_cosp $opt_makelmdz_xios -d \$resol -v $veget_version -mem -parallel $parallel gcm >> compile.sh |
---|
1020 | echo ./$makelmdz -dev $optim $OPT_MAKELMDZ $opt_rad $opt_cosp $opt_makelmdz_xios -d \$resol -v $veget_version -mem -parallel $parallel gcm |
---|
1021 | else |
---|
1022 | echo ./$makelmdz $optim $OPT_MAKELMDZ $opt_rad $opt_cosp $opt_makelmdz_xios -d \$resol -v $veget_version -mem -parallel $parallel gcm >> compile.sh |
---|
1023 | echo ./$makelmdz $optim $OPT_MAKELMDZ $opt_rad $opt_cosp $opt_makelmdz_xios -d \$resol -v $veget_version -mem -parallel $parallel gcm |
---|
1024 | fi |
---|
1025 | chmod +x ./compile.sh |
---|
1026 | |
---|
1027 | if [ $bench = 1 ] ; then |
---|
1028 | echo Compiling LMDZ in parallel mode `date`, LMDZ log file: $lmdzlog ; ./compile.sh > $lmdzlog 2>&1 |
---|
1029 | fi |
---|
1030 | |
---|
1031 | fi # of if [ $parallel != "none" ] |
---|
1032 | |
---|
1033 | |
---|
1034 | ################################################################## |
---|
1035 | # Verification du succes de la compilation |
---|
1036 | ################################################################## |
---|
1037 | |
---|
1038 | # Recherche de l'executable dont le nom a change au fil du temps ... |
---|
1039 | gcm="" |
---|
1040 | #for exe in gcm.e bin/gcm_${grid_resolution}_phylmd_seq_orch.e bin/gcm_${grid_resolution}_phylmd_seq.e bin/gcm_${grid_resolution}_phylmd_para_mem_orch.e bin/gcm_${grid_resolution}_phylmd_para_mem.e ; do |
---|
1041 | for exe in gcm.e bin/gcm_${grid_resolution}_phylmd${suff_exe}${suff_orc}.e ; do if [ -f $exe ] ; then gcm=$exe ; fi |
---|
1042 | done |
---|
1043 | |
---|
1044 | if [ "$gcm" = "" ] ; then |
---|
1045 | if [ $bench = 1 ] ; then |
---|
1046 | echo 'Compilation failed !! Cannot run the benchmark;' |
---|
1047 | exit |
---|
1048 | else |
---|
1049 | echo 'Compilation not done (only done when bench=1)' |
---|
1050 | fi |
---|
1051 | else |
---|
1052 | echo '##########################################################' |
---|
1053 | echo 'Compilation successfull !! ' `date` |
---|
1054 | echo '##########################################################' |
---|
1055 | echo The executable is $gcm |
---|
1056 | fi |
---|
1057 | |
---|
1058 | ################################################################## |
---|
1059 | # Below, we run a benchmark if bench=1 or tuto |
---|
1060 | ################################################################## |
---|
1061 | |
---|
1062 | if [ $bench = tuto ] ; then |
---|
1063 | myget Training/tutorial.tar ; tar xvf tutorial.tar ; cd TUTORIAL ; ./init.sh |
---|
1064 | |
---|
1065 | elif [ $bench = 1 ] ; then |
---|
1066 | # TOUTE CETTE SECTION DEVRAIT DISPARAITRE POUR UNE COMMANDE |
---|
1067 | # OU DES BENCHS PAR MOTS CLES COMME tuto |
---|
1068 | |
---|
1069 | echo '##########################################################' |
---|
1070 | echo ' Running a test run ' |
---|
1071 | echo '##########################################################' |
---|
1072 | |
---|
1073 | \rm -rf BENCH${grid_resolution} |
---|
1074 | bench=bench_lmdz_${grid_resolution} |
---|
1075 | echo install_lmdz.sh before bench download `date` |
---|
1076 | #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/$bench.tar.gz |
---|
1077 | myget 3DBenchs/$bench.tar.gz |
---|
1078 | echo install_lmdz.sh after bench download `date` |
---|
1079 | tar xvf $bench.tar.gz |
---|
1080 | |
---|
1081 | if [ "$cosp" = "v1" -o "$cosp" = "v2" ] ; then |
---|
1082 | cd BENCH${grid_resolution} |
---|
1083 | # copier les fichiers namelist input et output our COSP |
---|
1084 | cp ../DefLists/cosp*_input_nl.txt . |
---|
1085 | cp ../DefLists/cosp*_output_nl.txt . |
---|
1086 | # Activer la cles ok_cosp pour tourner avec COSP |
---|
1087 | sed -e 's@ok_cosp=n@ok_cosp=y@' config.def > tmp |
---|
1088 | \mv -f tmp config.def |
---|
1089 | cd .. |
---|
1090 | fi |
---|
1091 | |
---|
1092 | if [ -n "$physiq" ]; then |
---|
1093 | cd BENCH${grid_resolution} |
---|
1094 | if [ -f physiq.def_${physiq} ]; then |
---|
1095 | cp physiq.def_${physiq} physiq.def |
---|
1096 | echo using physiq.def_${physiq} |
---|
1097 | else |
---|
1098 | echo using standard physiq.def |
---|
1099 | fi |
---|
1100 | cd .. |
---|
1101 | else |
---|
1102 | echo using standard physiq.def |
---|
1103 | fi |
---|
1104 | |
---|
1105 | if [ "$with_xios" = "y" ] ; then |
---|
1106 | cd BENCH${grid_resolution} |
---|
1107 | cp ../DefLists/iodef.xml . |
---|
1108 | cp ../DefLists/context_lmdz.xml . |
---|
1109 | cp ../DefLists/field_def_lmdz.xml . |
---|
1110 | # A raffiner par la suite |
---|
1111 | echo A FAIRE : Copier les *xml en fonction de l option cosp |
---|
1112 | cp ../DefLists/field_def_cosp*.xml . |
---|
1113 | cp ../DefLists/file_def_hist*xml . |
---|
1114 | # adapt iodef.xml to use attached mode |
---|
1115 | sed -e 's@"using_server" type="bool">true@"using_server" type="bool">false@' iodef.xml > tmp |
---|
1116 | \mv -f tmp iodef.xml |
---|
1117 | |
---|
1118 | # and convert all the enabled="_AUTO_" (for libIGCM) to enabled=.FALSE. |
---|
1119 | # except for histday |
---|
1120 | for histfile in file_def_hist*xml |
---|
1121 | do |
---|
1122 | if [ "$histfile" = "file_def_histday_lmdz.xml" ] ; then |
---|
1123 | sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".TRUE."@' $histfile > tmp ; \mv -f tmp $histfile |
---|
1124 | sed -e 's@output_level="_AUTO_"@output_level="5"@' $histfile > tmp ; \mv -f tmp $histfile |
---|
1125 | sed -e 's@compression_level="2"@compression_level="0"@' $histfile > tmp ; \mv -f tmp $histfile |
---|
1126 | else |
---|
1127 | sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".FALSE."@' $histfile > tmp ; \mv -f tmp $histfile |
---|
1128 | fi |
---|
1129 | done |
---|
1130 | # and add option "ok_all_xml=y" in config.def |
---|
1131 | echo "### XIOS outputs" >> config.def |
---|
1132 | echo 'ok_all_xml=.true.' >> config.def |
---|
1133 | |
---|
1134 | #activer les sorties pour Cosp |
---|
1135 | if [ "$cosp" = "v1" ] ; then |
---|
1136 | histfile=file_def_histdayCOSP_lmdz.xml |
---|
1137 | sed -e 's@enabled=".FALSE."@enabled=".TRUE."@' $histfile > tmp ; \mv -f tmp $histfile |
---|
1138 | sed -e 's@output_level="_AUTO_"@output_level="5"@' $histfile > tmp ; \mv -f tmp $histfile |
---|
1139 | sed -e 's@compression_level="2"@compression_level="0"@' $histfile > tmp ; \mv -f tmp $histfile |
---|
1140 | fi |
---|
1141 | if [ "$cosp" = "v2" ] ; then |
---|
1142 | histfile=file_def_histdayCOSPv2_lmdz.xml |
---|
1143 | sed -e 's@compression_level="2"@compression_level="0"@' $histfile > tmp ; \mv -f tmp $histfile |
---|
1144 | contextfile=context_lmdz.xml |
---|
1145 | sed -e 's@src="./file_def_histdayCOSP_lmdz.xml"@src="./file_def_histdayCOSPv2_lmdz.xml"@' $contextfile > tmp ; \mv -f tmp $contextfile |
---|
1146 | sed -e 's@src="./file_def_histmthCOSP_lmdz.xml"@src="./file_def_histmthCOSPv2_lmdz.xml"@' $contextfile > tmp ; \mv -f tmp $contextfile |
---|
1147 | sed -e 's@src="./file_def_histhfCOSP_lmdz.xml"@src="./file_def_histhfCOSPv2_lmdz.xml"@' $contextfile > tmp ; \mv -f tmp $contextfile |
---|
1148 | fieldfile=field_def_lmdz.xml |
---|
1149 | sed -e 's@field_def_cosp1.xml@field_def_cospv2.xml@' $fieldfile > tmp ; \mv -f tmp $fieldfile |
---|
1150 | fi |
---|
1151 | |
---|
1152 | cd .. |
---|
1153 | fi |
---|
1154 | |
---|
1155 | # Cas Bensh avec ecrad |
---|
1156 | if [ "$rad" = "ecrad" ] ; then |
---|
1157 | cd BENCH${grid_resolution} |
---|
1158 | cp ../DefLists/namelist_ecrad . |
---|
1159 | cp -r ../libf/phylmd/ecrad/data . |
---|
1160 | # Attention au cas ou ne 1 |
---|
1161 | sed -e 's@iflag_rrtm=1@iflag_rrtm=2@' physiq.def > tmp |
---|
1162 | \mv -f tmp physiq.def |
---|
1163 | cd .. |
---|
1164 | fi |
---|
1165 | |
---|
1166 | cp $gcm BENCH${grid_resolution}/gcm.e |
---|
1167 | |
---|
1168 | cd BENCH${grid_resolution} |
---|
1169 | # On cree le fichier bench.sh au besoin |
---|
1170 | # Dans le cas 48x36x39 le bench.sh existe deja en parallele |
---|
1171 | |
---|
1172 | if [ "$grid_resolution" = "48x36x39" ] ; then |
---|
1173 | echo On ne touche pas au bench.sh |
---|
1174 | # But we have to adapt "run_local.sh" for $mpirun |
---|
1175 | sed -e "s@mpirun@$mpirun@g" run_local.sh > tmp |
---|
1176 | mv -f tmp run_local.sh |
---|
1177 | chmod u=rwx run_local.sh |
---|
1178 | elif [ "${parallel:0:3}" = "mpi" ] ; then |
---|
1179 | # Lancement avec deux procs mpi et 2 openMP |
---|
1180 | echo "export OMP_STACKSIZE=800M" > bench.sh |
---|
1181 | if [ "${parallel:4:3}" = "omp" ] ; then |
---|
1182 | echo "export OMP_NUM_THREADS=2" >> bench.sh |
---|
1183 | fi |
---|
1184 | if [ "$cosp" = "v1" -o "$cosp" = "v2" ] ; then |
---|
1185 | if [ ${hostname:0:5} = jean- ] ; then |
---|
1186 | chmod +x ../arch.env |
---|
1187 | ../arch.env |
---|
1188 | echo "ulimit -s 2000000" >> bench.sh |
---|
1189 | else |
---|
1190 | echo "ulimit -s 200000" >> bench.sh |
---|
1191 | fi |
---|
1192 | else |
---|
1193 | echo "ulimit -s unlimited" >> bench.sh |
---|
1194 | fi |
---|
1195 | if [ ${hostname:0:5} = jean- ] ; then |
---|
1196 | . ../arch/arch-${arch}.env |
---|
1197 | echo "srun -n 2 -A $idris_acct@cpu gcm.e > listing 2>&1" >> bench.sh |
---|
1198 | else |
---|
1199 | echo "$mpirun -np 2 gcm.e > listing 2>&1" >> bench.sh |
---|
1200 | fi |
---|
1201 | # Add rebuild, using reb.sh if it is there |
---|
1202 | echo 'if [ -f reb.sh ] ; then' >> bench.sh |
---|
1203 | echo ' ./reb.sh histday ; ./reb.sh histmth ; ./reb.sh histhf ; ./reb.sh histins ; ./reb.sh stomate_history ; ./reb.sh sechiba_history ; ./reb.sh sechiba_out_2 ' >> bench.sh |
---|
1204 | echo 'fi' >> bench.sh |
---|
1205 | else |
---|
1206 | echo "./gcm.e > listing 2>&1" > bench.sh |
---|
1207 | fi |
---|
1208 | # Getting orchidee stuff |
---|
1209 | if [ $veget == 'CMIP6' ] ; then |
---|
1210 | #echo 'myget 3DBenchs/BENCHorch11.tar.gz' |
---|
1211 | #myget 3DBenchs/BENCHorch11.tar.gz |
---|
1212 | #tar xvzf BENCHorch11.tar.gz |
---|
1213 | echo 'myget 3DBenchs/BENCHCMIP6.tar.gz' |
---|
1214 | myget 3DBenchs/BENCHCMIP6.tar.gz |
---|
1215 | tar xvzf BENCHCMIP6.tar.gz |
---|
1216 | sed -e "s:VEGET=n:VEGET=y:" config.def > tmp |
---|
1217 | mv -f tmp config.def |
---|
1218 | if [ "$with_xios" = "y" ] ; then |
---|
1219 | cp ../../ORCHIDEE/src_xml/context_orchidee.xml . |
---|
1220 | echo '<context id="orchidee" src="./context_orchidee.xml"/>' > add.tmp |
---|
1221 | cp ../../ORCHIDEE/src_xml/field_def_orchidee.xml . |
---|
1222 | cp ../../ORCHIDEE/src_xml/file_def_orchidee.xml . |
---|
1223 | cp ../../ORCHIDEE/src_xml/file_def_input_orchidee.xml . |
---|
1224 | if [ -f ../../ORCHIDEE/src_xml/context_input_orchidee.xml ] ; then |
---|
1225 | cp ../../ORCHIDEE/src_xml/context_input_orchidee.xml . |
---|
1226 | echo '<context id="orchidee" src="./context_input_orchidee.xml"/>' >> add.tmp |
---|
1227 | fi |
---|
1228 | sed -e '/id="LMDZ"/r add.tmp' iodef.xml > tmp |
---|
1229 | mv tmp iodef.xml |
---|
1230 | sed -e'{/sechiba1/ s/enabled="_AUTO_"/type="one_file" enabled=".TRUE."/}' file_def_orchidee.xml > tmp ; \mv -f tmp file_def_orchidee.xml |
---|
1231 | sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".FALSE."@' file_def_orchidee.xml > tmp ; \mv -f tmp file_def_orchidee.xml |
---|
1232 | sed -e 's@output_level="_AUTO_"@output_level="1"@' file_def_orchidee.xml > tmp ; \mv -f tmp file_def_orchidee.xml |
---|
1233 | sed -e 's@output_freq="_AUTO_"@output_freq="1d"@' file_def_orchidee.xml > tmp ; \mv -f tmp file_def_orchidee.xml |
---|
1234 | sed -e 's@compression_level="4"@compression_level="0"@' file_def_orchidee.xml > tmp ; \mv -f tmp file_def_orchidee.xml |
---|
1235 | sed -e 's@XIOS_ORCHIDEE_OK = n@XIOS_ORCHIDEE_OK = y@' orchidee.def > tmp ; \mv -f tmp orchidee.def |
---|
1236 | fi |
---|
1237 | fi |
---|
1238 | echo EXECUTION DU BENCH |
---|
1239 | set +e |
---|
1240 | date ; ./bench.sh > out.bench 2>&1 ; date |
---|
1241 | set -e |
---|
1242 | tail listing |
---|
1243 | |
---|
1244 | |
---|
1245 | echo '##########################################################' |
---|
1246 | echo 'Simulation finished in' `pwd` |
---|
1247 | echo 'You have compiled with:' |
---|
1248 | cat ../compile.sh |
---|
1249 | if [ $parallel = "none" ] ; then |
---|
1250 | echo 'You may re-run it with : cd ' `pwd` ' ; gcm.e' |
---|
1251 | echo 'or ./bench.sh' |
---|
1252 | else |
---|
1253 | echo 'You may re-run it with : ' |
---|
1254 | echo 'cd ' `pwd` '; ./bench.sh' |
---|
1255 | # echo 'ulimit -s unlimited' |
---|
1256 | # echo 'export OMP_NUM_THREADS=2' |
---|
1257 | # echo 'export OMP_STACKSIZE=800M' |
---|
1258 | # echo "$mpirun -np 2 gcm.e " |
---|
1259 | fi |
---|
1260 | echo '##########################################################' |
---|
1261 | |
---|
1262 | fi # bench |
---|
1263 | |
---|
1264 | |
---|
1265 | ################################################################# |
---|
1266 | # Installation eventuelle du 1D |
---|
1267 | ################################################################# |
---|
1268 | |
---|
1269 | if [ $SCM = 1 ] ; then |
---|
1270 | cd $MODEL |
---|
1271 | #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/1D.tar.gz |
---|
1272 | myget 1D/1D.tar.gz |
---|
1273 | tar xvf 1D.tar.gz |
---|
1274 | cd 1D |
---|
1275 | ./run.sh -rad $rad |
---|
1276 | fi |
---|
1277 | #set -vx |
---|
1278 | |
---|
1279 | ################################################################# |
---|
1280 | # sauvegarde des options veget pour utilisation eventuelle tutorial_prod |
---|
1281 | ################################################################# |
---|
1282 | cd $MODEL/modipsl/modeles |
---|
1283 | #echo surface_env file created in $MODEL |
---|
1284 | echo 'veget='$veget > surface_env |
---|
1285 | #opt_veget="-v $veget_version" |
---|
1286 | #echo 'opt_veget="'$opt_veget\" >> surface_env |
---|
1287 | echo 'opt_veget="'-v $veget_version\" >> surface_env |
---|
1288 | echo 'orchidee_rev='$orchidee_rev >> surface_env |
---|
1289 | echo 'suforch='$suff_orc >> surface_env |
---|
1290 | |
---|
1291 | |
---|
1292 | |
---|
1293 | |
---|