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 { # TODO |
---|
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 install_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 | # Copy arch to different components |
---|
338 | # TODO check that this doesn't error if the source and destination are the same |
---|
339 | \cp -f "$arch_dir/arch-$arch.fcm" "$MODEL/modipsl/modeles/IOIPSL/arch" |
---|
340 | \cp -f "$arch_dir/arch-$arch.path" "$MODEL/modipsl/modeles/IOIPSL/arch" |
---|
341 | \cp -f "$arch_dir/arch-$arch.fcm" "$MODEL/modipsl/modeles/ORCHIDEE/arch" |
---|
342 | \cp -f "$arch_dir/arch-$arch.path" "$MODEL/modipsl/modeles/ORCHIDEE/arch" |
---|
343 | |
---|
344 | # TODO TEMP compat w/ old orch version - make a proper case later |
---|
345 | sed -i'' -e "s/-I//" -e "s/-L//" "$MODEL/modipsl/modeles/ORCHIDEE/arch/arch-$arch.path" # /!\ we only replace first occurence on purpose |
---|
346 | } |
---|
347 | |
---|
348 | function install_netcdf { |
---|
349 | echo "Installing Netcdf" |
---|
350 | |
---|
351 | if [[ $netcdf = 0 ]]; then |
---|
352 | ncdfdir=$(nc-config --prefix) |
---|
353 | else |
---|
354 | cd "$MODEL" |
---|
355 | |
---|
356 | case $compiler in |
---|
357 | gfortran) opt1="-compiler gnu"; opt2="-CC gcc -FC gfortran -CXX g++";; |
---|
358 | ifort) opt1="-compiler intel"; opt2="-CC icc -FC ifort -CXX icpc";; |
---|
359 | pgf90) opt1="-compiler pgf90"; opt2="-CC pgcc -FC pgf90 -CXX pgCC";; |
---|
360 | *) echo "unexpected compiler $compiler for netcdf"; exit 1 |
---|
361 | esac |
---|
362 | |
---|
363 | case $with_xios in |
---|
364 | n) script_install_netcdf="install_netcdf4_hdf5_seq.bash" |
---|
365 | ncdfdir="netcdf4_hdf5_seq" |
---|
366 | opt_="$opt1";; |
---|
367 | y) script_install_netcdf="install_netcdf4_hdf5.bash" |
---|
368 | ncdfdir="netcdf4_hdf5" |
---|
369 | opt_="$opt2 -MPI $root_mpi";; |
---|
370 | *) echo "with_xios=$with_xios, should be n or y"; exit 1 |
---|
371 | esac |
---|
372 | if [[ $netcdf = 1 ]]; then |
---|
373 | ncdfdir="$MODEL/$ncdfdir" |
---|
374 | else |
---|
375 | mkdir -p "$netcdf"; ncdfdir="$netcdf/$ncdfdir" |
---|
376 | fi |
---|
377 | |
---|
378 | echo "Repertoire netcdf $ncdfdir" |
---|
379 | if [[ ! -d $ncdfdir ]]; then |
---|
380 | netcdflog=$(pwd)/netcdf.log |
---|
381 | echo "----------------------------------------------------------" |
---|
382 | echo "Compiling the Netcdf library" |
---|
383 | echo "----------------------------------------------------------" |
---|
384 | echo "log file : $netcdflog" |
---|
385 | myget script_install/$script_install_netcdf >> "$netcdflog" 2>&1 |
---|
386 | chmod u=rwx $script_install_netcdf |
---|
387 | # shellcheck disable=SC2086 |
---|
388 | ./$script_install_netcdf -prefix "$ncdfdir" $opt_ >> "$netcdflog" 2>&1 |
---|
389 | fi |
---|
390 | |
---|
391 | #---------------------------------------------------------------------------- |
---|
392 | # LF rajout d'une verrue, pour une raison non encore expliquee, |
---|
393 | # la librairie est parfois rangée dans lib64 et non dans lib |
---|
394 | # par certains compilateurs |
---|
395 | if [[ ! -e lib && -d lib64 ]]; then ln -s lib64 lib; fi |
---|
396 | #---------------------------------------------------------------------------- |
---|
397 | |
---|
398 | echo "install_lmdz.sh netcdf_OK $(date)" |
---|
399 | fi |
---|
400 | |
---|
401 | cat >test_netcdf90.f90 <<EOF |
---|
402 | use netcdf |
---|
403 | print *, "NetCDF library version: ", nf90_inq_libvers() |
---|
404 | end |
---|
405 | EOF |
---|
406 | |
---|
407 | if $compiler -I"$ncdfdir"/include test_netcdf90.f90 -L"$ncdfdir"/lib -lnetcdff \ |
---|
408 | -lnetcdf -Wl,-rpath="$ncdfdir"/lib && ./a.out |
---|
409 | then |
---|
410 | \rm test_netcdf90.f90 a.out |
---|
411 | else |
---|
412 | cat <<EOF |
---|
413 | Failed test program using NetCDF-Fortran. You can: |
---|
414 | - check that you have NetCDF-Fortran installed in your system |
---|
415 | - or specify an installation directory with option -netcdf of install_lmdz.sh |
---|
416 | - or download and compile NetCDF-Fortran with option -netcdf 1 of nstall_lmdz.sh |
---|
417 | EOF |
---|
418 | exit 1 |
---|
419 | fi |
---|
420 | } |
---|
421 | |
---|
422 | function install_IOIPSL { # via fcm |
---|
423 | cd "$MODEL/modipsl/modeles/IOIPSL" |
---|
424 | ioipsllog="$(pwd)/ioipsl.log" |
---|
425 | echo "Compiling IOIPSL, the interface library with Netcdf $(date) (log: $ioipsllog)" |
---|
426 | |
---|
427 | if ! ./makeioipsl_fcm -arch "$arch" -job 8 > "$ioipsllog" 2>&1; then |
---|
428 | echo "IOIPSL compile failed, exiting"; exit 1 |
---|
429 | fi |
---|
430 | cp lib/* ../../lib |
---|
431 | echo "IOIPSL compiled $(date)" |
---|
432 | |
---|
433 | export IOIPSL_LIBDIR="$MODEL/modipsl/modeles/IOIPSL/lib" |
---|
434 | export IOIPSL_INCDIR="$MODEL/modipsl/modeles/IOIPSL/inc" |
---|
435 | } |
---|
436 | |
---|
437 | function install_XIOS { |
---|
438 | if [[ $with_xios = "y" ]]; then |
---|
439 | cd "$MODEL/modipsl/modeles" |
---|
440 | xioslog="$(pwd)/xios.log" |
---|
441 | echo "##########################################################" |
---|
442 | echo "Compiling XIOS (log $xioslog) $(date)" |
---|
443 | echo "##########################################################" |
---|
444 | |
---|
445 | # Download XIOS |
---|
446 | case $xios_branch in |
---|
447 | "trunk") |
---|
448 | xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/trunk";; |
---|
449 | "2.5") |
---|
450 | xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/branchs/xios-2.5";; |
---|
451 | "2.6") |
---|
452 | xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.6";; |
---|
453 | *) echo "XIOS: Error, bad argument for -branch ! Did not expect $xios_branch"; exit;; |
---|
454 | esac |
---|
455 | |
---|
456 | cd "$MODEL/modipsl/modeles" |
---|
457 | set +e; svn co --revision $xios_rev $xios_http XIOS; set -e |
---|
458 | |
---|
459 | cd XIOS |
---|
460 | if ! ./make_xios --arch "$arch" --job 8 --arch_path "$arch_dir" > "$xioslog" 2>&1; then |
---|
461 | echo "XIOS compilation failed, exiting"; exit 1 |
---|
462 | fi |
---|
463 | |
---|
464 | echo "Compiled XIOS $(date)" |
---|
465 | fi |
---|
466 | } |
---|
467 | |
---|
468 | function get_orchidee_version { # Set / Check ORCHIDEE version |
---|
469 | if [[ $veget = "none" ]]; then |
---|
470 | veget_version="false" |
---|
471 | elif [[ $veget = "CMIP6" ]]; then |
---|
472 | veget_version=orchidee2.0 |
---|
473 | orchidee_rev=6592 |
---|
474 | else # specific orchidee revision newer than CMIP6, on 2_1 or 2_2 branches |
---|
475 | veget_version=orchidee2.1 |
---|
476 | orchidee_rev="$veget" |
---|
477 | if [[ $veget -lt 4465 ]]; then |
---|
478 | echo 'ORCHIDEE version must be >=4465, exiting' |
---|
479 | exit 1 |
---|
480 | fi |
---|
481 | |
---|
482 | set +e |
---|
483 | svn upgrade |
---|
484 | local orcbranch |
---|
485 | 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}') |
---|
486 | echo "IF YOU INSTALL ORCHIDEE THE VERY FIRST TIME, ASK for PASSWORD at orchidee-help@listes.ipsl.fr" |
---|
487 | svn switch -r "$veget" --accept theirs-full "svn://forge.ipsl.jussieu.fr/orchidee/$orcbranch" |
---|
488 | svn log -r "$veget" | grep "$veget" |
---|
489 | if ! svn log -r "$veget" | grep "$veget"; then |
---|
490 | echo 'Cannot update ORCHIDEE as not on the right branch for ORCHIDEE' |
---|
491 | exit 1 |
---|
492 | fi |
---|
493 | svn update -r "$veget" |
---|
494 | set -e |
---|
495 | fi |
---|
496 | } |
---|
497 | |
---|
498 | function compile_orchidee_seq { |
---|
499 | get_orchidee_version |
---|
500 | |
---|
501 | if [[ $veget != "none" ]]; then |
---|
502 | cd "$MODEL/modipsl/modeles/ORCHIDEE" |
---|
503 | |
---|
504 | orchideelog="$(pwd)/orchidee.log" |
---|
505 | echo "Compiling ORCHIDEE, the continental surface model (log $orchideelog)" |
---|
506 | echo "Start of the first compilation of orchidee, in sequential mode: $(date)" |
---|
507 | |
---|
508 | ORCHPATH=$(pwd) |
---|
509 | export ORCHPATH=$ORCHPATH |
---|
510 | |
---|
511 | local xios_orchid opt_orc |
---|
512 | if [[ $with_xios = "y" ]]; then |
---|
513 | xios_orchid="-xios"; |
---|
514 | else |
---|
515 | xios_orchid="-noxios" |
---|
516 | fi |
---|
517 | if [[ $optim_debug = "-debug" ]]; then |
---|
518 | opt_orc="-debug"; |
---|
519 | else |
---|
520 | opt_orc="-prod" |
---|
521 | fi |
---|
522 | |
---|
523 | if ! ./makeorchidee_fcm "$xios_orchid" "$opt_orc" -parallel none -arch "$arch" > "$orchideelog" 2>&1; then |
---|
524 | echo "ORCHIDEE seq compilation failed, exiting"; exit 1 |
---|
525 | fi |
---|
526 | echo "Compiled ORCHIDEE seq $(date)" |
---|
527 | fi |
---|
528 | } |
---|
529 | |
---|
530 | echo "install_lmdz.sh DEBUT $(date)" |
---|
531 | |
---|
532 | set_default_params |
---|
533 | read_cmdline_args "$@" |
---|
534 | #download_model |
---|
535 | download_model_AMAURY |
---|
536 | install_arch |
---|
537 | check_available_software |
---|
538 | install_netcdf |
---|
539 | install_IOIPSL |
---|
540 | #install_XIOS # TODO disabled for now, did not decide which flags/arch to use for compile |
---|
541 | compile_orchidee_seq |
---|
542 | |
---|
543 | exit 0 |
---|
544 | |
---|
545 | |
---|
546 | |
---|
547 | |
---|
548 | ################################################################ |
---|
549 | # Specificite des machines |
---|
550 | ################################################################ |
---|
551 | |
---|
552 | hostname=$(hostname) |
---|
553 | #case ${hostname:0:5} in |
---|
554 | # *) if [[ $parallel = none || -f /usr/bin/mpif90 ]]; then |
---|
555 | # path_mpi=$(which mpif90 | sed -e s:/mpif90::); |
---|
556 | # if [[ -d /usr/lib64/openmpi ]]; then |
---|
557 | # root_mpi="/usr/lib64/openmpi" |
---|
558 | # else |
---|
559 | # root_mpi="/usr" |
---|
560 | # fi |
---|
561 | # else |
---|
562 | # echo "Cannot find mpif90"; |
---|
563 | # if [[ $parallel = none ]]; then exit 1; fi; |
---|
564 | # fi; |
---|
565 | # if [[ $parallel != none ]]; then |
---|
566 | # root_mpi=$(which mpif90 | sed -e s:/bin/mpif90::) |
---|
567 | # path_mpi=$(which mpif90 | sed -e s:/mpif90::) |
---|
568 | # export LD_LIBRARY_PATH=${root_mpi}/lib:$LD_LIBRARY_PATH |
---|
569 | # fi |
---|
570 | # par_comp=${path_mpi}/mpif90; |
---|
571 | # mpirun=${path_mpi}/mpirun; |
---|
572 | # arch="local"; |
---|
573 | # make="make"; |
---|
574 | # o_ins_make="-t g95" |
---|
575 | #esac |
---|
576 | |
---|
577 | ## Flags for parallelism: |
---|
578 | #if [[ $parallel != none ]]; then |
---|
579 | # # MPI_LD are the flags needed for linking with MPI |
---|
580 | # MPI_LD="-L${root_mpi}/lib -lmpi" |
---|
581 | # if [[ $compiler = "gfortran" ]]; then |
---|
582 | # # MPI_FLAGS are the flags needed for compilation with MPI |
---|
583 | # MPI_FLAGS="-fcray-pointer" |
---|
584 | # # OMP_FLAGS are the flags needed for compilation with OpenMP |
---|
585 | # OMP_FLAGS="-fopenmp -fcray-pointer" |
---|
586 | # # OMP_LD are the flags needed for linking with OpenMP |
---|
587 | # OMP_LD="-fopenmp" |
---|
588 | # elif [[ $compiler = "ifort" ]]; then |
---|
589 | # MPI_FLAGS="" |
---|
590 | # OMP_FLAGS="-openmp" |
---|
591 | # OMP_LD="-openmp" |
---|
592 | # else # pgf90 |
---|
593 | # MPI_FLAGS="" |
---|
594 | # OMP_FLAGS="-mp" |
---|
595 | # OMP_LD="-mp" |
---|
596 | # fi |
---|
597 | #fi |
---|
598 | # |
---|
599 | # |
---|
600 | #echo "################################################################" |
---|
601 | #echo "Choix des options de compilation" |
---|
602 | #echo "################################################################" |
---|
603 | # |
---|
604 | #export FC=$compiler |
---|
605 | #export F90=$compiler |
---|
606 | #export F77=$compiler |
---|
607 | #export CPPFLAGS= |
---|
608 | #OPTIMNC="" |
---|
609 | #BASE_LD="$OPT_GPROF" |
---|
610 | #OPTPREC="$OPT_GPROF" |
---|
611 | #ARFLAGS="rs" |
---|
612 | #if [[ $(lsb_release -i -s) = "Ubuntu" ]]; then |
---|
613 | # if [[ $(lsb_release -r -s | cut -d. -f1) -ge 16 ]]; then |
---|
614 | # ARFLAGS="rU" |
---|
615 | # fi |
---|
616 | #fi |
---|
617 | # |
---|
618 | #if [[ $compiler = "gfortran" ]]; then |
---|
619 | # OPTIM="-O3 $allow_arg_mismatch" |
---|
620 | # OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all -fbacktrace -finit-real=snan $allow_arg_mismatch" |
---|
621 | # OPTDEV="-Wall -fbounds-check $allow_arg_mismatch" |
---|
622 | # fmod="I " |
---|
623 | # OPTPREC="$OPTPREC -cpp -ffree-line-length-0" |
---|
624 | # if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE"; fi |
---|
625 | # export F90FLAGS=" -ffree-form $OPTIMNC" |
---|
626 | # export FFLAGS=" $OPTIMNC" |
---|
627 | # export CC=gcc |
---|
628 | # export CXX=g++ |
---|
629 | # export fpp_flags="-P -C -traditional -ffreestanding" |
---|
630 | # |
---|
631 | #elif [[ $compiler = mpif90 ]]; then |
---|
632 | # OPTIM="-O3" |
---|
633 | # OPTDEB="-g3 -Wall -fbounds-check -ffpe-trap=invalid,zero,overflow -O0 -fstack-protector-all" |
---|
634 | # OPTDEV="-Wall -fbounds-check" |
---|
635 | # BASE_LD="$BASE_LD -lblas" |
---|
636 | # fmod="I " |
---|
637 | # if [[ $real = r8 ]]; then |
---|
638 | # OPTPREC="$OPTPREC -fdefault-real-8 -DNC_DOUBLE -fcray-pointer" |
---|
639 | # fi |
---|
640 | # export F90FLAGS=" -ffree-form $OPTIMNC" |
---|
641 | # export FFLAGS=" $OPTIMNC" |
---|
642 | # export CC=gcc |
---|
643 | # export CXX=g++ |
---|
644 | # |
---|
645 | #elif [[ $compiler = pgf90 ]]; then |
---|
646 | # OPTIM="-O2 -Mipa -Munroll -Mnoframe -Mautoinline -Mcache_align" |
---|
647 | # OPTDEB="-g -Mdclchk -Mbounds -Mchkfpstk -Mchkptr -Minform=inform -Mstandard -Ktrap=fp -traceback" |
---|
648 | # OPTDEV="-g -Mbounds -Ktrap=fp -traceback" |
---|
649 | # fmod="module " |
---|
650 | # if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -r8 -DNC_DOUBLE"; fi |
---|
651 | # export CPPFLAGS="-DpgiFortran" |
---|
652 | # export CC=pgcc |
---|
653 | # export CFLAGS="-O2 -Msignextend" |
---|
654 | # export CXX=pgCC |
---|
655 | # export CXXFLAGS="-O2 -Msignextend" |
---|
656 | # export FFLAGS="-O2 $OPTIMNC" |
---|
657 | # export F90FLAGS="-O2 $OPTIMNC" |
---|
658 | # compile_with_fcm=1 |
---|
659 | # |
---|
660 | #elif [[ $compiler = ifort || $compiler = mpiifort ]]; then |
---|
661 | # OPTIM="-O2 -fp-model strict -ip -align all " |
---|
662 | # OPTDEV="-p -g -O2 -traceback -fp-stack-check -ftrapuv -check" |
---|
663 | # OPTDEB="-g -no-ftz -traceback -ftrapuv -fp-stack-check -check" |
---|
664 | # fmod='module ' |
---|
665 | # if [[ $real = r8 ]]; then OPTPREC="$OPTPREC -real-size 64 -DNC_DOUBLE"; fi |
---|
666 | # export CPP="icc -E" |
---|
667 | # export FFLAGS="-O2 -ip -fpic -mcmodel=large" |
---|
668 | # export FCFLAGS="-O2 -ip -fpic -mcmodel=large" |
---|
669 | # export CC=icc |
---|
670 | # export CFLAGS="-O2 -ip -fpic -mcmodel=large" |
---|
671 | # export CXX=icpc |
---|
672 | # export CXXFLAGS="-O2 -ip -fpic -mcmodel=large" |
---|
673 | # export fpp_flags="-P -traditional" |
---|
674 | # # Pourquoi forcer la compilation fcm. Marche mieux sans |
---|
675 | # #compile_with_fcm=1 |
---|
676 | #else |
---|
677 | # echo "unexpected compiler $compiler"; exit 1 |
---|
678 | #fi |
---|
679 | # |
---|
680 | #OPTIMGCM="$OPTIM $OPTPREC" |
---|
681 | |
---|
682 | |
---|
683 | veget_version=false |
---|
684 | if [[ $veget != 'none' ]]; then |
---|
685 | cd "$MODEL/modipsl/modeles/ORCHIDEE" |
---|
686 | |
---|
687 | opt_orc="-prod"; if [[ "$optim_debug" = "-debug" ]]; then opt_orc="-debug"; fi |
---|
688 | |
---|
689 | orchideelog=$(pwd)/orchidee.log |
---|
690 | echo '########################################################' |
---|
691 | echo 'Compiling ORCHIDEE, the continental surface model ' |
---|
692 | echo '########################################################' |
---|
693 | echo "Start of the first compilation of orchidee, in sequential mode: $(date)" |
---|
694 | echo "log file : $orchideelog" |
---|
695 | |
---|
696 | ORCHPATH=$(pwd) |
---|
697 | export ORCHPATH=$ORCHPATH |
---|
698 | xios_orchid="-noxios" |
---|
699 | if [[ "$with_xios" = "y" ]]; then |
---|
700 | xios_orchid="-xios" |
---|
701 | fi |
---|
702 | if [[ -d tools ]]; then |
---|
703 | ################################################################### |
---|
704 | # Pour les experts qui voudraient changer de version d'orchidee. |
---|
705 | # Attention : necessite d'avoir le password pour orchidee |
---|
706 | ################################################################### |
---|
707 | if [[ "$veget_version" == "false" ]]; then |
---|
708 | veget_version=orchidee2.0 |
---|
709 | fi |
---|
710 | cd arch |
---|
711 | sed -e s:"%COMPILER .*.$:%COMPILER $compiler":1 \ |
---|
712 | -e s:"%LINK .*.$:%LINK $compiler":1 \ |
---|
713 | -e s:"%FPP_FLAGS .*.$:%FPP_FLAGS $fpp_flags":1 \ |
---|
714 | -e s:"%PROD_FFLAGS .*.$:%PROD_FFLAGS $OPTIM":1 \ |
---|
715 | -e s:"%DEV_FFLAGS .*.$:%DEV_FFLAGS $OPTDEV":1 \ |
---|
716 | -e s:"%DEBUG_FFLAGS .*.$:%DEBUG_FFLAGS $OPTDEB":1 \ |
---|
717 | -e s:"%BASE_FFLAGS .*.$:%BASE_FFLAGS $OPTPREC":1 \ |
---|
718 | -e s:"%BASE_LD .*.$:%BASE_LD $BASE_LD":1 \ |
---|
719 | -e s:"%ARFLAGS .*.$:%ARFLAGS $ARFLAGS":1 \ |
---|
720 | arch-gfortran.fcm > arch-local.fcm |
---|
721 | cat <<EOF > arch-local.path |
---|
722 | NETCDF_LIBDIR="-L$ncdfdir/lib -lnetcdff -lnetcdf" |
---|
723 | NETCDF_INCDIR="$ncdfdir/include" |
---|
724 | IOIPSL_INCDIR="$ORCHPATH/../../lib" |
---|
725 | IOIPSL_LIBDIR="$ORCHPATH/../../lib" |
---|
726 | XIOS_INCDIR="\$ORCHDIR/../XIOS/inc" |
---|
727 | XIOS_LIBDIR="\$ORCHDIR/../XIOS/lib -lxios" |
---|
728 | EOF |
---|
729 | cd ../ |
---|
730 | |
---|
731 | echo ./makeorchidee_fcm -j $xios_orchid $opt_orc -parallel none \ |
---|
732 | -arch $arch |
---|
733 | ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc -parallel none \ |
---|
734 | -arch $arch > "$orchideelog" 2>&1 |
---|
735 | pwd |
---|
736 | else # of "if [[ -d tools ]]" |
---|
737 | if [[ -d src_parallel ]]; then |
---|
738 | liste_src="parallel parameters global stomate sechiba driver" |
---|
739 | if [[ "$veget_version" == "false" ]]; then |
---|
740 | veget_version=orchidee2.0 |
---|
741 | fi |
---|
742 | fi |
---|
743 | for d in $liste_src; do |
---|
744 | src_d=src_$d |
---|
745 | echo src_d "$src_d" |
---|
746 | echo ls; ls |
---|
747 | if [[ ! -d $src_d ]]; then |
---|
748 | echo "Problem orchidee : no $src_d"; exit 1 |
---|
749 | fi |
---|
750 | cd "$src_d"; \rm -f -- *.mod make; $make clean |
---|
751 | $make > "$orchideelog" 2>&1 |
---|
752 | if [[ "$compiler" = "gfortran" || "$compiler" = "mpif90" ]]; then |
---|
753 | cp -f -- *.mod ../../../lib |
---|
754 | fi |
---|
755 | cd .. |
---|
756 | done |
---|
757 | fi # of "if [[ -d tools ]]" |
---|
758 | echo "install_lmdz.sh orchidee_compil_seq_OK $(date)" |
---|
759 | fi # of if [[ "$veget" != 'none' ]] |
---|
760 | |
---|
761 | |
---|
762 | #============================================================================ |
---|
763 | # Ehouarn: the directory name LMDZ* depends on version/tar file... |
---|
764 | if find . -name "$MODEL/modipsl/modeles/LMD*"; then |
---|
765 | echo '###############################################################' |
---|
766 | echo 'Preparing LMDZ compilation : arch file, svn switch if needed...' |
---|
767 | echo '###############################################################' |
---|
768 | cd "$MODEL/modipsl/modeles/"LMD* |
---|
769 | LMDZPATH=$(pwd) |
---|
770 | else |
---|
771 | echo "ERROR: No LMD* directory !!!" |
---|
772 | exit 1 |
---|
773 | fi |
---|
774 | |
---|
775 | |
---|
776 | ########################################################### |
---|
777 | # For those who want to use fcm to compile via : |
---|
778 | # makelmdz_fcm -arch local ..... |
---|
779 | ############################################################ |
---|
780 | |
---|
781 | |
---|
782 | |
---|
783 | cd "$MODEL/modipsl/modeles"/LMDZ* |
---|
784 | lmdzlog=$(pwd)/lmdz.log |
---|
785 | |
---|
786 | ################################################################## |
---|
787 | # Possibly update LMDZ if a specific svn release is requested |
---|
788 | ################################################################## |
---|
789 | |
---|
790 | set +e; svn upgrade; set -e |
---|
791 | |
---|
792 | if [[ $svn = "last" ]]; then svnopt=""; else svnopt="-r $svn"; fi |
---|
793 | if [[ $svn != "" ]]; then |
---|
794 | if set +e; svn info | grep -q 'https:'; then |
---|
795 | svn switch --relocate https://svn.lmd.jussieu.fr/LMDZ \ |
---|
796 | http://svn.lmd.jussieu.fr/LMDZ |
---|
797 | fi |
---|
798 | svn update "$svnopt" |
---|
799 | set -e |
---|
800 | fi |
---|
801 | |
---|
802 | #--------------------------------------------------------------------- |
---|
803 | # Retrieve the final svn release number, and adjust compilation |
---|
804 | # options accordingly |
---|
805 | # If svn not available, will use the svn writen in $MODEL/Readm*md |
---|
806 | # For old version it assumes that it is before 4185 (the version |
---|
807 | # for which the test was introduced |
---|
808 | #--------------------------------------------------------------------- |
---|
809 | |
---|
810 | set +e; mysvn=$(svnversion . | grep -E || "[0-9]+" 2>/dev/null); set -e |
---|
811 | if [[ "$mysvn" = "" ]]; then mysvn=$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null); fi |
---|
812 | if [[ "$mysvn" = "" ]]; then mysvn=4190; fi |
---|
813 | |
---|
814 | if [[ "$pclinux" = "1" && ! -f arch/arch-local.path ]]; then |
---|
815 | |
---|
816 | # create local 'arch' files (if on Linux PC): |
---|
817 | cd arch |
---|
818 | # arch-local.path file |
---|
819 | # test for version as arch.pth file changed format with rev 4426 |
---|
820 | if [[ "$mysvn" -gt 4425 ]]; then |
---|
821 | cat <<EOF > arch-local.path |
---|
822 | NETCDF_LIBDIR="-L$ncdfdir/lib" |
---|
823 | NETCDF_LIB="-lnetcdff -lnetcdf" |
---|
824 | NETCDF_INCDIR=-I$ncdfdir/include |
---|
825 | NETCDF95_INCDIR=-I\$LMDGCM/../../include |
---|
826 | NETCDF95_LIBDIR=-L\$LMDGCM/../../lib |
---|
827 | NETCDF95_LIB=-lnetcdf95 |
---|
828 | IOIPSL_INCDIR=-I\$LMDGCM/../../lib |
---|
829 | IOIPSL_LIBDIR=-L\$LMDGCM/../../lib |
---|
830 | IOIPSL_LIB=-lioipsl |
---|
831 | XIOS_INCDIR=-I\$LMDGCM/../XIOS/inc |
---|
832 | XIOS_LIBDIR=-L\$LMDGCM/../XIOS/lib |
---|
833 | XIOS_LIB="-lxios -lstdc++" |
---|
834 | ORCH_INCDIR=-I\$LMDGCM/../../lib |
---|
835 | ORCH_LIBDIR=-L\$LMDGCM/../../lib |
---|
836 | EOF |
---|
837 | else |
---|
838 | cat <<EOF > arch-local.path |
---|
839 | NETCDF_LIBDIR="-L$ncdfdir/lib -lnetcdff -lnetcdf" |
---|
840 | NETCDF_INCDIR=-I$ncdfdir/include |
---|
841 | NETCDF95_INCDIR=\$LMDGCM/../../include |
---|
842 | NETCDF95_LIBDIR=\$LMDGCM/../../lib |
---|
843 | IOIPSL_INCDIR=\$LMDGCM/../../lib |
---|
844 | IOIPSL_LIBDIR=\$LMDGCM/../../lib |
---|
845 | XIOS_INCDIR=\$LMDGCM/../XIOS/inc |
---|
846 | XIOS_LIBDIR=\$LMDGCM/../XIOS/lib |
---|
847 | ORCH_INCDIR=\$LMDGCM/../../lib |
---|
848 | ORCH_LIBDIR=\$LMDGCM/../../lib |
---|
849 | EOF |
---|
850 | fi |
---|
851 | |
---|
852 | if [[ $pcmac == 1 ]]; then |
---|
853 | BASE_LD="$BASE_LD -Wl,-rpath,${ncdfdir}/lib" |
---|
854 | else |
---|
855 | BASE_LD="$BASE_LD -Wl,-rpath=${ncdfdir}/lib" |
---|
856 | fi |
---|
857 | # Arch-local.fcm file (adapted from arch-linux-32bit.fcm) |
---|
858 | |
---|
859 | if [[ $real = r8 ]]; then FPP_DEF=NC_DOUBLE; else FPP_DEF=""; fi |
---|
860 | sed -e s:"%COMPILER .*.$:%COMPILER $compiler":1 \ |
---|
861 | -e s:"%LINK .*.$:%LINK $compiler":1 \ |
---|
862 | -e s:"%PROD_FFLAGS .*.$:%PROD_FFLAGS $OPTIM":1 \ |
---|
863 | -e s:"%DEV_FFLAGS .*.$:%DEV_FFLAGS $OPTDEV":1 \ |
---|
864 | -e s:"%DEBUG_FFLAGS .*.$:%DEBUG_FFLAGS $OPTDEB":1 \ |
---|
865 | -e s:"%BASE_FFLAGS .*.$:%BASE_FFLAGS $OPTPREC":1 \ |
---|
866 | -e s:"%FPP_DEF .*.$:%FPP_DEF $FPP_DEF":1 \ |
---|
867 | -e s:"%BASE_LD .*.$:%BASE_LD $BASE_LD":1 \ |
---|
868 | -e s:"%ARFLAGS .*.$:%ARFLAGS $ARFLAGS":1 \ |
---|
869 | arch-linux-32bit.fcm > arch-local.fcm |
---|
870 | |
---|
871 | cd .. |
---|
872 | ### Adapt "bld.cfg" (add the shell): |
---|
873 | #whereisthatshell=$(which ${use_shell}) |
---|
874 | #echo "bld::tool::SHELL $whereisthatshell" >> bld.cfg |
---|
875 | |
---|
876 | fi # of if [[ "$pclinux" = 1 ]] |
---|
877 | #--------------------------------------------------------------------- |
---|
878 | # Option de compilation du rayonnement : depend de $mysvn ><= r4185 |
---|
879 | #--------------------------------------------------------------------- |
---|
880 | opt_rad="" |
---|
881 | |
---|
882 | case $rad in |
---|
883 | oldrad) iflag_rrtm=0; NSW=2; opt_rad="";; |
---|
884 | rrtm) iflag_rrtm=1; NSW=6 |
---|
885 | if [[ $mysvn -le 4185 ]]; then |
---|
886 | opt_rad="-rrtm true" |
---|
887 | else |
---|
888 | opt_rad="-rad rrtm" |
---|
889 | fi;; |
---|
890 | ecrad) iflag_rrtm=2; NSW=6; opt_rad="-rad ecrad";; |
---|
891 | *) echo "Only oldrad rrtm ecrad for rad option"; exit 1 |
---|
892 | esac |
---|
893 | |
---|
894 | if [[ $mysvn -le 4185 && $rad = "ecrad" ]]; then |
---|
895 | echo "ecrad only available for LMDZ rev starting with 4186 "; exit 1 |
---|
896 | fi |
---|
897 | |
---|
898 | ################################################################## |
---|
899 | |
---|
900 | |
---|
901 | if [[ ! -f libf/misc/netcdf95.F90 && ! -d $MODEL/NetCDF95-0.3 ]]; then |
---|
902 | cd "$MODEL" |
---|
903 | myget src_archives/netcdf/NetCDF95-0.3.tar.gz |
---|
904 | tar -xf NetCDF95-0.3.tar.gz |
---|
905 | rm NetCDF95-0.3.tar.gz |
---|
906 | cd NetCDF95-0.3 |
---|
907 | mkdir build |
---|
908 | cd build |
---|
909 | cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$ncdfdir" \ |
---|
910 | -DCMAKE_INSTALL_PREFIX="$MODEL/modipsl" |
---|
911 | make install |
---|
912 | cd "$MODEL/modipsl/modeles/"LMDZ* |
---|
913 | fi |
---|
914 | |
---|
915 | echo '##################################################################' |
---|
916 | echo "Preparing script compile.sh for LMDZ compilation" |
---|
917 | echo "It will only be run automatically if bench=1/tuto" |
---|
918 | echo "Here bench=$bench" |
---|
919 | echo '##################################################################' |
---|
920 | |
---|
921 | if [[ $env_file != "" ]]; then |
---|
922 | mv arch/arch-${arch}.env arch/arch-${arch}.orig |
---|
923 | \cp -f "$env_file" arch/arch-${arch}.env |
---|
924 | fi |
---|
925 | |
---|
926 | if [[ $compile_with_fcm = 1 ]]; then |
---|
927 | makelmdz="makelmdz_fcm $optim_debug -arch $arch -j 8 " |
---|
928 | else |
---|
929 | makelmdz="makelmdz $optim_debug -arch $arch" |
---|
930 | fi |
---|
931 | |
---|
932 | # sequential compilation |
---|
933 | if [[ "$sequential" = 1 ]]; then |
---|
934 | echo Sequential compilation command, saved in compile.sh: |
---|
935 | echo "./$makelmdz $optim_debug $OPT_MAKELMDZ $optim_debug $opt_rad $opt_cosp " \ |
---|
936 | "-d ${grid_resolution} -v $veget_version gcm " |
---|
937 | echo "./$makelmdz $optim_debug $OPT_MAKELMDZ $optim_debug $opt_rad $opt_cosp " \ |
---|
938 | "-d ${grid_resolution} -v $veget_version gcm " > compile.sh |
---|
939 | chmod +x ./compile.sh |
---|
940 | if [[ $bench = 1 ]]; then |
---|
941 | echo "install_lmdz.sh start_lmdz_seq_compilation $(date)" |
---|
942 | echo "log file: $lmdzlog" |
---|
943 | ./compile.sh > "$lmdzlog" 2>&1 |
---|
944 | echo "install_lmdz.sh end_lmdz_seq_compilation $(date)" |
---|
945 | fi |
---|
946 | fi # fin sequential |
---|
947 | |
---|
948 | # compiling in parallel mode |
---|
949 | if [[ $parallel != "none" ]]; then |
---|
950 | echo '##########################################################' |
---|
951 | echo ' Parallel compile ' |
---|
952 | echo '##########################################################' |
---|
953 | echo "(after saving the sequential libs and binaries)" |
---|
954 | cd "$MODEL/modipsl" |
---|
955 | tar cf sequential.tar bin/ lib/ |
---|
956 | # |
---|
957 | # Orchidee |
---|
958 | # |
---|
959 | cd "$ORCHPATH" |
---|
960 | if [[ -d src_parallel && $veget != 'none' ]]; then |
---|
961 | cd arch |
---|
962 | sed \ |
---|
963 | -e s:"%COMPILER.*.$:%COMPILER $par_comp":1 \ |
---|
964 | -e s:"%LINK.*.$:%LINK $par_comp":1 \ |
---|
965 | -e s:"%MPI_FFLAG.*.$:%MPI_FFLAGS $MPI_FLAGS":1 \ |
---|
966 | -e s:"%OMP_FFLAG.*.$:%OMP_FFLAGS $OMP_FLAGS":1 \ |
---|
967 | -e s:"%MPI_LD.*.$:%MPI_LD $MPI_LD":1 \ |
---|
968 | -e s:"%OMP_LD.*.$:%OMP_LD $OMP_LD":1 \ |
---|
969 | arch-local.fcm > tmp.fcm |
---|
970 | |
---|
971 | mv tmp.fcm arch-local.fcm |
---|
972 | cd ../ |
---|
973 | echo "Compiling ORCHIDEE in parallel mode $(date)" |
---|
974 | echo "logfile $orchideelog" |
---|
975 | echo "NOTE : to recompile it when necessary, use ./compile_orc.sh " \ |
---|
976 | "in modipsl/modeles/ORCHIDEE" |
---|
977 | echo ./makeorchidee_fcm -j 8 -clean $xios_orchid $opt_orc \ |
---|
978 | -parallel "$parallel" -arch $arch > compile_orc.sh |
---|
979 | echo ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc \ |
---|
980 | -parallel "$parallel" -arch $arch >> compile_orc.sh |
---|
981 | echo echo Now you must also recompile LMDZ, by running ./compile.sh \ |
---|
982 | in modeles/LMDZ >> compile_orc.sh |
---|
983 | chmod u+x compile_orc.sh |
---|
984 | ./makeorchidee_fcm -j 8 -clean $xios_orchid $opt_orc \ |
---|
985 | -parallel "$parallel" -arch $arch > "$orchideelog" 2>&1 |
---|
986 | ./makeorchidee_fcm -j 8 $xios_orchid $opt_orc -parallel "$parallel" \ |
---|
987 | -arch $arch >> "$orchideelog" 2>&1 |
---|
988 | echo "End of ORCHIDEE compilation in parallel mode $(date)" |
---|
989 | elif [[ $veget != 'none' ]]; then |
---|
990 | echo '##########################################################' |
---|
991 | echo ' Orchidee version too old ' |
---|
992 | echo ' Please update to new version ' |
---|
993 | echo '##########################################################' |
---|
994 | exit 1 |
---|
995 | fi #�of [ -d src_parallel && $veget != 'none' ] |
---|
996 | |
---|
997 | # LMDZ |
---|
998 | cd "$LMDZPATH" |
---|
999 | if [[ $arch = local ]]; then |
---|
1000 | cd arch |
---|
1001 | sed -e s:"%COMPILER.*.$:%COMPILER $par_comp":1 \ |
---|
1002 | -e s:"%LINK.*.$:%LINK $par_comp":1 \ |
---|
1003 | -e s:"%MPI_FFLAG.*.$:%MPI_FFLAGS $MPI_FLAGS":1 \ |
---|
1004 | -e s:"%OMP_FFLAG.*.$:%OMP_FFLAGS $OMP_FLAGS":1 \ |
---|
1005 | -e s:"%ARFLAGS.*.$:%ARFLAGS $ARFLAGS":1 \ |
---|
1006 | -e "s§%BASE_LD.*.$§%BASE_LD -Wl,-rpath=${root_mpi}/lib:${ncdfdir}/lib§1" \ |
---|
1007 | -e s:"%MPI_LD.*.$:%MPI_LD $MPI_LD":1 \ |
---|
1008 | -e s:"%OMP_LD.*.$:%OMP_LD $OMP_LD":1 \ |
---|
1009 | arch-local.fcm > tmp.fcm |
---|
1010 | mv tmp.fcm arch-local.fcm |
---|
1011 | cd ../ |
---|
1012 | fi |
---|
1013 | rm -f compile.sh |
---|
1014 | echo resol="$grid_resolution" >> compile.sh |
---|
1015 | if [[ ${hostname:0:5} = jean- && "$cosp" = "v2" ]]; then |
---|
1016 | |
---|
1017 | echo "LMDZ compilation command in parallel mode, saved in compile.sh, is :" |
---|
1018 | echo "(ATTENTION le probleme de cospv2 sur jean-zay en mode prod " \ |
---|
1019 | "n est pas corrige ! )" |
---|
1020 | # ATTENTION le probleme de cospv2 sur jean-zay en mode prod n |
---|
1021 | # est pas corrige |
---|
1022 | echo ./"$makelmdz" -dev $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" -dev $optim_debug "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ |
---|
1026 | "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ |
---|
1027 | -parallel "$parallel" gcm |
---|
1028 | else |
---|
1029 | echo ./"$makelmdz" $optim_debug "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ |
---|
1030 | "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ |
---|
1031 | -parallel "$parallel" gcm >> compile.sh |
---|
1032 | echo ./"$makelmdz" $optim_debug "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ |
---|
1033 | "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ |
---|
1034 | -parallel "$parallel" gcm |
---|
1035 | fi |
---|
1036 | chmod +x ./compile.sh |
---|
1037 | |
---|
1038 | if [[ $bench = 1 ]]; then |
---|
1039 | echo "Compiling LMDZ in parallel mode $(date), LMDZ log file: $lmdzlog" |
---|
1040 | ./compile.sh > "$lmdzlog" 2>&1 |
---|
1041 | fi |
---|
1042 | |
---|
1043 | fi # of if [[ $parallel != "none" ]] |
---|
1044 | |
---|
1045 | |
---|
1046 | ################################################################## |
---|
1047 | # Verification du succes de la compilation |
---|
1048 | ################################################################## |
---|
1049 | |
---|
1050 | # Recherche de l'executable dont le nom a change au fil du temps ... |
---|
1051 | # suffix contains radiative option starting with revision 4186 |
---|
1052 | if [[ $mysvn -ge 4186 ]]; then suff_exe=_${rad}${suff_exe}; fi |
---|
1053 | gcm="" |
---|
1054 | |
---|
1055 | for exe in gcm.e bin/gcm_${grid_resolution}_phylmd${suff_exe}${suff_orc}.e |
---|
1056 | do |
---|
1057 | if [[ -f $exe ]]; then gcm=$exe; fi |
---|
1058 | done |
---|
1059 | |
---|
1060 | if [[ "$gcm" = "" ]]; then |
---|
1061 | if [[ $bench = 1 ]]; then |
---|
1062 | echo 'Compilation failed !! Cannot run the benchmark;' |
---|
1063 | exit 1 |
---|
1064 | else |
---|
1065 | echo 'Compilation not done (only done when bench=1)' |
---|
1066 | fi |
---|
1067 | else |
---|
1068 | echo '##########################################################' |
---|
1069 | echo "Compilation successfull !! $(date)" |
---|
1070 | echo '##########################################################' |
---|
1071 | echo "The executable is $gcm" |
---|
1072 | fi |
---|
1073 | |
---|
1074 | ################################################################## |
---|
1075 | # Below, we run a benchmark if bench=1 or tuto |
---|
1076 | ################################################################## |
---|
1077 | |
---|
1078 | if [[ $bench = tuto ]]; then |
---|
1079 | myget Training/tutorial.tar; tar xf tutorial.tar; cd TUTORIAL |
---|
1080 | ./init.sh |
---|
1081 | |
---|
1082 | elif [[ $bench = 1 && ! -d BENCH${grid_resolution} ]]; then |
---|
1083 | # TOUTE CETTE SECTION DEVRAIT DISPARAITRE POUR UNE COMMANDE |
---|
1084 | # OU DES BENCHS PAR MOTS CLES COMME tuto |
---|
1085 | |
---|
1086 | echo '##########################################################' |
---|
1087 | echo ' Running a test run ' |
---|
1088 | echo '##########################################################' |
---|
1089 | |
---|
1090 | \rm -rf "BENCH${grid_resolution}" |
---|
1091 | bench=bench_lmdz_${grid_resolution} |
---|
1092 | echo "install_lmdz.sh before bench download $(date)" |
---|
1093 | #wget http://www.lmd.jussieu.fr/~lmdz/Distrib/$bench.tar.gz |
---|
1094 | myget "3DBenchs/$bench.tar.gz" |
---|
1095 | echo "install_lmdz.sh after bench download $(date)" |
---|
1096 | tar xf "$bench.tar.gz" |
---|
1097 | |
---|
1098 | if [[ "$cosp" = "v1" || "$cosp" = "v2" ]]; then |
---|
1099 | cd "BENCH${grid_resolution}" |
---|
1100 | # copier les fichiers namelist input et output our COSP |
---|
1101 | cp ../DefLists/cosp*_input_nl.txt . |
---|
1102 | cp ../DefLists/cosp*_output_nl.txt . |
---|
1103 | # Activer la cles ok_cosp pour tourner avec COSP |
---|
1104 | sed -e 's@ok_cosp=n@ok_cosp=y@' config.def > tmp |
---|
1105 | \mv -f tmp config.def |
---|
1106 | cd .. |
---|
1107 | fi |
---|
1108 | |
---|
1109 | if [[ -n "$physiq" ]]; then |
---|
1110 | cd "BENCH${grid_resolution}" |
---|
1111 | if [[ -f "physiq.def_${physiq}" ]]; then |
---|
1112 | cp "physiq.def_${physiq}" physiq.def |
---|
1113 | echo using "physiq.def_${physiq}" |
---|
1114 | else |
---|
1115 | echo using standard physiq.def |
---|
1116 | fi |
---|
1117 | cd .. |
---|
1118 | else |
---|
1119 | echo using standard physiq.def |
---|
1120 | fi |
---|
1121 | |
---|
1122 | if [[ "$with_xios" = "y" ]]; then |
---|
1123 | cd "BENCH${grid_resolution}" |
---|
1124 | cp ../DefLists/iodef.xml . |
---|
1125 | cp ../DefLists/context_lmdz.xml . |
---|
1126 | cp ../DefLists/field_def_lmdz.xml . |
---|
1127 | # A raffiner par la suite |
---|
1128 | echo "A FAIRE : Copier les *xml en fonction de l option cosp" |
---|
1129 | cp ../DefLists/field_def_cosp*.xml . |
---|
1130 | cp ../DefLists/file_def_hist*xml . |
---|
1131 | # adapt iodef.xml to use attached mode |
---|
1132 | sed -e 's@"using_server" type="bool">true@"using_server" type="bool">false@' \ |
---|
1133 | iodef.xml > tmp |
---|
1134 | \mv -f tmp iodef.xml |
---|
1135 | |
---|
1136 | # and convert all the enabled="_AUTO_" (for libIGCM) to enabled=.FALSE. |
---|
1137 | # except for histday |
---|
1138 | for histfile in file_def_hist*xml |
---|
1139 | do |
---|
1140 | if [[ "$histfile" = "file_def_histday_lmdz.xml" ]]; then |
---|
1141 | sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".TRUE."@' \ |
---|
1142 | "$histfile" > tmp |
---|
1143 | \mv -f tmp "$histfile" |
---|
1144 | sed -e 's@output_level="_AUTO_"@output_level="5"@' "$histfile" \ |
---|
1145 | > tmp |
---|
1146 | \mv -f tmp "$histfile" |
---|
1147 | sed -e 's@compression_level="2"@compression_level="0"@' \ |
---|
1148 | "$histfile" > tmp |
---|
1149 | \mv -f tmp "$histfile" |
---|
1150 | else |
---|
1151 | sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".FALSE."@' \ |
---|
1152 | "$histfile" > tmp |
---|
1153 | \mv -f tmp "$histfile" |
---|
1154 | fi |
---|
1155 | done |
---|
1156 | # and add option "ok_all_xml=y" in config.def |
---|
1157 | echo "### XIOS outputs" >> config.def |
---|
1158 | echo 'ok_all_xml=.true.' >> config.def |
---|
1159 | |
---|
1160 | #activer les sorties pour Cosp |
---|
1161 | if [[ "$cosp" = "v1" ]]; then |
---|
1162 | sed -i'' -e 's@enabled=".FALSE."@enabled=".TRUE."@' \ |
---|
1163 | -e 's@output_level="_AUTO_"@output_level="5"@' \ |
---|
1164 | -e 's@compression_level="2"@compression_level="0"@' \ |
---|
1165 | file_def_histdayCOSP_lmdz.xml |
---|
1166 | fi |
---|
1167 | if [[ "$cosp" = "v2" ]]; then |
---|
1168 | sed -e 's@compression_level="2"@compression_level="0"@' file_def_histdayCOSPv2_lmdz.xml |
---|
1169 | for type_ in hf day mth; do |
---|
1170 | file=file_def_hist${type_}COSP |
---|
1171 | sed -i'' -e 's@src="./'${file}'_lmdz.xml"@src="./'${file}'v2_lmdz.xml"@' context_lmdz.xml |
---|
1172 | done |
---|
1173 | sed -i '' -e 's@field_def_cosp1.xml@field_def_cospv2.xml@' field_def_lmdz.xml |
---|
1174 | fi |
---|
1175 | |
---|
1176 | cd .. |
---|
1177 | fi |
---|
1178 | |
---|
1179 | # Cas Bensh avec ecrad |
---|
1180 | if [[ "$rad" = "ecrad" ]]; then |
---|
1181 | cd "BENCH${grid_resolution}" |
---|
1182 | cp ../DefLists/namelist_ecrad . |
---|
1183 | cp -r ../libf/phylmd/ecrad/data . |
---|
1184 | cd .. |
---|
1185 | fi |
---|
1186 | |
---|
1187 | # Adjusting bench physiq.def to radiative code chosen |
---|
1188 | cd "BENCH${grid_resolution}" |
---|
1189 | sed -e 's/iflag_rrtm=.*.$/iflag_rrtm='$iflag_rrtm'/' \ |
---|
1190 | -e 's/NSW=.*.$/NSW='$NSW'/' physiq.def > tmpdef |
---|
1191 | \mv tmpdef physiq.def |
---|
1192 | cd .. |
---|
1193 | |
---|
1194 | cp "$gcm" "BENCH${grid_resolution}/gcm.e" |
---|
1195 | |
---|
1196 | cd "BENCH${grid_resolution}" |
---|
1197 | # On cree le fichier bench.sh au besoin |
---|
1198 | # Dans le cas 48x36x39 le bench.sh existe deja en parallele |
---|
1199 | |
---|
1200 | if [[ "$grid_resolution" = "48x36x39" ]]; then |
---|
1201 | echo On ne touche pas au bench.sh |
---|
1202 | # But we have to adapt "run_local.sh" for $mpirun |
---|
1203 | sed -e "s@mpirun@$mpirun@g" run_local.sh > tmp |
---|
1204 | mv -f tmp run_local.sh |
---|
1205 | chmod u=rwx run_local.sh |
---|
1206 | elif [[ "${parallel:0:3}" = "mpi" ]]; then |
---|
1207 | # Lancement avec deux procs mpi et 2 openMP |
---|
1208 | echo "export OMP_STACKSIZE=800M" > bench.sh |
---|
1209 | if [[ "${parallel:4:3}" = "omp" ]]; then |
---|
1210 | echo "export OMP_NUM_THREADS=2" >> bench.sh |
---|
1211 | fi |
---|
1212 | if [[ "$cosp" = "v1" || "$cosp" = "v2" ]]; then |
---|
1213 | if [[ ${hostname:0:5} = jean- ]]; then |
---|
1214 | chmod +x ../arch.env |
---|
1215 | ../arch.env |
---|
1216 | echo "ulimit -s 2000000" >> bench.sh |
---|
1217 | else |
---|
1218 | echo "ulimit -s 200000" >> bench.sh |
---|
1219 | fi |
---|
1220 | else |
---|
1221 | echo "ulimit -s unlimited" >> bench.sh |
---|
1222 | fi |
---|
1223 | if [[ ${hostname:0:5} = jean- ]]; then |
---|
1224 | . ../arch/arch-${arch}.env |
---|
1225 | echo "srun -n 2 && $idris_acct@cpu gcm.e > listing 2>&1" \ |
---|
1226 | >> bench.sh |
---|
1227 | else |
---|
1228 | echo "$mpirun -np 2 gcm.e > listing 2>&1" >> bench.sh |
---|
1229 | fi |
---|
1230 | # Add rebuild, using reb.sh if it is there |
---|
1231 | cat <<EOF >> bench.sh |
---|
1232 | if [[ -f reb.sh ]]; then |
---|
1233 | ./reb.sh histday; ./reb.sh histmth; ./reb.sh histhf; |
---|
1234 | ./reb.sh histins; ./reb.sh stomate_history; |
---|
1235 | ./reb.sh sechiba_history; ./reb.sh sechiba_out_2 |
---|
1236 | fi |
---|
1237 | EOF |
---|
1238 | else |
---|
1239 | echo "./gcm.e > listing 2>&1" > bench.sh |
---|
1240 | fi |
---|
1241 | # Getting orchidee stuff |
---|
1242 | if [[ $veget == 'CMIP6' ]]; then |
---|
1243 | #echo 'myget 3DBenchs/BENCHorch11.tar.gz' |
---|
1244 | #myget 3DBenchs/BENCHorch11.tar.gz |
---|
1245 | #tar xvzf BENCHorch11.tar.gz |
---|
1246 | echo 'myget 3DBenchs/BENCHCMIP6.tar.gz' |
---|
1247 | myget 3DBenchs/BENCHCMIP6.tar.gz |
---|
1248 | tar xvzf BENCHCMIP6.tar.gz |
---|
1249 | sed -e "s:VEGET=n:VEGET=y:" config.def > tmp |
---|
1250 | mv -f tmp config.def |
---|
1251 | if [[ "$with_xios" = "y" ]]; then |
---|
1252 | cp ../../ORCHIDEE/src_xml/context_orchidee.xml . |
---|
1253 | echo '<context id="orchidee" src="./context_orchidee.xml"/>' \ |
---|
1254 | > add.tmp |
---|
1255 | cp ../../ORCHIDEE/src_xml/field_def_orchidee.xml . |
---|
1256 | cp ../../ORCHIDEE/src_xml/file_def_orchidee.xml . |
---|
1257 | cp ../../ORCHIDEE/src_xml/file_def_input_orchidee.xml . |
---|
1258 | if [[ -f ../../ORCHIDEE/src_xml/context_input_orchidee.xml ]]; then |
---|
1259 | cp ../../ORCHIDEE/src_xml/context_input_orchidee.xml . |
---|
1260 | echo '<context id="orchidee" ' \ |
---|
1261 | 'src="./context_input_orchidee.xml"/>' >> add.tmp |
---|
1262 | fi |
---|
1263 | sed -e '/id="LMDZ"/r add.tmp' iodef.xml > tmp |
---|
1264 | mv tmp iodef.xml |
---|
1265 | sed -e'{/sechiba1/ s/enabled="_AUTO_"/type="one_file" enabled=".TRUE."/}' \ |
---|
1266 | file_def_orchidee.xml > tmp |
---|
1267 | \mv -f tmp file_def_orchidee.xml |
---|
1268 | sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".FALSE."@' \ |
---|
1269 | file_def_orchidee.xml > tmp |
---|
1270 | \mv -f tmp file_def_orchidee.xml |
---|
1271 | sed -e 's@output_level="_AUTO_"@output_level="1"@' \ |
---|
1272 | file_def_orchidee.xml > tmp |
---|
1273 | \mv -f tmp file_def_orchidee.xml |
---|
1274 | sed -e 's@output_freq="_AUTO_"@output_freq="1d"@' \ |
---|
1275 | file_def_orchidee.xml > tmp |
---|
1276 | \mv -f tmp file_def_orchidee.xml |
---|
1277 | sed -e 's@compression_level="4"@compression_level="0"@' \ |
---|
1278 | file_def_orchidee.xml > tmp |
---|
1279 | \mv -f tmp file_def_orchidee.xml |
---|
1280 | sed -e 's@XIOS_ORCHIDEE_OK = n@XIOS_ORCHIDEE_OK = y@' \ |
---|
1281 | orchidee.def > tmp |
---|
1282 | \mv -f tmp orchidee.def |
---|
1283 | fi |
---|
1284 | fi |
---|
1285 | |
---|
1286 | if [[ -f ../arch.env ]] |
---|
1287 | then |
---|
1288 | source ../arch.env |
---|
1289 | fi |
---|
1290 | |
---|
1291 | echo EXECUTION DU BENCH |
---|
1292 | set +e |
---|
1293 | date; ./bench.sh > out.bench 2>&1; date |
---|
1294 | set -e |
---|
1295 | tail listing |
---|
1296 | |
---|
1297 | |
---|
1298 | echo "##########################################################" |
---|
1299 | echo "Simulation finished in $(pwd)" |
---|
1300 | echo "You have compiled with:" |
---|
1301 | cat ../compile.sh |
---|
1302 | if [[ $parallel = "none" ]]; then |
---|
1303 | echo "You may re-run it with : cd $(pwd); gcm.e" |
---|
1304 | echo "or ./bench.sh" |
---|
1305 | else |
---|
1306 | echo "You may re-run it with : " |
---|
1307 | echo "cd $(pwd); ./bench.sh" |
---|
1308 | # echo 'ulimit -s unlimited' |
---|
1309 | # echo 'export OMP_NUM_THREADS=2' |
---|
1310 | # echo 'export OMP_STACKSIZE=800M' |
---|
1311 | # echo "$mpirun -np 2 gcm.e " |
---|
1312 | fi |
---|
1313 | echo '##########################################################' |
---|
1314 | |
---|
1315 | fi # bench |
---|
1316 | |
---|
1317 | |
---|
1318 | ################################################################# |
---|
1319 | # Installation eventuelle du 1D |
---|
1320 | ################################################################# |
---|
1321 | |
---|
1322 | if [[ $SCM = 1 ]]; then |
---|
1323 | cd "$MODEL" |
---|
1324 | myget 1D/1D.tar.gz |
---|
1325 | tar xf 1D.tar.gz |
---|
1326 | cd 1D |
---|
1327 | if [[ $rad = oldrad ]]; then |
---|
1328 | sed -i'' -e 's/^rad=.*$/rad=oldrad/' run.sh |
---|
1329 | sed -i'' -e 's/^rad=.*$/rad=oldrad/' bin/compile |
---|
1330 | fi |
---|
1331 | echo "Running 1D/run.sh, log in $(pwd)/run1d.log" |
---|
1332 | ./run.sh > "$(pwd)/run1d.log" 2>&1 |
---|
1333 | fi |
---|
1334 | |
---|
1335 | |
---|
1336 | ################################################################# |
---|
1337 | # sauvegarde des options veget pour utilisation eventuelle tutorial_prod |
---|
1338 | ################################################################# |
---|
1339 | cd "$MODEL/modipsl/modeles" |
---|
1340 | #echo surface_env file created in $MODEL |
---|
1341 | cat <<EOF >surface_env |
---|
1342 | veget=$veget |
---|
1343 | opt_veget="-v $veget_version" |
---|
1344 | orchidee_rev=$orchidee_rev |
---|
1345 | suforch=$suff_orc |
---|
1346 | EOF |
---|