Changeset 4873
- Timestamp:
- Mar 25, 2024, 5:43:22 PM (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BOL/script_install_amaury/install_lmdz.sh
r4871 r4873 57 57 version="20231022.trunk" 58 58 59 getlmdzor=160 59 netcdf=1 # 1: for automatic installation; 61 60 # or 0: do not install NetCDF and look for it in standard locations; 62 61 # or absolute path: look for NetCDF there 63 check_software_linux=164 ioipsl=165 62 bench=1 66 63 pclinux=1 67 64 pcmac=0 # default: not on a Mac 68 compiler="gfortran"69 if [[ $(gfortran -dumpversion | cut -d. -f1) -ge 10 ]]; then allow_arg_mismatch="-fallow-argument-mismatch"; fi70 65 SCM=0 71 66 # surface/vegetation scheme treatment … … 83 78 physiq="" 84 79 80 xios_branch="2.6" 81 xios_rev="2568" 82 85 83 ## parallel can take the values none/mpi/omp/mpi_omp 86 84 parallel="none" # "mpi_omp" 87 85 idris_acct="lmd" 88 86 trusting="testing" 89 OPT_GPROF=""90 OPT_MAKELMDZ=""91 87 MODEL="" 92 88 … … 112 108 113 109 env_file="" 114 optim =""110 optim_debug="" 115 111 arch="local" 116 112 … … 119 115 path_mpi=$(dirname "$mpi_file") 120 116 root_mpi=$(dirname "$path_mpi") 117 118 arch="local-gfortran" 119 arch_dir="" 121 120 } 122 121 … … 129 128 [-name LOCAL_MODEL_NAME] [-gprof] [-opt_makelmdz] [-rad RADIATIF] 130 129 131 -v "version" like 20150828.trunk 132 see http://www.lmd.jussieu.fr/~lmdz/Distrib/LISMOI.trunk 133 134 -r "svn_release" : either the svn release number or "last" 135 136 -compiler gfortran|ifort|pgf90 (default: gfortran) 137 138 -parallel PARA : can be mpi_omp (mpi with openMP) or none (for sequential) 139 140 -d GRID_RESOLUTION should be among the available benchs if -bench 1 141 among which : 48x36x19, 48x36x39 142 if wanting to run a bench simulation in addition to compilation 143 default : 48x36x19 144 145 -bench activating the bench or not (0/1). Default 1 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>) 146 139 147 140 -testing/unstable 148 141 149 -name LOCAL_MODEL_NAME : default = LMDZversion.release 150 151 -netcdf 0, 1 or PATH 152 0: do not download NetCDF, look for it in standard locations 153 1: download and compile NetCDF 154 PATH: full path to an existing installed NetCDF library 155 156 -xios also download and compile the XIOS library 157 (requires the NetCDF4-HDF5 library, also installed by default) 158 (requires to also have -parallel mpi_omp) 159 160 -gprof to compile with -pg to enable profiling with gprof 161 162 -cosp to run without our with cospv1 or cospv2 [none/v1/v2] 163 164 -rad RADIATIF can be oldrad, rrtm or ecrad radiatif code 165 166 -nofcm to compile without fcm 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 167 153 168 154 -SCM install 1D version automatically … … 170 156 -debug compile everything in debug mode 171 157 172 - opt_makelmdz to call makelmdz or makelmdz_fcm with additional options173 174 - physiq to choose which physics package to use175 176 - env_file specify an arch.env file to overwrite the existing one177 178 - veget surface model to run [NONE/CMIP6/xxxx]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>) 179 165 180 166 ........fin … … 182 168 "-v") version=$2; shift; shift;; 183 169 "-r") svn=$2; shift; shift;; 184 "-compiler") compiler=$2185 case $compiler in186 "gfortran"|"ifort"|"pgf90") compiler=$2; shift187 shift;;188 *) echo "Only gfortran , ifort or pgf90 for the " \189 "compiler option"190 exit 1191 esac;;192 170 "-d") grid_resolution=$2; shift; shift;; 193 "-gprof") OPT_GPROF="-pg"; shift;; 194 "-unstable"|"-testing") trusting=$(echo "$1" | cut -c2-) ; shift;; 171 "-unstable"|"-testing") trusting=$(echo "$1" | cut -c2-); shift;; 195 172 "-cosp") cosp=$2 196 173 case $cosp in … … 200 177 "-nofcm") compile_with_fcm=0; echo "This option will be reactivated soon (promesse du 8dec2022)"; exit 1; shift;; 201 178 "-SCM") SCM=1; shift;; 202 "-opt_makelmdz") OPT_MAKELMDZ="$2"; shift; shift;;203 "-rrtm") if [[ $2 = "false" ]]; then204 rad="oldrad"205 else206 rad="rrtm"207 fi208 shift; shift;;209 179 "-rad") rad=$2 210 180 case $rad in … … 218 188 esac;; 219 189 "-bench") bench=$2; shift; shift;; 220 "-debug") optim =-debug; shift;;190 "-debug") optim_debug=-debug; shift;; 221 191 "-name") MODEL=$2; shift; shift;; 222 192 "-netcdf") netcdf=$2; shift; shift;; 223 193 "-physiq") physiq=$2; shift; shift;; 224 194 "-xios") with_xios="y"; shift;; 225 "-env_file") env_file=$2; shift; shift;; 195 "-arch") arch=$2; shift; shift;; 196 "-arch_dir") arch_dir=$2; shift; shift;; 226 197 "-veget") veget=$2; shift; shift;; 227 198 *) bash install_lmdz.sh -h; exit 1 … … 262 233 263 234 #Chemin pour placer le modele 264 if [[ $MODEL = "" ]]; then MODEL="./LMDZ$version$svn$optim "; fi235 if [[ $MODEL = "" ]]; then MODEL="./LMDZ$version$svn$optim_debug"; fi 265 236 266 237 ## if also compiling XIOS, parallel must be mpi_omp … … 276 247 echo "Error, Cospv2 cannot run without Xios"; exit 1 277 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 278 254 } 279 255 280 256 function check_available_software { 281 if [[ $check_software_linux = 1 ]]; then 282 echo "################################################################" 283 echo "Check if required software is available" 284 echo "################################################################" 285 286 for logiciel in wget tar gzip make $compiler gcc cmake m4 c++; do 287 if [[ $(which "$logiciel") = "" ]]; then 288 echo "You must first install $logiciel on your system"; exit 1 289 fi 290 done 291 292 cat <<eod > tt.f90 293 print*,'coucou' 294 end 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 295 269 eod 296 297 298 299 echo "problem installing with compiler $compiler"; exit 1; fi300 \rm tt a.out tt.f90301 fi270 $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 302 276 } 303 277 … … 306 280 MODEL=$(readlink -f "$MODEL"); echo "$MODEL" # absolute path 307 281 308 if [[ $getlmdzor = 1 && ! -d $MODEL/modipsl ]]; then309 echo "##########################################################" 310 echo "Download a slightly modified version of LMDZ"311 echo "##########################################################"312 cd "$MODEL"313 getlog="$(pwd)/get.log"314 echo "logfile : $getlog"315 myget "src_archives/$trusting/modipsl.$version.tar.gz" >> get.log 2>&1316 echo "install_lmdz.sh wget_OK $(date)"317 gunzip "modipsl.$version.tar.gz" >> get.log 2>&1318 tar xf "modipsl.$version.tar" >> get.log 2>&1319 \rm "modipsl.$version.tar"320 fi282 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" 321 295 322 296 if [[ $svn != "" ]]; then … … 328 302 } 329 303 330 function setup_local_arch { 331 # Setup local arch, and correspondance between arch names accross different programs 332 333 case $arch in 334 local) 335 arch_ioipsl="gfortran" 336 arch_xios="local" 337 338 cat <<EOF >"$MODEL/modipsl/modeles/IOIPSL/arch/arch-${arch_ioipsl}.path" # fix bad IOIPSL arch files... 339 NETCDF_INCDIR="\$(nf-config --fflags)" 340 NETCDF_LIBDIR="\$(nf-config --flibs)" 341 EOF 342 ;; 343 *) arch_ioipsl=$arch 344 arch_xios=$arch 345 esac 304 function download_model_AMAURY { 305 MODEL=$(readlink -f "$MODEL"); echo "$MODEL" # absolute path 306 307 if [[ $svn != "" ]]; then 308 mysvn=$svn 309 else 310 mysvn="$(grep 'Revision: [0-9]' "$MODEL"/Read*.md | awk ' { print $2 } ' 2>/dev/null)" 311 fi 312 echo "SVN revision used: $mysvn" 313 } 314 315 function check_arch { 316 # TODO if [[ $(gfortran -dumpversion | cut -d. -f1) -ge 10 ]]; then allow_arg_mismatch="-fallow-argument-mismatch"; fi 317 318 if [[ ! -d $arch_dir ]]; then 319 echo "Error: no arch dir $arch_dir"; exit 1 320 elif [[ ! -f $arch_dir/arch-$arch.path ]]; then 321 echo "Error: no arch-$arch.path in $arch_dir"; exit 1 322 fi 323 324 local fcm_path 325 if [[ -f $arch_dir/arch-$arch.fcm ]]; then 326 fcm_path="$arch_dir/arch-$arch.fcm" 327 else 328 fcm_path="$MODEL/modipsl/modeles/LMDZ/arch/arch-$arch.fcm" 329 if [[ ! -f $fcm_path ]]; then 330 echo "Error: no $fcm_path"; exit 1 331 fi 332 fi 333 334 # check compiler 335 compiler=$(< "$fcm_path" grep "%COMPILER" | sed -e "s/%COMPILER\s*//") 346 336 } 347 337 … … 421 411 422 412 function install_IOIPSL { # via fcm 423 if [[ ! -f $MODEL/modipsl/lib/libioipsl.a ]]; then424 413 cd "$MODEL/modipsl/modeles/IOIPSL" 425 414 ioipsllog="$(pwd)/ioipsl.log" 426 415 echo "Compiling IOIPSL, the interface library with Netcdf $(date) (log: $ioipsllog)" 427 416 428 if ! ./makeioipsl_fcm -arch "$arch _ioipsl" -job 8 > "$ioipsllog" 2>&1; then429 417 if ! ./makeioipsl_fcm -arch "$arch" -arch_path "$arch_dir" -job 8 > "$ioipsllog" 2>&1; then 418 echo "IOIPSL compile failed, exiting"; exit 1 430 419 fi 431 420 cp lib/* ../../lib 432 421 echo "IOIPSL compiled $(date)" 433 fi 422 423 export IOIPSL_LIBDIR="$MODEL/modipsl/modeles/IOIPSL/lib" 424 export IOIPSL_INCDIR="$MODEL/modipsl/modeles/IOIPSL/inc" 434 425 } 435 426 436 427 function install_XIOS { 437 if [[ $with_xios = "y" && ! -f "$MODEL/modipsl/modeles/XIOS/lib/libxios.a"]]; then428 if [[ $with_xios = "y" ]]; then 438 429 cd "$MODEL/modipsl/modeles" 439 430 xioslog="$(pwd)/xios.log" … … 441 432 echo "Compiling XIOS (log $xioslog) $(date)" 442 433 echo "##########################################################" 443 myget script_install/install_xios.bash 444 445 if ! ./install_xios.bash -prefix "$MODEL/modipsl/modeles" -arch "$arch_xios" > "$xioslog" 2>&1; then 434 435 # Download XIOS 436 case $xios_branch in 437 "trunk") 438 xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/trunk";; 439 "2.5") 440 xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS/branchs/xios-2.5";; 441 "2.6") 442 xios_http="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS2/branches/xios-2.6";; 443 *) echo "XIOS: Error, bad argument for -branch ! Did not expect $xios_branch"; exit;; 444 esac 445 446 cd "$MODEL/modipsl/modeles" 447 set +e; svn co --revision $xios_rev $xios_http XIOS; set -e 448 449 cd XIOS 450 if ! ./make_xios --arch "$arch" --job 8 --arch_path "$arch_dir" > "$xioslog" 2>&1; then 446 451 echo "XIOS compilation failed, exiting"; exit 1 447 452 fi … … 449 454 echo "Compiled XIOS $(date)" 450 455 fi 456 } 457 458 function get_orchidee_version { # Set / Check ORCHIDEE version 459 if [[ $veget = "NONE" ]]; then 460 veget_version="false" 461 elif [[ $veget = "CMIP6" ]]; then 462 veget_version=orchidee2.0 463 orchidee_rev=6592 464 else # specific orchidee revision newer than CMIP6, on 2_1 or 2_2 branches 465 veget_version=orchidee2.1 466 orchidee_rev="$veget" 467 if [[ $veget -lt 4465 ]]; then 468 echo 'ORCHIDEE version must be >=4465, exiting' 469 exit 1 470 fi 471 472 set +e 473 svn upgrade 474 local orcbranch 475 orcbranch=$(svn log -v -q svn://forge.ipsl.jussieu.fr/orchidee/ -r "$veget" |grep ORCHIDEE |head -1| sed -e 's:ORCHIDEE/.*$:ORCHIDEE:' | awk '{print $2}') 476 echo "IF YOU INSTALL ORCHIDEE THE VERY FIRST TIME, ASK for PASSWORD at orchidee-help@listes.ipsl.fr" 477 svn switch -r "$veget" --accept theirs-full "svn://forge.ipsl.jussieu.fr/orchidee/$orcbranch" 478 svn log -r "$veget" | grep "$veget" 479 if ! svn log -r "$veget" | grep "$veget"; then 480 echo 'Cannot update ORCHIDEE as not on the right branch for ORCHIDEE' 481 exit 1 482 fi 483 svn update -r "$veget" 484 set -e 485 fi 486 } 487 488 function compile_orchidee_seq { 489 get_orchidee_version 490 491 if [[ $veget != "NONE" ]]; then 492 cd "$MODEL/modipsl/modeles/ORCHIDEE" 493 494 orchideelog="$(pwd)/orchidee.log" 495 echo "Compiling ORCHIDEE, the continental surface model (log $orchideelog)" 496 echo "Start of the first compilation of orchidee, in sequential mode: $(date)" 497 498 ORCHPATH=$(pwd) 499 export ORCHPATH=$ORCHPATH 500 501 local xios_orchid opt_orc 502 if [[ $with_xios = "y" ]]; then 503 xios_orchid="-xios"; 504 else 505 xios_orchid="-noxios" 506 fi 507 if [[ $optim_debug = "-debug" ]]; then 508 opt_orc="-debug"; 509 else 510 opt_orc="-prod" 511 fi 512 513 # TODO debug 514 echo "./makeorchidee_fcm $xios_orchid $opt_orc -parallel none -arch $arch -arch_path $arch_dir" 515 516 if ! ./makeorchidee_fcm "$xios_orchid" "$opt_orc" -parallel none -arch "$arch" -arch_path "$arch_dir" > "$orchideelog" 2>&1; then 517 echo "ORCHIDEE seq compilation failed, exiting"; exit 1 518 fi 519 echo "Compiled ORCHIDEE seq $(date)" 520 fi 451 521 } 452 522 … … 455 525 set_default_params 456 526 read_cmdline_args "$@" 527 #download_model 528 download_model_AMAURY 529 check_arch 457 530 check_available_software 458 download_model459 setup_local_arch460 531 install_netcdf 461 532 install_IOIPSL 462 install_XIOS 533 #install_XIOS # TODO disabled for now, did not decide which flags/arch to use for compile 534 compile_orchidee_seq 463 535 464 536 exit 0 … … 491 563 # par_comp=${path_mpi}/mpif90; 492 564 # mpirun=${path_mpi}/mpirun; 493 # arch="local" 565 # arch="local"; 494 566 # make="make"; 495 567 # o_ins_make="-t g95" … … 602 674 603 675 604 605 606 #============================================================================607 676 veget_version=false 608 677 if [[ $veget != 'NONE' ]]; then 609 678 cd "$MODEL/modipsl/modeles/ORCHIDEE" 610 set +e; svn upgrade; set -e 611 if [[ $veget = "CMIP6" ]]; then 612 veget_version=orchidee2.0 613 orchidee_rev=6592 614 else # specific orchidee revision newer than CMIP6, on 2_1 or 2_2 branches 615 veget_version=orchidee2.1 616 orchidee_rev=$veget 617 if [[ $veget -lt 4465 ]]; then 618 echo 'Stopping, ORCHIDEE version too old, script needs work on ' \ 619 'the CPP flags to pass to makelmdz' 620 exit 1 621 fi 622 set +e 623 # which branch is my version on? 624 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}') 625 # switch to that branch 626 echo IF YOU INSTALL ORCHIDEE THE VERY FIRST TIME, ASK for PASSWORD at \ 627 orchidee-help@listes.ipsl.fr 628 svn switch -r "$veget" --accept theirs-full "svn://forge.ipsl.jussieu.fr/orchidee/$orcbranch" 629 if ! (svn log -r "$veget" | grep "$veget"); then 630 echo 'Cannot update ORCHIDEE as not on the right branch for ORCHIDEE' 631 exit 1 632 fi 633 set -e 634 set +e; svn update -r "$veget"; set -e 635 fi 636 # Correctif suite debug Jean-Zay 637 sed -i -e 's/9010 FORMAT(A52,F17.14)/9010 FORMAT(A52,F20.14)/' \ 638 src_stomate/stomate.f90 639 opt_orc="-prod"; if [[ "$optim" = "-debug" ]]; then opt_orc="-debug"; fi 679 680 opt_orc="-prod"; if [[ "$optim_debug" = "-debug" ]]; then opt_orc="-debug"; fi 640 681 641 682 orchideelog=$(pwd)/orchidee.log … … 877 918 878 919 if [[ $compile_with_fcm = 1 ]]; then 879 makelmdz="makelmdz_fcm $optim -arch $arch -j 8 "920 makelmdz="makelmdz_fcm $optim_debug -arch $arch -j 8 " 880 921 else 881 makelmdz="makelmdz $optim -arch $arch"922 makelmdz="makelmdz $optim_debug -arch $arch" 882 923 fi 883 924 … … 885 926 if [[ "$sequential" = 1 ]]; then 886 927 echo Sequential compilation command, saved in compile.sh: 887 echo "./$makelmdz $optim $OPT_MAKELMDZ $optim$opt_rad $opt_cosp " \928 echo "./$makelmdz $optim_debug $OPT_MAKELMDZ $optim_debug $opt_rad $opt_cosp " \ 888 929 "-d ${grid_resolution} -v $veget_version gcm " 889 echo "./$makelmdz $optim $OPT_MAKELMDZ $optim$opt_rad $opt_cosp " \930 echo "./$makelmdz $optim_debug $OPT_MAKELMDZ $optim_debug $opt_rad $opt_cosp " \ 890 931 "-d ${grid_resolution} -v $veget_version gcm " > compile.sh 891 932 chmod +x ./compile.sh … … 972 1013 # ATTENTION le probleme de cospv2 sur jean-zay en mode prod n 973 1014 # est pas corrige 974 echo ./"$makelmdz" -dev $optim "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \1015 echo ./"$makelmdz" -dev $optim_debug "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ 975 1016 "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ 976 1017 -parallel "$parallel" gcm >> compile.sh 977 echo ./"$makelmdz" -dev $optim "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \1018 echo ./"$makelmdz" -dev $optim_debug "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ 978 1019 "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ 979 1020 -parallel "$parallel" gcm 980 1021 else 981 echo ./"$makelmdz" $optim "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \1022 echo ./"$makelmdz" $optim_debug "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ 982 1023 "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ 983 1024 -parallel "$parallel" gcm >> compile.sh 984 echo ./"$makelmdz" $optim "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \1025 echo ./"$makelmdz" $optim_debug "$OPT_MAKELMDZ" "$opt_rad" "$opt_cosp" \ 985 1026 "$opt_makelmdz_xios" -d \$resol -v $veget_version -mem \ 986 1027 -parallel "$parallel" gcm … … 1253 1294 cat ../compile.sh 1254 1295 if [[ $parallel = "none" ]]; then 1255 echo "You may re-run it with : cd $(pwd) 1296 echo "You may re-run it with : cd $(pwd); gcm.e" 1256 1297 echo "or ./bench.sh" 1257 1298 else 1258 1299 echo "You may re-run it with : " 1259 echo "cd $(pwd) 1300 echo "cd $(pwd); ./bench.sh" 1260 1301 # echo 'ulimit -s unlimited' 1261 1302 # echo 'export OMP_NUM_THREADS=2'
Note: See TracChangeset
for help on using the changeset viewer.