[4210] | 1 | #!/bin/bash |
---|
[4849] | 2 | set -eu # error on command failure, and on unset variables |
---|
| 3 | export LC_ALL=C # standardize awk format |
---|
[4210] | 4 | |
---|
| 5 | ########################################################################### |
---|
[4849] | 6 | # Author : Laurent Fairhead et Frédéric Hourdin |
---|
[4210] | 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. |
---|
[4218] | 21 | # In the present case, LMDZ, ORCHIDEE, and IOIPSL or XIOS (handling of |
---|
| 22 | # input-outputs using the NetCDF library). |
---|
[4210] | 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 | |
---|
[4862] | 38 | ### Functions |
---|
[4891] | 39 | # TODO add make_j parallel argument -> check what is used for libigcm |
---|
[4210] | 40 | |
---|
[4871] | 41 | function myget { # Get a file from LMDZ repository |
---|
| 42 | local url=$1 |
---|
[4210] | 43 | |
---|
[4871] | 44 | local filename |
---|
| 45 | filename=$(basename "$url") |
---|
| 46 | |
---|
| 47 | wget --no-check-certificate -nv "http://lmdz.lmd.jussieu.fr/pub/$url" |
---|
| 48 | if [[ $filename =~ .*\.(ba)?sh ]]; then chmod +x "$filename"; fi |
---|
[4210] | 49 | } |
---|
| 50 | |
---|
[4862] | 51 | function set_default_params { |
---|
| 52 | # Valeur par défaut des parametres |
---|
| 53 | svn="" |
---|
| 54 | version="20231022.trunk" |
---|
[4210] | 55 | |
---|
[4891] | 56 | netcdf=1 |
---|
[4862] | 57 | bench=1 |
---|
| 58 | pcmac=0 # default: not on a Mac |
---|
| 59 | SCM=0 |
---|
[4890] | 60 | veget="none" |
---|
[4891] | 61 | grid_resolution="32x32x39" |
---|
[4862] | 62 | physiq="" |
---|
[4210] | 63 | |
---|
[4873] | 64 | xios_branch="2.6" |
---|
| 65 | xios_rev="2568" |
---|
| 66 | |
---|
[4891] | 67 | parallel="none" |
---|
[4862] | 68 | trusting="testing" |
---|
| 69 | MODEL="" |
---|
[4210] | 70 | |
---|
[4891] | 71 | with_xios=0 |
---|
[4862] | 72 | opt_makelmdz_xios="" |
---|
[4210] | 73 | |
---|
[4862] | 74 | rad="rrtm" |
---|
[4210] | 75 | |
---|
[4862] | 76 | compile_with_fcm=1 |
---|
[4210] | 77 | |
---|
[4890] | 78 | cosp="none" |
---|
[4862] | 79 | opt_cosp="" |
---|
[4210] | 80 | |
---|
[4893] | 81 | make_j=8 |
---|
| 82 | |
---|
[4862] | 83 | # Check if on a Mac |
---|
| 84 | if [[ $(uname) = "Darwin" ]]; then |
---|
| 85 | pcmac=1 |
---|
| 86 | export MAKE="make" |
---|
| 87 | fi |
---|
[4210] | 88 | |
---|
[4873] | 89 | optim_debug="" |
---|
[4862] | 90 | arch="local" |
---|
[4210] | 91 | |
---|
[4862] | 92 | local mpi_file |
---|
| 93 | mpi_file=$(readlink -f "$(which mpif90)") |
---|
| 94 | path_mpi=$(dirname "$mpi_file") |
---|
| 95 | root_mpi=$(dirname "$path_mpi") |
---|
[4873] | 96 | |
---|
| 97 | arch="local-gfortran" |
---|
| 98 | arch_dir="" |
---|
[4862] | 99 | } |
---|
[4210] | 100 | |
---|
[4862] | 101 | function read_cmdline_args { |
---|
| 102 | while (($# > 0)); do |
---|
| 103 | case $1 in |
---|
| 104 | "-h") cat <<........fin |
---|
| 105 | $0 [ -v version ] [ -r svn_release ] |
---|
| 106 | [ -parallel PARA ] [ -d GRID_RESOLUTION ] [ -bench 0/1 ] |
---|
| 107 | [-name LOCAL_MODEL_NAME] [-gprof] [-opt_makelmdz] [-rad RADIATIF] |
---|
[4210] | 108 | |
---|
[4873] | 109 | -v "version" like 20150828.trunk, see http://www.lmd.jussieu.fr/~lmdz/Distrib/LISMOI.trunk (default <$version>) |
---|
[4210] | 110 | |
---|
[4873] | 111 | -r "svn_release" : either the svn release number or "last" (default <$svn>) |
---|
[4210] | 112 | |
---|
[4873] | 113 | -parallel parallel support: mpi, omp, mpi_omp (mpi with openMP) or none (default: <$parallel>) |
---|
[4210] | 114 | |
---|
[4873] | 115 | -d "grid resolution": should be among the available benchs if -bench 1 (valid values: 48x36x19, 48x36x39) (default : <$grid_resolution>) |
---|
[4210] | 116 | |
---|
[4873] | 117 | -bench activating the bench or not (0/1) (default: <$bench>) |
---|
[4210] | 118 | |
---|
[4862] | 119 | -testing/unstable |
---|
[4210] | 120 | |
---|
[4873] | 121 | -name name of the folder to install to (default <$MODEL>) |
---|
[4210] | 122 | |
---|
[4873] | 123 | -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>) |
---|
[4210] | 124 | |
---|
[4873] | 125 | -xios use (download and compile) the XIOS library (will compile the parallel NetCDF4-HDF5 library) (requires to also have -parallel mpi_omp) |
---|
[4210] | 126 | |
---|
[4873] | 127 | -cosp to run with cospv1 or cospv2 [none/v1/v2] (default <$cosp>) |
---|
[4210] | 128 | |
---|
[4873] | 129 | -rad radiative code: oldrad, rrtm or ecrad (default <$rad>) |
---|
[4210] | 130 | |
---|
[4873] | 131 | -nofcm to compile without fcm |
---|
[4210] | 132 | |
---|
[4862] | 133 | -SCM install 1D version automatically |
---|
[4210] | 134 | |
---|
[4862] | 135 | -debug compile everything in debug mode |
---|
[4210] | 136 | |
---|
[4873] | 137 | -physiq to choose which physics package to use (default <$physiq>) |
---|
[4210] | 138 | |
---|
[4873] | 139 | -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) |
---|
[4210] | 140 | |
---|
[4873] | 141 | -arch name of the arch to use (default <$arch>) |
---|
[4210] | 142 | |
---|
[4873] | 143 | -arch_dir where to find the arch files (default <$arch_dir>) |
---|
[4862] | 144 | |
---|
[4893] | 145 | -make_j number of processes to parallelize installations (default <$make_j>) |
---|
| 146 | |
---|
[4210] | 147 | ........fin |
---|
[4862] | 148 | exit 1;; |
---|
| 149 | "-v") version=$2; shift; shift;; |
---|
| 150 | "-r") svn=$2; shift; shift;; |
---|
| 151 | "-d") grid_resolution=$2; shift; shift;; |
---|
[4873] | 152 | "-unstable"|"-testing") trusting=$(echo "$1" | cut -c2-); shift;; |
---|
[4862] | 153 | "-cosp") cosp=$2 |
---|
| 154 | case $cosp in |
---|
| 155 | "none"|"v1"|"v2") cosp=$2; shift; shift;; |
---|
| 156 | *) echo "Only none v1 v2 for cosp option"; exit 1 |
---|
[4849] | 157 | esac;; |
---|
[4862] | 158 | "-nofcm") compile_with_fcm=0; echo "This option will be reactivated soon (promesse du 8dec2022)"; exit 1; shift;; |
---|
| 159 | "-SCM") SCM=1; shift;; |
---|
| 160 | "-rad") rad=$2 |
---|
| 161 | case $rad in |
---|
| 162 | "oldrad"|"rrtm"|"ecrad") rad=$2; shift; shift;; |
---|
| 163 | *) echo "Only oldrad rrtm ecrad for rad option"; exit 1 |
---|
| 164 | esac;; |
---|
| 165 | "-parallel") parallel=$2 |
---|
| 166 | case $parallel in |
---|
| 167 | "none"|"mpi"|"omp"|"mpi_omp") parallel=$2; shift; shift;; |
---|
| 168 | *) echo "Only none mpi omp mpi_omp for the parallel option"; exit 1 |
---|
| 169 | esac;; |
---|
| 170 | "-bench") bench=$2; shift; shift;; |
---|
[4873] | 171 | "-debug") optim_debug=-debug; shift;; |
---|
[4862] | 172 | "-name") MODEL=$2; shift; shift;; |
---|
| 173 | "-netcdf") netcdf=$2; shift; shift;; |
---|
| 174 | "-physiq") physiq=$2; shift; shift;; |
---|
[4891] | 175 | "-xios") with_xios=1; shift;; |
---|
[4873] | 176 | "-arch") arch=$2; shift; shift;; |
---|
| 177 | "-arch_dir") arch_dir=$2; shift; shift;; |
---|
[4862] | 178 | "-veget") veget=$2; shift; shift;; |
---|
[4893] | 179 | "-make_j") make_j=$2; shift; shift;; |
---|
[4862] | 180 | *) bash install_lmdz.sh -h; exit 1 |
---|
| 181 | esac |
---|
| 182 | done |
---|
| 183 | |
---|
| 184 | # Option de compilation pour Cosp |
---|
| 185 | case $cosp in |
---|
| 186 | v1) opt_cosp="-cosp true";; |
---|
| 187 | v2) opt_cosp="-cospv2 true";; |
---|
| 188 | *) opt_cosp="" |
---|
[4215] | 189 | esac |
---|
[4210] | 190 | |
---|
[4862] | 191 | # Check on veget version |
---|
[4890] | 192 | if [[ $veget != 'none' && $veget != "CMIP6" ]]; then |
---|
[4862] | 193 | re='^[0-9]+$' |
---|
| 194 | if ! [[ $veget =~ $re ]]; then |
---|
| 195 | echo 'Valeur de l option veget non valable'; exit 1 |
---|
| 196 | fi |
---|
| 197 | fi |
---|
[4218] | 198 | |
---|
[4862] | 199 | #Define veget-related suffix for gcm name |
---|
[4890] | 200 | if [[ $veget = 'none' ]]; then |
---|
[4862] | 201 | suff_orc='' |
---|
| 202 | #For use with tutorial, orchidee_rev is also defined (will be |
---|
| 203 | #written in surface_env at the end of the script) |
---|
| 204 | orchidee_rev='' |
---|
| 205 | else |
---|
| 206 | suff_orc='_orch' |
---|
| 207 | fi |
---|
[4210] | 208 | |
---|
[4807] | 209 | |
---|
[4862] | 210 | if [[ $parallel = "none" ]]; then |
---|
[4891] | 211 | suff_exe='_seq' |
---|
[4862] | 212 | else |
---|
[4891] | 213 | suff_exe='_para_mem' |
---|
[4210] | 214 | fi |
---|
| 215 | |
---|
[4862] | 216 | #Chemin pour placer le modele |
---|
[4873] | 217 | if [[ $MODEL = "" ]]; then MODEL="./LMDZ$version$svn$optim_debug"; fi |
---|
[4210] | 218 | |
---|
[4862] | 219 | ## if also compiling XIOS, parallel must be mpi_omp |
---|
[4891] | 220 | if [[ $with_xios = 1 && $parallel != "mpi_omp" ]]; then |
---|
[4862] | 221 | echo "Error, you must set -parallel mpi_omp if you want XIOS"; exit 1 |
---|
| 222 | fi |
---|
[4210] | 223 | |
---|
[4891] | 224 | if [[ $with_xios = 1 ]]; then |
---|
[4862] | 225 | opt_makelmdz_xios="-io xios" |
---|
| 226 | fi |
---|
[4210] | 227 | |
---|
[4891] | 228 | if [[ $cosp = "v2" && $with_xios = 0 ]]; then |
---|
[4862] | 229 | echo "Error, Cospv2 cannot run without Xios"; exit 1 |
---|
[4215] | 230 | fi |
---|
[4873] | 231 | |
---|
| 232 | if [[ $arch_dir = "" ]]; then |
---|
| 233 | arch_dir="$MODEL/modipsl/config/IPSLCM7/ARCH/" |
---|
| 234 | fi |
---|
| 235 | arch_dir=$(readlink -f "$arch_dir") # full path |
---|
[4862] | 236 | } |
---|
[4210] | 237 | |
---|
[4862] | 238 | function check_available_software { |
---|
[4873] | 239 | echo "################################################################" |
---|
| 240 | echo "Check if required software is available" |
---|
| 241 | echo "################################################################" |
---|
| 242 | for logiciel in wget tar gzip make gcc cmake m4 c++; do |
---|
| 243 | if [[ $(which "$logiciel") = "" ]]; then |
---|
| 244 | echo "You must first install $logiciel on your system"; exit 1 |
---|
| 245 | fi |
---|
| 246 | done |
---|
[4210] | 247 | |
---|
[4873] | 248 | cat <<eod > tt.f90 |
---|
| 249 | print*,'coucou' |
---|
| 250 | end |
---|
[4862] | 251 | eod |
---|
[4873] | 252 | $compiler tt.f90 || a.out |
---|
| 253 | ./a.out >| tt |
---|
| 254 | if [[ $(< tt sed -e 's/ //g' ) != "coucou" ]]; then |
---|
| 255 | echo "problem installing with compiler $compiler"; exit 1 |
---|
[4218] | 256 | fi |
---|
[4873] | 257 | \rm tt a.out tt.f90 |
---|
[4862] | 258 | } |
---|
[4210] | 259 | |
---|
[4862] | 260 | function download_model { |
---|
| 261 | mkdir -p "$MODEL" |
---|
| 262 | MODEL=$(readlink -f "$MODEL"); echo "$MODEL" # absolute path |
---|
[4210] | 263 | |
---|
[4873] | 264 | rm -rf "$MODEL/modipsl" |
---|
| 265 | |
---|
| 266 | echo "##########################################################" |
---|
| 267 | echo "Download a slightly modified version of LMDZ" |
---|
| 268 | echo "##########################################################" |
---|
| 269 | cd "$MODEL" |
---|
| 270 | getlog="$(pwd)/get.log" |
---|
| 271 | echo "logfile : $getlog" |
---|
| 272 | myget "src_archives/$trusting/modipsl.$version.tar.gz" >> get.log 2>&1 |
---|
| 273 | echo "install_lmdz.sh wget_OK $(date)" |
---|
| 274 | gunzip "modipsl.$version.tar.gz" >> get.log 2>&1 |
---|
| 275 | tar xf "modipsl.$version.tar" >> get.log 2>&1 |
---|
| 276 | \rm "modipsl.$version.tar" |
---|
| 277 | |
---|
| 278 | if [[ $svn != "" ]]; then |
---|
| 279 | mysvn=$svn |
---|
| 280 | else |
---|
| 281 | mysvn="$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null)" |
---|
[4218] | 282 | fi |
---|
[4873] | 283 | echo "SVN revision used: $mysvn" |
---|
| 284 | } |
---|
[4871] | 285 | |
---|
[4890] | 286 | function download_model_AMAURY { # TODO |
---|
[4873] | 287 | MODEL=$(readlink -f "$MODEL"); echo "$MODEL" # absolute path |
---|
| 288 | |
---|
[4871] | 289 | if [[ $svn != "" ]]; then |
---|
| 290 | mysvn=$svn |
---|
| 291 | else |
---|
| 292 | mysvn="$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null)" |
---|
| 293 | fi |
---|
| 294 | echo "SVN revision used: $mysvn" |
---|
[4862] | 295 | } |
---|
[4210] | 296 | |
---|
[4890] | 297 | function install_arch { |
---|
[4873] | 298 | if [[ ! -d $arch_dir ]]; then |
---|
| 299 | echo "Error: no arch dir $arch_dir"; exit 1 |
---|
| 300 | elif [[ ! -f $arch_dir/arch-$arch.path ]]; then |
---|
| 301 | echo "Error: no arch-$arch.path in $arch_dir"; exit 1 |
---|
| 302 | fi |
---|
[4871] | 303 | |
---|
[4873] | 304 | local fcm_path |
---|
| 305 | if [[ -f $arch_dir/arch-$arch.fcm ]]; then |
---|
| 306 | fcm_path="$arch_dir/arch-$arch.fcm" |
---|
| 307 | else |
---|
| 308 | fcm_path="$MODEL/modipsl/modeles/LMDZ/arch/arch-$arch.fcm" |
---|
| 309 | if [[ ! -f $fcm_path ]]; then |
---|
| 310 | echo "Error: no $fcm_path"; exit 1 |
---|
| 311 | fi |
---|
| 312 | fi |
---|
| 313 | |
---|
| 314 | # check compiler |
---|
| 315 | compiler=$(< "$fcm_path" grep "%COMPILER" | sed -e "s/%COMPILER\s*//") |
---|
[4890] | 316 | |
---|
| 317 | # Copy arch to different components |
---|
| 318 | # TODO check that this doesn't error if the source and destination are the same |
---|
[4893] | 319 | for dir in "IOIPSL" "ORCHIDEE" "LMDZ" "XIOS"; do |
---|
[4891] | 320 | \cp -f "$arch_dir/arch-$arch.fcm" "$MODEL/modipsl/modeles/$dir/arch" |
---|
| 321 | \cp -f "$arch_dir/arch-$arch.path" "$MODEL/modipsl/modeles/$dir/arch" |
---|
| 322 | done |
---|
[4890] | 323 | |
---|
| 324 | # TODO TEMP compat w/ old orch version - make a proper case later |
---|
| 325 | sed -i'' -e "s/-I//" -e "s/-L//" "$MODEL/modipsl/modeles/ORCHIDEE/arch/arch-$arch.path" # /!\ we only replace first occurence on purpose |
---|
[4893] | 326 | |
---|
| 327 | # Adapt for XIOS, which uses different naming conventions |
---|
| 328 | sed -i'' -e "s/%COMPILER/%FCOMPILER/" -e "s/%LINK/%LINKER/" -e "s/-fdefault-real-8//" "$MODEL/modipsl/modeles/XIOS/arch/arch-$arch.fcm" |
---|
[4871] | 329 | } |
---|
| 330 | |
---|
[4862] | 331 | function install_netcdf { |
---|
| 332 | echo "Installing Netcdf" |
---|
[4210] | 333 | |
---|
[4862] | 334 | if [[ $netcdf = 0 ]]; then |
---|
| 335 | ncdfdir=$(nc-config --prefix) |
---|
| 336 | else |
---|
| 337 | cd "$MODEL" |
---|
[4210] | 338 | |
---|
[4896] | 339 | # Convert non-basic compiler |
---|
| 340 | local ncdf_compiler="$compiler" |
---|
| 341 | case $compiler in # TODO check if it works with other base compilers |
---|
| 342 | mpif90) ncdf_compiler=$($compiler --help | head -n 1 | cut -f 2 -d " ") |
---|
[4862] | 343 | esac |
---|
[4210] | 344 | |
---|
[4896] | 345 | case $ncdf_compiler in |
---|
| 346 | gfortran) opt1="-compiler gnu"; opt2="-CC gcc -FC gfortran -CXX g++";; |
---|
| 347 | ifort) opt1="-compiler intel"; opt2="-CC icc -FC ifort -CXX icpc";; |
---|
| 348 | pgf90) opt1="-compiler pgf90"; opt2="-CC pgcc -FC pgf90 -CXX pgCC";; |
---|
| 349 | *) echo "unexpected compiler $ncdf_compiler for netcdf"; exit 1 |
---|
| 350 | esac |
---|
| 351 | |
---|
[4862] | 352 | case $with_xios in |
---|
[4891] | 353 | 0) script_install_netcdf="install_netcdf4_hdf5_seq.bash" |
---|
[4862] | 354 | ncdfdir="netcdf4_hdf5_seq" |
---|
| 355 | opt_="$opt1";; |
---|
[4891] | 356 | 1) script_install_netcdf="install_netcdf4_hdf5.bash" |
---|
[4862] | 357 | ncdfdir="netcdf4_hdf5" |
---|
| 358 | opt_="$opt2 -MPI $root_mpi";; |
---|
[4891] | 359 | *) echo "with_xios=$with_xios, should be 0 or 1"; exit 1 |
---|
[4862] | 360 | esac |
---|
| 361 | if [[ $netcdf = 1 ]]; then |
---|
| 362 | ncdfdir="$MODEL/$ncdfdir" |
---|
| 363 | else |
---|
| 364 | mkdir -p "$netcdf"; ncdfdir="$netcdf/$ncdfdir" |
---|
| 365 | fi |
---|
[4210] | 366 | |
---|
[4896] | 367 | |
---|
[4862] | 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 |
---|
[4405] | 379 | fi |
---|
[4210] | 380 | |
---|
[4896] | 381 | # Add to path |
---|
| 382 | export PATH="$ncdfdir/bin:$PATH" |
---|
| 383 | |
---|
[4862] | 384 | #---------------------------------------------------------------------------- |
---|
| 385 | # LF rajout d'une verrue, pour une raison non encore expliquee, |
---|
| 386 | # la librairie est parfois rangée dans lib64 et non dans lib |
---|
| 387 | # par certains compilateurs |
---|
| 388 | if [[ ! -e lib && -d lib64 ]]; then ln -s lib64 lib; fi |
---|
| 389 | #---------------------------------------------------------------------------- |
---|
[4210] | 390 | |
---|
[4862] | 391 | echo "install_lmdz.sh netcdf_OK $(date)" |
---|
| 392 | fi |
---|
[4210] | 393 | |
---|
[4862] | 394 | cat >test_netcdf90.f90 <<EOF |
---|
| 395 | use netcdf |
---|
| 396 | print *, "NetCDF library version: ", nf90_inq_libvers() |
---|
| 397 | end |
---|
| 398 | EOF |
---|
[4546] | 399 | |
---|
[4896] | 400 | if $ncdf_compiler -I"$ncdfdir"/include test_netcdf90.f90 -L"$ncdfdir"/lib -lnetcdff \ |
---|
[4862] | 401 | -lnetcdf -Wl,-rpath="$ncdfdir"/lib && ./a.out |
---|
| 402 | then |
---|
| 403 | \rm test_netcdf90.f90 a.out |
---|
[4546] | 404 | else |
---|
[4862] | 405 | cat <<EOF |
---|
| 406 | Failed test program using NetCDF-Fortran. You can: |
---|
| 407 | - check that you have NetCDF-Fortran installed in your system |
---|
| 408 | - or specify an installation directory with option -netcdf of install_lmdz.sh |
---|
| 409 | - or download and compile NetCDF-Fortran with option -netcdf 1 of nstall_lmdz.sh |
---|
| 410 | EOF |
---|
| 411 | exit 1 |
---|
[4546] | 412 | fi |
---|
[4891] | 413 | |
---|
| 414 | # Compile NetCDF95 |
---|
| 415 | cd "$MODEL/modipsl/modeles/LMD"* |
---|
| 416 | echo "Installing NetCDF95" |
---|
| 417 | cd "$MODEL" |
---|
| 418 | myget src_archives/netcdf/NetCDF95-0.3.tar.gz |
---|
| 419 | tar -xf NetCDF95-0.3.tar.gz |
---|
| 420 | \rm NetCDF95-0.3.tar.gz |
---|
| 421 | cd NetCDF95-0.3 |
---|
| 422 | mkdir -p build && cd build |
---|
| 423 | netCDF_INCLUDE_DIR=$(nc-config --includedir) netCDF_LIBRARY=$(nc-config --libdir) cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$ncdfdir" -DCMAKE_INSTALL_PREFIX="$MODEL/modipsl" |
---|
| 424 | make install |
---|
[4862] | 425 | } |
---|
[4405] | 426 | |
---|
[4896] | 427 | function install_IOIPSL { |
---|
[4862] | 428 | cd "$MODEL/modipsl/modeles/IOIPSL" |
---|
| 429 | ioipsllog="$(pwd)/ioipsl.log" |
---|
| 430 | echo "Compiling IOIPSL, the interface library with Netcdf $(date) (log: $ioipsllog)" |
---|
[4405] | 431 | |
---|
[4890] | 432 | if ! ./makeioipsl_fcm -arch "$arch" -job 8 > "$ioipsllog" 2>&1; then |
---|
| 433 | echo "IOIPSL compile failed, exiting"; exit 1 |
---|
[4862] | 434 | fi |
---|
[4896] | 435 | |
---|
| 436 | # Link to modipsl/bin |
---|
| 437 | cp -f bin/* ../../bin |
---|
| 438 | |
---|
[4862] | 439 | echo "IOIPSL compiled $(date)" |
---|
[4873] | 440 | |
---|
[4891] | 441 | IOIPSL_LIBDIR_="$MODEL/modipsl/modeles/IOIPSL/lib" |
---|
| 442 | IOIPSL_INCDIR_="$MODEL/modipsl/modeles/IOIPSL/inc" |
---|
[4862] | 443 | } |
---|
[4210] | 444 | |
---|
[4871] | 445 | function install_XIOS { |
---|
[4891] | 446 | if [[ $with_xios = 1 ]]; then |
---|
[4871] | 447 | cd "$MODEL/modipsl/modeles" |
---|
[4893] | 448 | xioslog="$(pwd)/XIOS/xios.log" |
---|
[4871] | 449 | echo "##########################################################" |
---|
| 450 | echo "Compiling XIOS (log $xioslog) $(date)" |
---|
| 451 | echo "##########################################################" |
---|
| 452 | |
---|
[4873] | 453 | # Download XIOS |
---|
| 454 | case $xios_branch in |
---|
| 455 | "trunk") |
---|
| 456 | xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/trunk";; |
---|
| 457 | "2.5") |
---|
| 458 | xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/branchs/xios-2.5";; |
---|
| 459 | "2.6") |
---|
| 460 | xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.6";; |
---|
| 461 | *) echo "XIOS: Error, bad argument for -branch ! Did not expect $xios_branch"; exit;; |
---|
| 462 | esac |
---|
| 463 | |
---|
| 464 | cd "$MODEL/modipsl/modeles" |
---|
| 465 | set +e; svn co --revision $xios_rev $xios_http XIOS; set -e |
---|
| 466 | |
---|
| 467 | cd XIOS |
---|
[4893] | 468 | if ! ./make_xios --arch "$arch" --job 8 > "$xioslog" 2>&1; then |
---|
[4871] | 469 | echo "XIOS compilation failed, exiting"; exit 1 |
---|
| 470 | fi |
---|
| 471 | |
---|
| 472 | echo "Compiled XIOS $(date)" |
---|
| 473 | fi |
---|
[4893] | 474 | |
---|
| 475 | XIOS_LIBDIR_="$MODEL/modipsl/modeles/XIOS/lib" |
---|
| 476 | XIOS_INCDIR_="$MODEL/modipsl/modeles/XIOS/inc" |
---|
[4871] | 477 | } |
---|
| 478 | |
---|
[4873] | 479 | function get_orchidee_version { # Set / Check ORCHIDEE version |
---|
[4891] | 480 | if [[ $veget = "none" ]]; then |
---|
| 481 | veget_version="false" |
---|
| 482 | elif [[ $veget = "CMIP6" ]]; then |
---|
| 483 | veget_version=orchidee2.0 |
---|
| 484 | else # specific orchidee revision newer than CMIP6, on 2_1 or 2_2 branches |
---|
| 485 | veget_version=orchidee2.1 |
---|
| 486 | if [[ $veget -lt 4465 ]]; then |
---|
| 487 | echo 'ORCHIDEE version must be >=4465, exiting' |
---|
| 488 | exit 1 |
---|
| 489 | fi |
---|
[4873] | 490 | |
---|
[4891] | 491 | set +e |
---|
| 492 | svn upgrade |
---|
| 493 | local orcbranch |
---|
| 494 | 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}') |
---|
| 495 | echo "IF YOU INSTALL ORCHIDEE THE VERY FIRST TIME, ASK for PASSWORD at orchidee-help@listes.ipsl.fr" |
---|
| 496 | svn switch -r "$veget" --accept theirs-full "svn://forge.ipsl.jussieu.fr/orchidee/$orcbranch" |
---|
| 497 | svn log -r "$veget" | grep "$veget" |
---|
| 498 | if ! svn log -r "$veget" | grep "$veget"; then |
---|
| 499 | echo 'Cannot update ORCHIDEE as not on the right branch for ORCHIDEE' |
---|
| 500 | exit 1 |
---|
| 501 | fi |
---|
| 502 | svn update -r "$veget" |
---|
| 503 | set -e |
---|
[4873] | 504 | fi |
---|
| 505 | } |
---|
| 506 | |
---|
[4891] | 507 | function compile_orchidee { |
---|
| 508 | get_orchidee_version |
---|
| 509 | ORCHPATH="" |
---|
[4873] | 510 | |
---|
| 511 | |
---|
[4891] | 512 | if [[ $veget != "none" ]]; then |
---|
| 513 | cd "$MODEL/modipsl/modeles/ORCHIDEE" |
---|
| 514 | ORCHPATH=$(pwd) |
---|
[4873] | 515 | |
---|
[4891] | 516 | orchideelog="$(pwd)/orchidee.log" |
---|
| 517 | echo "Compiling ORCHIDEE, the continental surface model (log $orchideelog) $(date)" |
---|
[4873] | 518 | |
---|
[4891] | 519 | local xios_orchid opt_orc |
---|
| 520 | if [[ $with_xios = 1 ]]; then |
---|
| 521 | xios_orchid="-xios"; |
---|
| 522 | else |
---|
| 523 | xios_orchid="-noxios" |
---|
[4405] | 524 | fi |
---|
[4891] | 525 | if [[ $optim_debug = "-debug" ]]; then |
---|
| 526 | opt_orc="-debug"; |
---|
| 527 | else |
---|
| 528 | opt_orc="-prod" |
---|
| 529 | fi |
---|
[4210] | 530 | |
---|
[4891] | 531 | # TODO check that this works with old orchidee versions (cf. -d tools) |
---|
| 532 | local varenv="IOIPSL_LIBDIR_=$IOIPSL_LIBDIR_ IOIPSL_INCDIR_=$IOIPSL_INCDIR_ ORCHPATH=$ORCHPATH" |
---|
| 533 | if [[ $parallel = "none" ]]; then |
---|
[4893] | 534 | echo "$varenv ./makeorchidee_fcm $xios_orchid $opt_orc -parallel none -arch $arch -j $make_j" > compile.sh |
---|
[4891] | 535 | else |
---|
| 536 | if [[ ! -d src_parallel ]]; then |
---|
| 537 | echo "Orchidee version too old for parallel support"; exit 1 |
---|
[4405] | 538 | fi |
---|
[4891] | 539 | { |
---|
[4893] | 540 | echo "$varenv ./makeorchidee_fcm -j $make_j -clean $xios_orchid $opt_orc -parallel $parallel -arch $arch" |
---|
| 541 | echo "$varenv ./makeorchidee_fcm -j $make_j $xios_orchid $opt_orc -parallel $parallel -arch $arch" |
---|
[4891] | 542 | } > compile.sh |
---|
[4405] | 543 | fi |
---|
[4891] | 544 | chmod +x compile.sh |
---|
| 545 | echo "Compiling ORCHIDEE using $(\cat compile.sh)" |
---|
| 546 | if ! ./compile.sh > "$orchideelog" 2>&1; then |
---|
| 547 | echo "ORCHIDEE compilation failed, exiting"; exit 1 |
---|
| 548 | fi |
---|
| 549 | echo "Compiled ORCHIDEE $(date)" |
---|
[4210] | 550 | fi |
---|
| 551 | |
---|
[4891] | 552 | ORCH_LIBDIR_="$MODEL/modipsl/modeles/ORCHIDEE/lib" |
---|
| 553 | } |
---|
[4210] | 554 | |
---|
[4891] | 555 | function get_lmdz_version { |
---|
| 556 | LMDZPATH=$(readlink -f "$MODEL/modipsl/modeles/LMD"*) |
---|
| 557 | cd "$LMDZPATH" |
---|
| 558 | lmdzlog="$(pwd)/lmdz.log" |
---|
[4372] | 559 | |
---|
[4891] | 560 | set +e |
---|
| 561 | svn upgrade |
---|
| 562 | if [[ $svn = "last" ]]; then |
---|
| 563 | svnopt="" |
---|
[4427] | 564 | else |
---|
[4891] | 565 | svnopt="-r $svn" |
---|
[4427] | 566 | fi |
---|
[4891] | 567 | if [[ $svn != "" ]]; then |
---|
| 568 | if svn info | grep -q 'https:'; then svn switch --relocate https://svn.lmd.jussieu.fr/LMDZ http://svn.lmd.jussieu.fr/LMDZ; fi |
---|
| 569 | svn update "$svnopt" |
---|
| 570 | fi |
---|
| 571 | mysvn=$(svnversion . | grep -E -o "[0-9]+" 2>/dev/null) |
---|
| 572 | set -e |
---|
[4427] | 573 | |
---|
[4891] | 574 | if [[ $mysvn = "" ]]; then mysvn=$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null); fi |
---|
| 575 | if [[ $mysvn = "" ]]; then mysvn=4190; fi |
---|
| 576 | } |
---|
[4427] | 577 | |
---|
[4891] | 578 | function compile_lmdz { |
---|
| 579 | get_lmdz_version |
---|
[4427] | 580 | |
---|
[4891] | 581 | exe_name="bin/gcm_${grid_resolution}_phylmd_${rad}${suff_exe}${suff_orc}.e" |
---|
[4210] | 582 | |
---|
[4891] | 583 | local opt_rad |
---|
| 584 | case $rad in |
---|
| 585 | oldrad) iflag_rrtm=0; NSW=2; opt_rad="";; |
---|
| 586 | rrtm) iflag_rrtm=1; NSW=6 |
---|
[4849] | 587 | if [[ $mysvn -le 4185 ]]; then |
---|
[4405] | 588 | opt_rad="-rrtm true" |
---|
| 589 | else |
---|
| 590 | opt_rad="-rad rrtm" |
---|
[4849] | 591 | fi;; |
---|
[4891] | 592 | ecrad) iflag_rrtm=2; NSW=6; opt_rad="-rad ecrad";; |
---|
| 593 | *) echo "Only oldrad rrtm ecrad for rad option"; exit 1 |
---|
| 594 | esac |
---|
| 595 | if [[ $mysvn -le 4185 && $rad = "ecrad" ]]; then |
---|
| 596 | echo "ecrad only available for LMDZ rev starting with 4186 "; exit 1 |
---|
[4215] | 597 | fi |
---|
[4210] | 598 | |
---|
[4891] | 599 | # Compile |
---|
[4893] | 600 | local varenv="IOIPSL_LIBDIR_=$IOIPSL_LIBDIR_ IOIPSL_INCDIR_=$IOIPSL_INCDIR_ ORCH_LIBDIR_=$ORCH_LIBDIR_ ORCHPATH=$ORCHPATH XIOS_INCDIR_=$XIOS_INCDIR_ XIOS_LIBDIR_=$XIOS_LIBDIR_" |
---|
| 601 | makelmdz="makelmdz_fcm $optim_debug -arch $arch -j $make_j" |
---|
[4891] | 602 | if [[ $parallel = "none" ]]; then |
---|
| 603 | echo "$varenv ./$makelmdz $opt_rad $opt_cosp -d ${grid_resolution} -v $veget_version gcm " > compile.sh |
---|
[4215] | 604 | else |
---|
[4891] | 605 | echo "$varenv ./$makelmdz $opt_rad $opt_cosp $opt_makelmdz_xios -d ${grid_resolution} -v $veget_version -mem -parallel $parallel gcm" > compile.sh |
---|
[4215] | 606 | fi |
---|
[4891] | 607 | echo "Compiling lmdz using $(\cat compile.sh) (log: $lmdzlog) $(date)" |
---|
[4215] | 608 | chmod +x ./compile.sh |
---|
[4891] | 609 | if ! ./compile.sh > "$lmdzlog" 2>&1; then |
---|
| 610 | echo "LMDZ compilation failed, exiting"; exit 1 |
---|
[4215] | 611 | fi |
---|
[4891] | 612 | echo "Finished LMDZ compilation $(date)" |
---|
[4215] | 613 | |
---|
[4891] | 614 | # Check executable |
---|
| 615 | # TODO $mysev -ge 4186 => other name convention ! check original install |
---|
| 616 | if [[ ! -f $exe_name ]]; then |
---|
| 617 | echo "Compilation failed, can't find the executable"; exit 1 |
---|
[4215] | 618 | else |
---|
[4891] | 619 | echo "Compilation successfull, the executable is $exe_name $(date)" |
---|
[4215] | 620 | fi |
---|
[4891] | 621 | } |
---|
[4210] | 622 | |
---|
[4891] | 623 | function run_bench { |
---|
| 624 | cd "$MODEL/modipsl/modeles/LMDZ"* |
---|
[4210] | 625 | |
---|
[4891] | 626 | if [[ $bench = "tuto" ]]; then |
---|
[4893] | 627 | myget "Training/tutorial.tar"; tar xf tutorial.tar; cd TUTORIAL |
---|
[4891] | 628 | ./init.sh |
---|
| 629 | elif [[ $bench = 1 ]]; then |
---|
| 630 | \rm -rf "BENCH${grid_resolution}" |
---|
| 631 | local bench=bench_lmdz_${grid_resolution} |
---|
| 632 | myget "3DBenchs/$bench.tar.gz" |
---|
| 633 | tar xf "$bench.tar.gz" |
---|
[4210] | 634 | |
---|
[4891] | 635 | if [[ $cosp = "v1" || $cosp = "v2" ]]; then |
---|
| 636 | cd "BENCH${grid_resolution}" |
---|
| 637 | # copier les fichiers namelist input et output our COSP |
---|
| 638 | cp ../DefLists/cosp*_input_nl.txt . |
---|
| 639 | cp ../DefLists/cosp*_output_nl.txt . |
---|
| 640 | # Activer la cles ok_cosp pour tourner avec COSP |
---|
| 641 | sed -e 's@ok_cosp=n@ok_cosp=y@' config.def > tmp |
---|
| 642 | \mv -f tmp config.def |
---|
| 643 | cd .. |
---|
| 644 | fi |
---|
[4210] | 645 | |
---|
[4891] | 646 | if [[ -n "$physiq" ]]; then |
---|
| 647 | cd "BENCH${grid_resolution}" |
---|
| 648 | if [[ -f "physiq.def_${physiq}" ]]; then |
---|
| 649 | cp "physiq.def_${physiq}" physiq.def |
---|
| 650 | echo "using physiq.def_${physiq}" |
---|
| 651 | else |
---|
| 652 | echo "using standard physiq.def" |
---|
| 653 | fi |
---|
| 654 | cd .. |
---|
[4405] | 655 | else |
---|
[4891] | 656 | echo "using standard physiq.def" |
---|
[4405] | 657 | fi |
---|
[4210] | 658 | |
---|
[4891] | 659 | if [[ $with_xios = 1 ]]; then |
---|
| 660 | cd "BENCH${grid_resolution}" |
---|
| 661 | cp ../DefLists/iodef.xml . |
---|
| 662 | cp ../DefLists/context_lmdz.xml . |
---|
| 663 | cp ../DefLists/field_def_lmdz.xml . |
---|
| 664 | # A raffiner par la suite |
---|
| 665 | echo "A FAIRE : Copier les *xml en fonction de l option cosp" |
---|
| 666 | cp ../DefLists/field_def_cosp*.xml . |
---|
| 667 | cp ../DefLists/file_def_hist*xml . |
---|
| 668 | # adapt iodef.xml to use attached mode |
---|
| 669 | sed -e 's@"using_server" type="bool">true@"using_server" type="bool">false@' \ |
---|
| 670 | iodef.xml > tmp |
---|
| 671 | \mv -f tmp iodef.xml |
---|
[4210] | 672 | |
---|
[4891] | 673 | # and convert all the enabled="_AUTO_" (for libIGCM) to enabled=.FALSE. |
---|
| 674 | # except for histday |
---|
| 675 | for histfile in file_def_hist*xml |
---|
| 676 | do |
---|
| 677 | if [[ "$histfile" = "file_def_histday_lmdz.xml" ]]; then |
---|
| 678 | sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".TRUE."@' \ |
---|
| 679 | "$histfile" > tmp |
---|
| 680 | \mv -f tmp "$histfile" |
---|
| 681 | sed -e 's@output_level="_AUTO_"@output_level="5"@' "$histfile" \ |
---|
| 682 | > tmp |
---|
| 683 | \mv -f tmp "$histfile" |
---|
| 684 | sed -e 's@compression_level="2"@compression_level="0"@' \ |
---|
| 685 | "$histfile" > tmp |
---|
| 686 | \mv -f tmp "$histfile" |
---|
| 687 | else |
---|
| 688 | sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".FALSE."@' \ |
---|
| 689 | "$histfile" > tmp |
---|
| 690 | \mv -f tmp "$histfile" |
---|
| 691 | fi |
---|
| 692 | done |
---|
| 693 | # and add option "ok_all_xml=y" in config.def |
---|
| 694 | echo "### XIOS outputs" >> config.def |
---|
| 695 | echo 'ok_all_xml=.true.' >> config.def |
---|
| 696 | |
---|
| 697 | #activer les sorties pour Cosp |
---|
| 698 | if [[ "$cosp" = "v1" ]]; then |
---|
| 699 | sed -i'' -e 's@enabled=".FALSE."@enabled=".TRUE."@' \ |
---|
| 700 | -e 's@output_level="_AUTO_"@output_level="5"@' \ |
---|
| 701 | -e 's@compression_level="2"@compression_level="0"@' \ |
---|
| 702 | file_def_histdayCOSP_lmdz.xml |
---|
[4405] | 703 | fi |
---|
[4891] | 704 | if [[ "$cosp" = "v2" ]]; then |
---|
| 705 | sed -e 's@compression_level="2"@compression_level="0"@' file_def_histdayCOSPv2_lmdz.xml |
---|
| 706 | for type_ in hf day mth; do |
---|
| 707 | file=file_def_hist${type_}COSP |
---|
| 708 | sed -i'' -e 's@src="./'${file}'_lmdz.xml"@src="./'${file}'v2_lmdz.xml"@' context_lmdz.xml |
---|
| 709 | done |
---|
| 710 | sed -i '' -e 's@field_def_cosp1.xml@field_def_cospv2.xml@' field_def_lmdz.xml |
---|
| 711 | fi |
---|
[4210] | 712 | |
---|
[4891] | 713 | cd .. |
---|
[4405] | 714 | fi |
---|
[4891] | 715 | |
---|
| 716 | # Cas Bench avec ecrad |
---|
| 717 | if [[ $rad = "ecrad" ]]; then |
---|
| 718 | cd "BENCH${grid_resolution}" |
---|
| 719 | cp ../DefLists/namelist_ecrad . |
---|
| 720 | cp -r ../libf/phylmd/ecrad/data . |
---|
| 721 | cd .. |
---|
[4405] | 722 | fi |
---|
[4210] | 723 | |
---|
[4891] | 724 | # Adjusting bench physiq.def to radiative code chosen |
---|
| 725 | cd "BENCH${grid_resolution}" |
---|
| 726 | sed -e 's/iflag_rrtm=.*.$/iflag_rrtm='$iflag_rrtm'/' \ |
---|
| 727 | -e 's/NSW=.*.$/NSW='$NSW'/' physiq.def > tmpdef |
---|
| 728 | \mv tmpdef physiq.def |
---|
[4405] | 729 | cd .. |
---|
[4210] | 730 | |
---|
[4891] | 731 | cp "$exe_name" "BENCH${grid_resolution}/gcm.e" |
---|
[4849] | 732 | cd "BENCH${grid_resolution}" |
---|
[4210] | 733 | |
---|
[4891] | 734 | if [[ ${parallel:0:3} = "mpi" ]]; then |
---|
| 735 | # Lancement avec deux procs mpi et 2 openMP |
---|
| 736 | echo "export OMP_STACKSIZE=800M" > bench.sh |
---|
| 737 | if [[ "${parallel:4:3}" = "omp" ]]; then |
---|
| 738 | echo "export OMP_NUM_THREADS=2" >> bench.sh |
---|
| 739 | fi |
---|
| 740 | if [[ "$cosp" = "v1" || "$cosp" = "v2" ]]; then |
---|
| 741 | echo "ulimit -s 200000" >> bench.sh |
---|
[4215] | 742 | else |
---|
[4891] | 743 | echo "ulimit -s unlimited" >> bench.sh |
---|
| 744 | fi |
---|
| 745 | echo "mpirun -np 2 gcm.e > listing 2>&1" >> bench.sh |
---|
| 746 | # Add rebuild, using reb.sh if it is there |
---|
| 747 | cat <<EOF >> bench.sh |
---|
| 748 | if [[ -f reb.sh ]]; then |
---|
| 749 | ./reb.sh histday; ./reb.sh histmth; ./reb.sh histhf; |
---|
| 750 | ./reb.sh histins; ./reb.sh stomate_history; |
---|
| 751 | ./reb.sh sechiba_history; ./reb.sh sechiba_out_2 |
---|
| 752 | fi |
---|
| 753 | EOF |
---|
[4405] | 754 | else |
---|
[4891] | 755 | echo "./gcm.e > listing 2>&1" > bench.sh |
---|
[4405] | 756 | fi |
---|
[4891] | 757 | # Getting orchidee stuff |
---|
| 758 | if [[ $veget = 'CMIP6' ]]; then |
---|
| 759 | echo 'myget 3DBenchs/BENCHCMIP6.tar.gz' |
---|
| 760 | myget 3DBenchs/BENCHCMIP6.tar.gz |
---|
| 761 | tar xvzf BENCHCMIP6.tar.gz |
---|
| 762 | sed -e "s:VEGET=n:VEGET=y:" config.def > tmp |
---|
| 763 | mv -f tmp config.def |
---|
| 764 | if [[ $with_xios = 1 ]]; then |
---|
| 765 | cp ../../ORCHIDEE/src_xml/context_orchidee.xml . |
---|
| 766 | echo '<context id="orchidee" src="./context_orchidee.xml"/>' > add.tmp |
---|
| 767 | cp ../../ORCHIDEE/src_xml/field_def_orchidee.xml . |
---|
| 768 | cp ../../ORCHIDEE/src_xml/file_def_orchidee.xml . |
---|
| 769 | cp ../../ORCHIDEE/src_xml/file_def_input_orchidee.xml . |
---|
| 770 | if [[ -f ../../ORCHIDEE/src_xml/context_input_orchidee.xml ]]; then |
---|
| 771 | cp ../../ORCHIDEE/src_xml/context_input_orchidee.xml . |
---|
| 772 | echo '<context id="orchidee" src="./context_input_orchidee.xml"/>' >> add.tmp |
---|
| 773 | fi |
---|
| 774 | sed -e '/id="LMDZ"/r add.tmp' iodef.xml > tmp |
---|
| 775 | mv tmp iodef.xml |
---|
| 776 | sed -e'{/sechiba1/ s/enabled="_AUTO_"/type="one_file" enabled=".TRUE."/}' \ |
---|
| 777 | file_def_orchidee.xml > tmp |
---|
| 778 | \mv -f tmp file_def_orchidee.xml |
---|
| 779 | sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".FALSE."@' \ |
---|
| 780 | file_def_orchidee.xml > tmp |
---|
| 781 | \mv -f tmp file_def_orchidee.xml |
---|
| 782 | sed -e 's@output_level="_AUTO_"@output_level="1"@' \ |
---|
| 783 | file_def_orchidee.xml > tmp |
---|
| 784 | \mv -f tmp file_def_orchidee.xml |
---|
| 785 | sed -e 's@output_freq="_AUTO_"@output_freq="1d"@' \ |
---|
| 786 | file_def_orchidee.xml > tmp |
---|
| 787 | \mv -f tmp file_def_orchidee.xml |
---|
| 788 | sed -e 's@compression_level="4"@compression_level="0"@' \ |
---|
| 789 | file_def_orchidee.xml > tmp |
---|
| 790 | \mv -f tmp file_def_orchidee.xml |
---|
| 791 | sed -e 's@XIOS_ORCHIDEE_OK = n@XIOS_ORCHIDEE_OK = y@' \ |
---|
| 792 | orchidee.def > tmp |
---|
| 793 | \mv -f tmp orchidee.def |
---|
[4215] | 794 | fi |
---|
[4405] | 795 | fi |
---|
[4220] | 796 | |
---|
[4891] | 797 | if [[ -f ../arch.env ]]; then source ../arch.env; fi |
---|
[4220] | 798 | |
---|
[4891] | 799 | echo "EXECUTION DU BENCH" |
---|
| 800 | date |
---|
| 801 | if (! ./bench.sh > out.bench 2>&1) || ! (tail -n 1 listing | grep "Everything is cool"); then |
---|
| 802 | tail listing |
---|
| 803 | echo "Bench FAILED, exiting"; exit 1 |
---|
| 804 | fi |
---|
| 805 | date |
---|
| 806 | tail listing |
---|
[4215] | 807 | fi |
---|
[4210] | 808 | |
---|
[4891] | 809 | # 1D case |
---|
| 810 | if [[ $SCM = 1 ]]; then |
---|
| 811 | cd "$MODEL" |
---|
| 812 | myget 1D/1D.tar.gz |
---|
| 813 | tar xf 1D.tar.gz |
---|
| 814 | cd 1D |
---|
| 815 | if [[ $rad = "oldrad" ]]; then |
---|
| 816 | sed -i'' -e 's/^rad=.*$/rad=oldrad/' run.sh |
---|
| 817 | sed -i'' -e 's/^rad=.*$/rad=oldrad/' bin/compile |
---|
| 818 | fi |
---|
| 819 | echo "Running 1D/run.sh, log in $(pwd)/run1d.log" |
---|
| 820 | ./run.sh > "$(pwd)/run1d.log" 2>&1 |
---|
[4422] | 821 | fi |
---|
[4891] | 822 | } |
---|
[4210] | 823 | |
---|
[4891] | 824 | echo "install_lmdz.sh DEBUT $(date)" |
---|
[4409] | 825 | |
---|
[4891] | 826 | set_default_params |
---|
| 827 | read_cmdline_args "$@" |
---|
| 828 | #download_model |
---|
| 829 | download_model_AMAURY |
---|
| 830 | install_arch |
---|
| 831 | check_available_software |
---|
| 832 | install_netcdf |
---|
| 833 | install_IOIPSL |
---|
[4893] | 834 | install_XIOS |
---|
[4891] | 835 | compile_orchidee |
---|
| 836 | compile_lmdz |
---|
| 837 | run_bench |
---|