[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 | # TODO >:c ugly fdefault-real-8 fix |
---|
| 329 | sed -i'' -e "s/%COMPILER/%FCOMPILER/" -e "s/%LINK/%LINKER/" -e "s/-fdefault-real-8//" "$MODEL/modipsl/modeles/XIOS/arch/arch-$arch.fcm" |
---|
[4871] | 330 | } |
---|
| 331 | |
---|
[4862] | 332 | function install_netcdf { |
---|
| 333 | echo "Installing Netcdf" |
---|
[4210] | 334 | |
---|
[4862] | 335 | if [[ $netcdf = 0 ]]; then |
---|
| 336 | ncdfdir=$(nc-config --prefix) |
---|
| 337 | else |
---|
| 338 | cd "$MODEL" |
---|
[4210] | 339 | |
---|
[4862] | 340 | case $compiler in |
---|
| 341 | gfortran) opt1="-compiler gnu"; opt2="-CC gcc -FC gfortran -CXX g++";; |
---|
| 342 | ifort) opt1="-compiler intel"; opt2="-CC icc -FC ifort -CXX icpc";; |
---|
| 343 | pgf90) opt1="-compiler pgf90"; opt2="-CC pgcc -FC pgf90 -CXX pgCC";; |
---|
[4890] | 344 | *) echo "unexpected compiler $compiler for netcdf"; exit 1 |
---|
[4862] | 345 | esac |
---|
[4210] | 346 | |
---|
[4862] | 347 | case $with_xios in |
---|
[4891] | 348 | 0) script_install_netcdf="install_netcdf4_hdf5_seq.bash" |
---|
[4862] | 349 | ncdfdir="netcdf4_hdf5_seq" |
---|
| 350 | opt_="$opt1";; |
---|
[4891] | 351 | 1) script_install_netcdf="install_netcdf4_hdf5.bash" |
---|
[4862] | 352 | ncdfdir="netcdf4_hdf5" |
---|
| 353 | opt_="$opt2 -MPI $root_mpi";; |
---|
[4891] | 354 | *) echo "with_xios=$with_xios, should be 0 or 1"; exit 1 |
---|
[4862] | 355 | esac |
---|
| 356 | if [[ $netcdf = 1 ]]; then |
---|
| 357 | ncdfdir="$MODEL/$ncdfdir" |
---|
| 358 | else |
---|
| 359 | mkdir -p "$netcdf"; ncdfdir="$netcdf/$ncdfdir" |
---|
| 360 | fi |
---|
[4210] | 361 | |
---|
[4862] | 362 | echo "Repertoire netcdf $ncdfdir" |
---|
| 363 | if [[ ! -d $ncdfdir ]]; then |
---|
| 364 | netcdflog=$(pwd)/netcdf.log |
---|
| 365 | echo "----------------------------------------------------------" |
---|
| 366 | echo "Compiling the Netcdf library" |
---|
| 367 | echo "----------------------------------------------------------" |
---|
| 368 | echo "log file : $netcdflog" |
---|
| 369 | myget script_install/$script_install_netcdf >> "$netcdflog" 2>&1 |
---|
| 370 | chmod u=rwx $script_install_netcdf |
---|
| 371 | # shellcheck disable=SC2086 |
---|
| 372 | ./$script_install_netcdf -prefix "$ncdfdir" $opt_ >> "$netcdflog" 2>&1 |
---|
[4405] | 373 | fi |
---|
[4210] | 374 | |
---|
[4862] | 375 | #---------------------------------------------------------------------------- |
---|
| 376 | # LF rajout d'une verrue, pour une raison non encore expliquee, |
---|
| 377 | # la librairie est parfois rangée dans lib64 et non dans lib |
---|
| 378 | # par certains compilateurs |
---|
| 379 | if [[ ! -e lib && -d lib64 ]]; then ln -s lib64 lib; fi |
---|
| 380 | #---------------------------------------------------------------------------- |
---|
[4210] | 381 | |
---|
[4862] | 382 | echo "install_lmdz.sh netcdf_OK $(date)" |
---|
| 383 | fi |
---|
[4210] | 384 | |
---|
[4862] | 385 | cat >test_netcdf90.f90 <<EOF |
---|
| 386 | use netcdf |
---|
| 387 | print *, "NetCDF library version: ", nf90_inq_libvers() |
---|
| 388 | end |
---|
| 389 | EOF |
---|
[4546] | 390 | |
---|
[4862] | 391 | if $compiler -I"$ncdfdir"/include test_netcdf90.f90 -L"$ncdfdir"/lib -lnetcdff \ |
---|
| 392 | -lnetcdf -Wl,-rpath="$ncdfdir"/lib && ./a.out |
---|
| 393 | then |
---|
| 394 | \rm test_netcdf90.f90 a.out |
---|
[4546] | 395 | else |
---|
[4862] | 396 | cat <<EOF |
---|
| 397 | Failed test program using NetCDF-Fortran. You can: |
---|
| 398 | - check that you have NetCDF-Fortran installed in your system |
---|
| 399 | - or specify an installation directory with option -netcdf of install_lmdz.sh |
---|
| 400 | - or download and compile NetCDF-Fortran with option -netcdf 1 of nstall_lmdz.sh |
---|
| 401 | EOF |
---|
| 402 | exit 1 |
---|
[4546] | 403 | fi |
---|
[4891] | 404 | |
---|
| 405 | # Compile NetCDF95 |
---|
| 406 | cd "$MODEL/modipsl/modeles/LMD"* |
---|
| 407 | echo "Installing NetCDF95" |
---|
| 408 | cd "$MODEL" |
---|
| 409 | myget src_archives/netcdf/NetCDF95-0.3.tar.gz |
---|
| 410 | tar -xf NetCDF95-0.3.tar.gz |
---|
| 411 | \rm NetCDF95-0.3.tar.gz |
---|
| 412 | cd NetCDF95-0.3 |
---|
| 413 | mkdir -p build && cd build |
---|
| 414 | 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" |
---|
| 415 | make install |
---|
[4862] | 416 | } |
---|
[4405] | 417 | |
---|
[4862] | 418 | function install_IOIPSL { # via fcm |
---|
| 419 | cd "$MODEL/modipsl/modeles/IOIPSL" |
---|
| 420 | ioipsllog="$(pwd)/ioipsl.log" |
---|
| 421 | echo "Compiling IOIPSL, the interface library with Netcdf $(date) (log: $ioipsllog)" |
---|
[4405] | 422 | |
---|
[4890] | 423 | if ! ./makeioipsl_fcm -arch "$arch" -job 8 > "$ioipsllog" 2>&1; then |
---|
| 424 | echo "IOIPSL compile failed, exiting"; exit 1 |
---|
[4862] | 425 | fi |
---|
| 426 | cp lib/* ../../lib |
---|
| 427 | echo "IOIPSL compiled $(date)" |
---|
[4873] | 428 | |
---|
[4891] | 429 | IOIPSL_LIBDIR_="$MODEL/modipsl/modeles/IOIPSL/lib" |
---|
| 430 | IOIPSL_INCDIR_="$MODEL/modipsl/modeles/IOIPSL/inc" |
---|
[4862] | 431 | } |
---|
[4210] | 432 | |
---|
[4871] | 433 | function install_XIOS { |
---|
[4891] | 434 | if [[ $with_xios = 1 ]]; then |
---|
[4871] | 435 | cd "$MODEL/modipsl/modeles" |
---|
[4893] | 436 | xioslog="$(pwd)/XIOS/xios.log" |
---|
[4871] | 437 | echo "##########################################################" |
---|
| 438 | echo "Compiling XIOS (log $xioslog) $(date)" |
---|
| 439 | echo "##########################################################" |
---|
| 440 | |
---|
[4873] | 441 | # Download XIOS |
---|
| 442 | case $xios_branch in |
---|
| 443 | "trunk") |
---|
| 444 | xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/trunk";; |
---|
| 445 | "2.5") |
---|
| 446 | xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/branchs/xios-2.5";; |
---|
| 447 | "2.6") |
---|
| 448 | xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.6";; |
---|
| 449 | *) echo "XIOS: Error, bad argument for -branch ! Did not expect $xios_branch"; exit;; |
---|
| 450 | esac |
---|
| 451 | |
---|
| 452 | cd "$MODEL/modipsl/modeles" |
---|
| 453 | set +e; svn co --revision $xios_rev $xios_http XIOS; set -e |
---|
| 454 | |
---|
| 455 | cd XIOS |
---|
[4893] | 456 | if ! ./make_xios --arch "$arch" --job 8 > "$xioslog" 2>&1; then |
---|
[4871] | 457 | echo "XIOS compilation failed, exiting"; exit 1 |
---|
| 458 | fi |
---|
| 459 | |
---|
| 460 | echo "Compiled XIOS $(date)" |
---|
| 461 | fi |
---|
[4893] | 462 | |
---|
| 463 | XIOS_LIBDIR_="$MODEL/modipsl/modeles/XIOS/lib" |
---|
| 464 | XIOS_INCDIR_="$MODEL/modipsl/modeles/XIOS/inc" |
---|
[4871] | 465 | } |
---|
| 466 | |
---|
[4873] | 467 | function get_orchidee_version { # Set / Check ORCHIDEE version |
---|
[4891] | 468 | if [[ $veget = "none" ]]; then |
---|
| 469 | veget_version="false" |
---|
| 470 | elif [[ $veget = "CMIP6" ]]; then |
---|
| 471 | veget_version=orchidee2.0 |
---|
| 472 | else # specific orchidee revision newer than CMIP6, on 2_1 or 2_2 branches |
---|
| 473 | veget_version=orchidee2.1 |
---|
| 474 | if [[ $veget -lt 4465 ]]; then |
---|
| 475 | echo 'ORCHIDEE version must be >=4465, exiting' |
---|
| 476 | exit 1 |
---|
| 477 | fi |
---|
[4873] | 478 | |
---|
[4891] | 479 | set +e |
---|
| 480 | svn upgrade |
---|
| 481 | local orcbranch |
---|
| 482 | 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}') |
---|
| 483 | echo "IF YOU INSTALL ORCHIDEE THE VERY FIRST TIME, ASK for PASSWORD at orchidee-help@listes.ipsl.fr" |
---|
| 484 | svn switch -r "$veget" --accept theirs-full "svn://forge.ipsl.jussieu.fr/orchidee/$orcbranch" |
---|
| 485 | svn log -r "$veget" | grep "$veget" |
---|
| 486 | if ! svn log -r "$veget" | grep "$veget"; then |
---|
| 487 | echo 'Cannot update ORCHIDEE as not on the right branch for ORCHIDEE' |
---|
| 488 | exit 1 |
---|
| 489 | fi |
---|
| 490 | svn update -r "$veget" |
---|
| 491 | set -e |
---|
[4873] | 492 | fi |
---|
| 493 | } |
---|
| 494 | |
---|
[4891] | 495 | function compile_orchidee { |
---|
| 496 | get_orchidee_version |
---|
| 497 | ORCHPATH="" |
---|
[4873] | 498 | |
---|
| 499 | |
---|
[4891] | 500 | if [[ $veget != "none" ]]; then |
---|
| 501 | cd "$MODEL/modipsl/modeles/ORCHIDEE" |
---|
| 502 | ORCHPATH=$(pwd) |
---|
[4873] | 503 | |
---|
[4891] | 504 | orchideelog="$(pwd)/orchidee.log" |
---|
| 505 | echo "Compiling ORCHIDEE, the continental surface model (log $orchideelog) $(date)" |
---|
[4873] | 506 | |
---|
[4891] | 507 | local xios_orchid opt_orc |
---|
| 508 | if [[ $with_xios = 1 ]]; then |
---|
| 509 | xios_orchid="-xios"; |
---|
| 510 | else |
---|
| 511 | xios_orchid="-noxios" |
---|
[4405] | 512 | fi |
---|
[4891] | 513 | if [[ $optim_debug = "-debug" ]]; then |
---|
| 514 | opt_orc="-debug"; |
---|
| 515 | else |
---|
| 516 | opt_orc="-prod" |
---|
| 517 | fi |
---|
[4210] | 518 | |
---|
[4891] | 519 | # TODO check that this works with old orchidee versions (cf. -d tools) |
---|
| 520 | local varenv="IOIPSL_LIBDIR_=$IOIPSL_LIBDIR_ IOIPSL_INCDIR_=$IOIPSL_INCDIR_ ORCHPATH=$ORCHPATH" |
---|
| 521 | if [[ $parallel = "none" ]]; then |
---|
[4893] | 522 | echo "$varenv ./makeorchidee_fcm $xios_orchid $opt_orc -parallel none -arch $arch -j $make_j" > compile.sh |
---|
[4891] | 523 | else |
---|
| 524 | if [[ ! -d src_parallel ]]; then |
---|
| 525 | echo "Orchidee version too old for parallel support"; exit 1 |
---|
[4405] | 526 | fi |
---|
[4891] | 527 | { |
---|
[4893] | 528 | echo "$varenv ./makeorchidee_fcm -j $make_j -clean $xios_orchid $opt_orc -parallel $parallel -arch $arch" |
---|
| 529 | echo "$varenv ./makeorchidee_fcm -j $make_j $xios_orchid $opt_orc -parallel $parallel -arch $arch" |
---|
[4891] | 530 | } > compile.sh |
---|
[4405] | 531 | fi |
---|
[4891] | 532 | chmod +x compile.sh |
---|
| 533 | echo "Compiling ORCHIDEE using $(\cat compile.sh)" |
---|
| 534 | if ! ./compile.sh > "$orchideelog" 2>&1; then |
---|
| 535 | echo "ORCHIDEE compilation failed, exiting"; exit 1 |
---|
| 536 | fi |
---|
| 537 | echo "Compiled ORCHIDEE $(date)" |
---|
[4210] | 538 | fi |
---|
| 539 | |
---|
[4891] | 540 | ORCH_LIBDIR_="$MODEL/modipsl/modeles/ORCHIDEE/lib" |
---|
| 541 | } |
---|
[4210] | 542 | |
---|
[4891] | 543 | function get_lmdz_version { |
---|
| 544 | LMDZPATH=$(readlink -f "$MODEL/modipsl/modeles/LMD"*) |
---|
| 545 | cd "$LMDZPATH" |
---|
| 546 | lmdzlog="$(pwd)/lmdz.log" |
---|
[4372] | 547 | |
---|
[4891] | 548 | set +e |
---|
| 549 | svn upgrade |
---|
| 550 | if [[ $svn = "last" ]]; then |
---|
| 551 | svnopt="" |
---|
[4427] | 552 | else |
---|
[4891] | 553 | svnopt="-r $svn" |
---|
[4427] | 554 | fi |
---|
[4891] | 555 | if [[ $svn != "" ]]; then |
---|
| 556 | if svn info | grep -q 'https:'; then svn switch --relocate https://svn.lmd.jussieu.fr/LMDZ http://svn.lmd.jussieu.fr/LMDZ; fi |
---|
| 557 | svn update "$svnopt" |
---|
| 558 | fi |
---|
| 559 | mysvn=$(svnversion . | grep -E -o "[0-9]+" 2>/dev/null) |
---|
| 560 | set -e |
---|
[4427] | 561 | |
---|
[4891] | 562 | if [[ $mysvn = "" ]]; then mysvn=$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null); fi |
---|
| 563 | if [[ $mysvn = "" ]]; then mysvn=4190; fi |
---|
| 564 | } |
---|
[4427] | 565 | |
---|
[4891] | 566 | function compile_lmdz { |
---|
| 567 | get_lmdz_version |
---|
[4427] | 568 | |
---|
[4891] | 569 | exe_name="bin/gcm_${grid_resolution}_phylmd_${rad}${suff_exe}${suff_orc}.e" |
---|
[4210] | 570 | |
---|
[4891] | 571 | local opt_rad |
---|
| 572 | case $rad in |
---|
| 573 | oldrad) iflag_rrtm=0; NSW=2; opt_rad="";; |
---|
| 574 | rrtm) iflag_rrtm=1; NSW=6 |
---|
[4849] | 575 | if [[ $mysvn -le 4185 ]]; then |
---|
[4405] | 576 | opt_rad="-rrtm true" |
---|
| 577 | else |
---|
| 578 | opt_rad="-rad rrtm" |
---|
[4849] | 579 | fi;; |
---|
[4891] | 580 | ecrad) iflag_rrtm=2; NSW=6; opt_rad="-rad ecrad";; |
---|
| 581 | *) echo "Only oldrad rrtm ecrad for rad option"; exit 1 |
---|
| 582 | esac |
---|
| 583 | if [[ $mysvn -le 4185 && $rad = "ecrad" ]]; then |
---|
| 584 | echo "ecrad only available for LMDZ rev starting with 4186 "; exit 1 |
---|
[4215] | 585 | fi |
---|
[4210] | 586 | |
---|
[4891] | 587 | # Compile |
---|
[4893] | 588 | local varenv="IOIPSL_LIBDIR_=$IOIPSL_LIBDIR_ IOIPSL_INCDIR_=$IOIPSL_INCDIR_ ORCH_LIBDIR_=$ORCH_LIBDIR_ ORCHPATH=$ORCHPATH XIOS_INCDIR_=$XIOS_INCDIR_ XIOS_LIBDIR_=$XIOS_LIBDIR_" |
---|
| 589 | makelmdz="makelmdz_fcm $optim_debug -arch $arch -j $make_j" |
---|
[4891] | 590 | if [[ $parallel = "none" ]]; then |
---|
| 591 | echo "$varenv ./$makelmdz $opt_rad $opt_cosp -d ${grid_resolution} -v $veget_version gcm " > compile.sh |
---|
[4215] | 592 | else |
---|
[4891] | 593 | echo "$varenv ./$makelmdz $opt_rad $opt_cosp $opt_makelmdz_xios -d ${grid_resolution} -v $veget_version -mem -parallel $parallel gcm" > compile.sh |
---|
[4215] | 594 | fi |
---|
[4891] | 595 | echo "Compiling lmdz using $(\cat compile.sh) (log: $lmdzlog) $(date)" |
---|
[4215] | 596 | chmod +x ./compile.sh |
---|
[4891] | 597 | if ! ./compile.sh > "$lmdzlog" 2>&1; then |
---|
| 598 | echo "LMDZ compilation failed, exiting"; exit 1 |
---|
[4215] | 599 | fi |
---|
[4891] | 600 | echo "Finished LMDZ compilation $(date)" |
---|
[4215] | 601 | |
---|
[4891] | 602 | # Check executable |
---|
| 603 | # TODO $mysev -ge 4186 => other name convention ! check original install |
---|
| 604 | if [[ ! -f $exe_name ]]; then |
---|
| 605 | echo "Compilation failed, can't find the executable"; exit 1 |
---|
[4215] | 606 | else |
---|
[4891] | 607 | echo "Compilation successfull, the executable is $exe_name $(date)" |
---|
[4215] | 608 | fi |
---|
[4891] | 609 | } |
---|
[4210] | 610 | |
---|
[4891] | 611 | function run_bench { |
---|
| 612 | cd "$MODEL/modipsl/modeles/LMDZ"* |
---|
[4210] | 613 | |
---|
[4891] | 614 | if [[ $bench = "tuto" ]]; then |
---|
[4893] | 615 | myget "Training/tutorial.tar"; tar xf tutorial.tar; cd TUTORIAL |
---|
[4891] | 616 | ./init.sh |
---|
| 617 | elif [[ $bench = 1 ]]; then |
---|
| 618 | \rm -rf "BENCH${grid_resolution}" |
---|
| 619 | local bench=bench_lmdz_${grid_resolution} |
---|
| 620 | myget "3DBenchs/$bench.tar.gz" |
---|
| 621 | tar xf "$bench.tar.gz" |
---|
[4210] | 622 | |
---|
[4891] | 623 | if [[ $cosp = "v1" || $cosp = "v2" ]]; then |
---|
| 624 | cd "BENCH${grid_resolution}" |
---|
| 625 | # copier les fichiers namelist input et output our COSP |
---|
| 626 | cp ../DefLists/cosp*_input_nl.txt . |
---|
| 627 | cp ../DefLists/cosp*_output_nl.txt . |
---|
| 628 | # Activer la cles ok_cosp pour tourner avec COSP |
---|
| 629 | sed -e 's@ok_cosp=n@ok_cosp=y@' config.def > tmp |
---|
| 630 | \mv -f tmp config.def |
---|
| 631 | cd .. |
---|
| 632 | fi |
---|
[4210] | 633 | |
---|
[4891] | 634 | if [[ -n "$physiq" ]]; then |
---|
| 635 | cd "BENCH${grid_resolution}" |
---|
| 636 | if [[ -f "physiq.def_${physiq}" ]]; then |
---|
| 637 | cp "physiq.def_${physiq}" physiq.def |
---|
| 638 | echo "using physiq.def_${physiq}" |
---|
| 639 | else |
---|
| 640 | echo "using standard physiq.def" |
---|
| 641 | fi |
---|
| 642 | cd .. |
---|
[4405] | 643 | else |
---|
[4891] | 644 | echo "using standard physiq.def" |
---|
[4405] | 645 | fi |
---|
[4210] | 646 | |
---|
[4891] | 647 | if [[ $with_xios = 1 ]]; then |
---|
| 648 | cd "BENCH${grid_resolution}" |
---|
| 649 | cp ../DefLists/iodef.xml . |
---|
| 650 | cp ../DefLists/context_lmdz.xml . |
---|
| 651 | cp ../DefLists/field_def_lmdz.xml . |
---|
| 652 | # A raffiner par la suite |
---|
| 653 | echo "A FAIRE : Copier les *xml en fonction de l option cosp" |
---|
| 654 | cp ../DefLists/field_def_cosp*.xml . |
---|
| 655 | cp ../DefLists/file_def_hist*xml . |
---|
| 656 | # adapt iodef.xml to use attached mode |
---|
| 657 | sed -e 's@"using_server" type="bool">true@"using_server" type="bool">false@' \ |
---|
| 658 | iodef.xml > tmp |
---|
| 659 | \mv -f tmp iodef.xml |
---|
[4210] | 660 | |
---|
[4891] | 661 | # and convert all the enabled="_AUTO_" (for libIGCM) to enabled=.FALSE. |
---|
| 662 | # except for histday |
---|
| 663 | for histfile in file_def_hist*xml |
---|
| 664 | do |
---|
| 665 | if [[ "$histfile" = "file_def_histday_lmdz.xml" ]]; then |
---|
| 666 | sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".TRUE."@' \ |
---|
| 667 | "$histfile" > tmp |
---|
| 668 | \mv -f tmp "$histfile" |
---|
| 669 | sed -e 's@output_level="_AUTO_"@output_level="5"@' "$histfile" \ |
---|
| 670 | > tmp |
---|
| 671 | \mv -f tmp "$histfile" |
---|
| 672 | sed -e 's@compression_level="2"@compression_level="0"@' \ |
---|
| 673 | "$histfile" > tmp |
---|
| 674 | \mv -f tmp "$histfile" |
---|
| 675 | else |
---|
| 676 | sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".FALSE."@' \ |
---|
| 677 | "$histfile" > tmp |
---|
| 678 | \mv -f tmp "$histfile" |
---|
| 679 | fi |
---|
| 680 | done |
---|
| 681 | # and add option "ok_all_xml=y" in config.def |
---|
| 682 | echo "### XIOS outputs" >> config.def |
---|
| 683 | echo 'ok_all_xml=.true.' >> config.def |
---|
| 684 | |
---|
| 685 | #activer les sorties pour Cosp |
---|
| 686 | if [[ "$cosp" = "v1" ]]; then |
---|
| 687 | sed -i'' -e 's@enabled=".FALSE."@enabled=".TRUE."@' \ |
---|
| 688 | -e 's@output_level="_AUTO_"@output_level="5"@' \ |
---|
| 689 | -e 's@compression_level="2"@compression_level="0"@' \ |
---|
| 690 | file_def_histdayCOSP_lmdz.xml |
---|
[4405] | 691 | fi |
---|
[4891] | 692 | if [[ "$cosp" = "v2" ]]; then |
---|
| 693 | sed -e 's@compression_level="2"@compression_level="0"@' file_def_histdayCOSPv2_lmdz.xml |
---|
| 694 | for type_ in hf day mth; do |
---|
| 695 | file=file_def_hist${type_}COSP |
---|
| 696 | sed -i'' -e 's@src="./'${file}'_lmdz.xml"@src="./'${file}'v2_lmdz.xml"@' context_lmdz.xml |
---|
| 697 | done |
---|
| 698 | sed -i '' -e 's@field_def_cosp1.xml@field_def_cospv2.xml@' field_def_lmdz.xml |
---|
| 699 | fi |
---|
[4210] | 700 | |
---|
[4891] | 701 | cd .. |
---|
[4405] | 702 | fi |
---|
[4891] | 703 | |
---|
| 704 | # Cas Bench avec ecrad |
---|
| 705 | if [[ $rad = "ecrad" ]]; then |
---|
| 706 | cd "BENCH${grid_resolution}" |
---|
| 707 | cp ../DefLists/namelist_ecrad . |
---|
| 708 | cp -r ../libf/phylmd/ecrad/data . |
---|
| 709 | cd .. |
---|
[4405] | 710 | fi |
---|
[4210] | 711 | |
---|
[4891] | 712 | # Adjusting bench physiq.def to radiative code chosen |
---|
| 713 | cd "BENCH${grid_resolution}" |
---|
| 714 | sed -e 's/iflag_rrtm=.*.$/iflag_rrtm='$iflag_rrtm'/' \ |
---|
| 715 | -e 's/NSW=.*.$/NSW='$NSW'/' physiq.def > tmpdef |
---|
| 716 | \mv tmpdef physiq.def |
---|
[4405] | 717 | cd .. |
---|
[4210] | 718 | |
---|
[4891] | 719 | cp "$exe_name" "BENCH${grid_resolution}/gcm.e" |
---|
[4849] | 720 | cd "BENCH${grid_resolution}" |
---|
[4210] | 721 | |
---|
[4891] | 722 | if [[ ${parallel:0:3} = "mpi" ]]; then |
---|
| 723 | # Lancement avec deux procs mpi et 2 openMP |
---|
| 724 | echo "export OMP_STACKSIZE=800M" > bench.sh |
---|
| 725 | if [[ "${parallel:4:3}" = "omp" ]]; then |
---|
| 726 | echo "export OMP_NUM_THREADS=2" >> bench.sh |
---|
| 727 | fi |
---|
| 728 | if [[ "$cosp" = "v1" || "$cosp" = "v2" ]]; then |
---|
| 729 | echo "ulimit -s 200000" >> bench.sh |
---|
[4215] | 730 | else |
---|
[4891] | 731 | echo "ulimit -s unlimited" >> bench.sh |
---|
| 732 | fi |
---|
| 733 | echo "mpirun -np 2 gcm.e > listing 2>&1" >> bench.sh |
---|
| 734 | # Add rebuild, using reb.sh if it is there |
---|
| 735 | cat <<EOF >> bench.sh |
---|
| 736 | if [[ -f reb.sh ]]; then |
---|
| 737 | ./reb.sh histday; ./reb.sh histmth; ./reb.sh histhf; |
---|
| 738 | ./reb.sh histins; ./reb.sh stomate_history; |
---|
| 739 | ./reb.sh sechiba_history; ./reb.sh sechiba_out_2 |
---|
| 740 | fi |
---|
| 741 | EOF |
---|
[4405] | 742 | else |
---|
[4891] | 743 | echo "./gcm.e > listing 2>&1" > bench.sh |
---|
[4405] | 744 | fi |
---|
[4891] | 745 | # Getting orchidee stuff |
---|
| 746 | if [[ $veget = 'CMIP6' ]]; then |
---|
| 747 | echo 'myget 3DBenchs/BENCHCMIP6.tar.gz' |
---|
| 748 | myget 3DBenchs/BENCHCMIP6.tar.gz |
---|
| 749 | tar xvzf BENCHCMIP6.tar.gz |
---|
| 750 | sed -e "s:VEGET=n:VEGET=y:" config.def > tmp |
---|
| 751 | mv -f tmp config.def |
---|
| 752 | if [[ $with_xios = 1 ]]; then |
---|
| 753 | cp ../../ORCHIDEE/src_xml/context_orchidee.xml . |
---|
| 754 | echo '<context id="orchidee" src="./context_orchidee.xml"/>' > add.tmp |
---|
| 755 | cp ../../ORCHIDEE/src_xml/field_def_orchidee.xml . |
---|
| 756 | cp ../../ORCHIDEE/src_xml/file_def_orchidee.xml . |
---|
| 757 | cp ../../ORCHIDEE/src_xml/file_def_input_orchidee.xml . |
---|
| 758 | if [[ -f ../../ORCHIDEE/src_xml/context_input_orchidee.xml ]]; then |
---|
| 759 | cp ../../ORCHIDEE/src_xml/context_input_orchidee.xml . |
---|
| 760 | echo '<context id="orchidee" src="./context_input_orchidee.xml"/>' >> add.tmp |
---|
| 761 | fi |
---|
| 762 | sed -e '/id="LMDZ"/r add.tmp' iodef.xml > tmp |
---|
| 763 | mv tmp iodef.xml |
---|
| 764 | sed -e'{/sechiba1/ s/enabled="_AUTO_"/type="one_file" enabled=".TRUE."/}' \ |
---|
| 765 | file_def_orchidee.xml > tmp |
---|
| 766 | \mv -f tmp file_def_orchidee.xml |
---|
| 767 | sed -e 's@enabled="_AUTO_"@type="one_file" enabled=".FALSE."@' \ |
---|
| 768 | file_def_orchidee.xml > tmp |
---|
| 769 | \mv -f tmp file_def_orchidee.xml |
---|
| 770 | sed -e 's@output_level="_AUTO_"@output_level="1"@' \ |
---|
| 771 | file_def_orchidee.xml > tmp |
---|
| 772 | \mv -f tmp file_def_orchidee.xml |
---|
| 773 | sed -e 's@output_freq="_AUTO_"@output_freq="1d"@' \ |
---|
| 774 | file_def_orchidee.xml > tmp |
---|
| 775 | \mv -f tmp file_def_orchidee.xml |
---|
| 776 | sed -e 's@compression_level="4"@compression_level="0"@' \ |
---|
| 777 | file_def_orchidee.xml > tmp |
---|
| 778 | \mv -f tmp file_def_orchidee.xml |
---|
| 779 | sed -e 's@XIOS_ORCHIDEE_OK = n@XIOS_ORCHIDEE_OK = y@' \ |
---|
| 780 | orchidee.def > tmp |
---|
| 781 | \mv -f tmp orchidee.def |
---|
[4215] | 782 | fi |
---|
[4405] | 783 | fi |
---|
[4220] | 784 | |
---|
[4891] | 785 | if [[ -f ../arch.env ]]; then source ../arch.env; fi |
---|
[4220] | 786 | |
---|
[4891] | 787 | echo "EXECUTION DU BENCH" |
---|
| 788 | date |
---|
| 789 | if (! ./bench.sh > out.bench 2>&1) || ! (tail -n 1 listing | grep "Everything is cool"); then |
---|
| 790 | tail listing |
---|
| 791 | echo "Bench FAILED, exiting"; exit 1 |
---|
| 792 | fi |
---|
| 793 | date |
---|
| 794 | tail listing |
---|
[4215] | 795 | fi |
---|
[4210] | 796 | |
---|
[4891] | 797 | # 1D case |
---|
| 798 | if [[ $SCM = 1 ]]; then |
---|
| 799 | cd "$MODEL" |
---|
| 800 | myget 1D/1D.tar.gz |
---|
| 801 | tar xf 1D.tar.gz |
---|
| 802 | cd 1D |
---|
| 803 | if [[ $rad = "oldrad" ]]; then |
---|
| 804 | sed -i'' -e 's/^rad=.*$/rad=oldrad/' run.sh |
---|
| 805 | sed -i'' -e 's/^rad=.*$/rad=oldrad/' bin/compile |
---|
| 806 | fi |
---|
| 807 | echo "Running 1D/run.sh, log in $(pwd)/run1d.log" |
---|
| 808 | ./run.sh > "$(pwd)/run1d.log" 2>&1 |
---|
[4422] | 809 | fi |
---|
[4891] | 810 | } |
---|
[4210] | 811 | |
---|
[4891] | 812 | echo "install_lmdz.sh DEBUT $(date)" |
---|
[4409] | 813 | |
---|
[4891] | 814 | set_default_params |
---|
| 815 | read_cmdline_args "$@" |
---|
| 816 | #download_model |
---|
| 817 | download_model_AMAURY |
---|
| 818 | install_arch |
---|
| 819 | check_available_software |
---|
| 820 | install_netcdf |
---|
| 821 | install_IOIPSL |
---|
[4893] | 822 | install_XIOS |
---|
[4891] | 823 | compile_orchidee |
---|
| 824 | compile_lmdz |
---|
| 825 | run_bench |
---|