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