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