Changeset 3922 for BOL


Ignore:
Timestamp:
Jun 1, 2021, 6:25:58 PM (4 years ago)
Author:
Laurent Fairhead
Message:

New install with updated CMIP6 vegetation by default
LF/AS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOL/script_install/install_lmdz.sh

    r3921 r3922  
    55# Usage  : install_lmdz.sh -help
    66#
    7 # bash installation script of the LMDZ model on a Linux PC.
    8 # the model is downloaded in the following direcory tree
     7# bash installation script of the LMDZ model on different computer types :
     8# Linux PC, "mesocentre" (IPSL-UPMC, IPSL-X), super-computer (IDRIS)
     9#
     10# The model is downloaded in the following directory tree
    911# $MODEL/modipsl/modeles/...
    1012# using the "modipsl" infrastructure created by the "IPSL"
     
    1517#
    1618# The sources of the models can be found in the "modeles" directory.
    17 # In the present case, LMDZ5, ORCHIDEE and IOIPSL (handling of input-outputs
    18 # using the NetCDF library.
     19# In the present case, LMDZ, ORCHIDEE, and IOIPSL or XIOS (handling of input-outputs
     20# using the NetCDF library).
    1921#
    2022# The script downloads various source files (including a version of NetCDF)
    2123# and utilities, compiles the model, and runs a test simulation in a
    22 # munimal configuration.
     24# minimal configuration.
    2325#
    24 # Prerequisites : pgf90/gfortran, wget , gunzip, tar, ...
     26# Prerequisites : pgf90/gfortran, bash or ksh, wget , gunzip, tar, ...
    2527#
    2628# Modif 18/11/2011
    2729#    changes for option real 8.
    28 #      We comopile with -r8 (or equivalent) and -DNC_DOUBLE for the GCM
     30#      We compile with -r8 (or equivalent) and -DNC_DOUBLE for the GCM
    2931#      but with -r4 for netcdf. Variable real must be set to
    3032#      r4 or r8 at the beginning of the script below.
     
    5355}
    5456
    55 
     57# 04_2021 : tester si r4 marche encore !
    5658#real=r4
    5759real=r8
    58 
    59 # WARNING !!!! For versions before october 2009, use
    60 # install.v2.sh instead of install.sh
    6160
    6261#########################################################################
     
    6463#########################################################################
    6564svn=""
    66 version=trunk
     65#version=trunk
     66version=20210320.trunk
    6767getlmdzor=1
    6868netcdf=1   #  1 for automatic installation
     
    7272check_linux=1
    7373ioipsl=1
    74 veget=1
    75 orchidee_rev=""  # default revision of ORCHIDEE
    7674bench=1
    7775pclinux=1
     
    7977compiler=gfortran
    8078SCM=0
    81 # use the old orchidee interface without the calculation of z0h
    82 no_z0h_orc=1
    83 # orchidee_version: defined to use the CMIP6 version of ORCHIDEE
    84 #                   (and eventually anyother)
    85 #                   values=CMIP6
    86 orchidee_version=""
     79# surface/vegetation scheme treatment
     80# controlled by the single variable veget which can have the following values
     81# - NONE: bucket scheme (default)
     82# - CMIP6: orchidee version used in CMIP exercise, rev 5661
     83# - number: orchidee version number (not yet implemented)
     84veget=NONE
    8785# choose the resolution for the bench runs
    8886# grid_resolution= 32x24x11 or 48x36x19 for tests (test without ORCHIDEE)
     
    163161    -gprof     to compile with -pg to enable profiling with gprof
    164162
    165     -orchidee_rev "svn_release" : upgrade included ORCHIDEE model to
    166                given svn release number (default: $orchidee_rev)
    167                (only valid for orchidee2.0 and later)
    168 
    169163    -cosp      to compile with cosp(v1)
    170164 
     
    185179    -env_file  specify an arch.env file to overwrite the existing one
    186180
    187     -orc_version      to chose some tagged ORCHIDEE version (CMIP6 only for the present)
     181    -veget surface model to run [NONE/CMIP6/xxxx]
    188182
    189183........fin
     
    201195     "-cosp2") cosp2=1 ; opt_cosp2="-cosp2 true" ; shift ;;
    202196     "-cospv2") cospv2=1 ; opt_cospv2="-cospv2 true" ; shift ;;
    203      "-orchidee_rev") orchidee_rev=$2 ; shift ; shift ;;
    204197     "-nofcm") compile_with_fcm=0 ; shift ;;
    205198     "-SCM") SCM=1 ; shift ;;
     
    217210     "-xios") with_xios="y" ; shift ;;
    218211     "-env_file") env_file=$2 ; shift ; shift ;;
    219      "-orc_version") orchidee_version=$2 ; shift ; shift ;;
     212     "-veget") veget=$2 ; shift ; shift ;;
    220213     *) ./install_lmdz.sh -h ; exit
    221214   esac
    222215done
    223216
    224 if [ $parallel = none ] ; then sequential=1 ; else sequential=0 ; fi
     217# Check on veget version
     218#if [ "$veget" != 'NONE'  -a "$veget" != "CMIP6" -a "$veget" != +([0-9]) ] ; then
     219if [ $veget != 'NONE'   -a $veget != "CMIP6" ] ; then
     220    re='^[0-9]+$'
     221    if ! [[ $veget =~ $re ]] ; then
     222        echo 'Valeur de l option veget non valable'
     223        exit
     224    fi
     225fi
     226
     227#Define veget-related suffix for gcm name
     228if [ "$veget" = 'NONE' ] ; then
     229    suff_orc=''
     230    #For use with tutorial, orchidee_rev is also defined (will be written in surface_env at the end of the script)
     231    orchidee_rev=''
     232else
     233    suff_orc='_orch'
     234fi
     235
     236
     237if [ $parallel = none ] ; then sequential=1; suff_exe='_seq' ; else sequential=0; suff_exe='_para_mem' ; fi
    225238
    226239#Chemin pour placer le modele
     
    271284            o_ins_make="-t g95" ;;
    272285           
    273 #   *)       if [ $parallel = none -o ] ; then
    274    *)       if [ $parallel = none ] ; then
     286   *)       if [ $parallel = none -o -f /usr/bin/mpif90 ] ; then
    275287                path_mpi=`which mpif90 | sed -e s:/mpif90::` ;
    276288                if [ -d /usr/lib64/openmpi ] ; then
     
    279291                  root_mpi="/usr"
    280292                fi
    281                 # Ehouarn: but why do we need path_mpi and root_mpi
    282                 # if not in parallel ?
     293            # For Scientifique Linux with gfortran at LMD :
     294            elif [ -f /usr/lib64/openmpi/1.4.5-gfortran/bin/mpif90 -a $compiler = "gfortran" ] ; then
     295                path_mpi=/usr/lib64/openmpi/1.4.5-gfortran/bin ;
     296                root_mpi=/usr/lib64/openmpi/1.4.5-gfortran ;
     297                export LD_LIBRARY_PATH=${root_mpi}/lib:$LD_LIBRARY_PATH
     298            # For Scientifique Linux with ifort at LMD :
     299            elif [ -f /usr/lib64/openmpi/1.4.5-ifort/bin/mpif90 -a $compiler = "ifort" ] ; then
     300                path_mpi=/usr/lib64/openmpi/1.4.5-ifort/bin ;
     301                root_mpi=/usr/lib64/openmpi/1.4.5-ifort ;
     302                export LD_LIBRARY_PATH=${root_mpi}/lib:$LD_LIBRARY_PATH
     303            # For Scientifique Linux with pgf90 at LMD :
     304            elif [ -f /usr/lib64/openmpi/1.4.5-ifort/bin/mpif90 -a $compiler = "pgf90" ] ; then
     305                path_mpi=/usr/lib64/openmpi/1.4.5-pgf/bin ;
     306                root_mpi=/usr/lib64/openmpi/1.4.5-pgf ;
     307                export LD_LIBRARY_PATH=${root_mpi}/lib:$LD_LIBRARY_PATH
    283308            else
    284                path_mpi=`which mpif90 | sed -e s:/mpif90::` ;
    285                root_mpi=`which mpif90 | sed -e s:/bin/mpif90::` ;
    286                if [ ! -x ${path_mpi}/mpif90 ] ; then
    287                  echo "Error: cannot find mpif90" ;
    288                  exit ;
    289                fi ;
    290                export LD_LIBRARY_PATH=${root_mpi}/lib:$LD_LIBRARY_PATH
     309               echo "Cannot find mpif90" ;
     310               if [ $parallel = none ] ; then exit ; fi ;
    291311            fi ;
    292312            par_comp=${path_mpi}/mpif90 ;
     
    468488
    469489##########################################################################
    470 # If installing on know machines such as IBM x3750 (Ada)
    471 # at IDRIS, don't check for available software and don"t install netcdf
     490# If installing on known machines such as Jean-Zay at IDRIS,
     491# don't check for available software and don't install netcdf
    472492if [ ${hostname:0:5} = jean- ] ; then
    473493  netcdf=0 # no need to recompile netcdf, alreday available
     
    485505
    486506
    487 
    488507mkdir -p $MODEL
    489508echo $MODEL
    490509MODEL=`( cd $MODEL ; pwd )` # to get absolute path, if necessary
    491 
    492 
    493 
    494 # Option -fendian=big is only to be used with ARPEGE1D.
    495 # The -r8 should probably be avoided if running on 32 bit machines
    496 # Option r8 is not mandatory and generates larger executables.
    497 # It is however mandatory if using ARPEGE1D
    498 # Better optimization options might be a better choice (e.g. -O3)
    499510
    500511
     
    504515echo '################################################################'
    505516
    506 #### Ehouarn: test if ksh and/or bash are available
    507 #use_shell="ksh" # default: use ksh
    508 #if [ "`which ksh`" = "" ] ; then
    509 #  echo "no ksh ... we will use bash"
    510   use_shell="bash"
    511   if [ "`which bash`" = "" ] ; then
    512     echo "bash needed!! Install it!"
    513   fi
    514 #fi
    515 
     517#### Ehouarn: test if the required shell is available
     518#### Maj FH-LF-AS 2021-04 : default=bash ; if bash missing, use ksh
     519use_shell="bash" # default
     520if [ "`which bash`" = "" ] ; then
     521  echo "no bash ; we will use ksh"
     522  use_shell="ksh"
     523  if [ "`which ksh`" = "" ] ; then
     524    echo "bash (or ksh) needed!! Install it!"
     525    exit
     526  fi
     527fi
    516528
    517529for logiciel in wget tar gzip make $compiler gcc ; do
     
    542554echo '##########################################################'
    543555cd $MODEL
    544 myget src/modipsl.$version.tar.gz
     556myget src/modipsl_orc_cmip6.$version.tar.gz
    545557echo install.sh wget_OK `date`
    546 gunzip modipsl.$version.tar.gz
    547 tar xvf modipsl.$version.tar
    548 \rm modipsl.$version.tar
    549 
     558gunzip modipsl_orc_cmip6.$version.tar.gz
     559tar xvf modipsl_orc_cmip6.$version.tar
     560\rm modipsl_orc_cmip6.$version.tar
    550561fi
    551562
     
    569580  cd netcdf-4.0.1
    570581
    571   # seds to possibly use gfortran44 obsolete nowdays (Ehouarn: 10/2017)
    572   #sed -e 's/gfortran/'$gfortran'/g' configure >| tmp ; mv -f tmp configure ; chmod +x configure
    573582  localdir=`pwd -P`
    574583  ./configure --prefix=$localdir --enable-shared --disable-cxx
     
    748757#============================================================================
    749758veget_version=false
    750 if [ "$veget" = 1 ] ; then
     759if [ "$veget" != 'NONE' ] ; then
    751760  cd $MODEL/modipsl/modeles/ORCHIDEE
    752   if [ "$orchidee_version" = "CMIP6" ] ; then
    753     set +e
    754     svn upgrade
    755     svn switch -r 5661 --accept theirs-full svn://forge.ipsl.jussieu.fr/orchidee/tags/ORCHIDEE_2_0/ORCHIDEE
    756     orchidee_rev=5661
    757     veget_version=orchidee2.0
    758     no_z0h_orc=0
    759     set -e
     761  set +e ; svn upgrade ; set -e
     762  if [ "$veget" = "CMIP6" ] ; then
     763    veget_version=orchidee2.0 
     764    orchidee_rev=6592
     765  else # specific orchidee revision
     766     set +e
     767     svn log -r $veget | grep  $veget
     768     if [  $? -gt 0 ] ; then
     769          echo 'Cannot update ORCHIDEE as not on the right branch for ORCHIDEE'
     770          exit
     771      fi
     772      set -e
     773      set +e ; svn update -r $veget ; set -e 
    760774  fi
    761775  # Correctif suite debug Jean-Zay
     
    773787# Pour les experts qui voudraient changer de version d'orchidee.
    774788# Attention : necessite d'avoir le password pour orchidee
    775       set +e ; svn upgrade ; set -e
    776       if [ "$orchidee_rev" != "" ] ; then
    777           # test qu'on est sur la bonne branche pour faire le update
    778           set +e
    779           svn log -r $orchidee_rev | grep  $orchidee_rev
    780           if [  $? -gt 0 ] ; then
    781               echo 'Cannot update ORCHIDEE as not on the right branch for ORCHIDEE'
    782               exit
    783           fi
    784           set -e
    785           set +e ; svn update -r $orchidee_rev ; set -e
    786       fi
     789
    787790      # Correctif suite debug Jean-Zay
    788791      if [ -f src_global/time.f90 ] ; then sed -i -e 's/CALL tlen2itau/\!CALL tlen2itau/' src_global/time.f90 ; fi
     
    815818       liste_src="parallel parameters global stomate sechiba driver"
    816819       if [ "$veget_version" == "false" ] ; then veget_version=orchidee2.0 ; fi
    817      else
    818        # Obsolete, for ORCHIDEE_beton only
    819        liste_src="parameters stomate sechiba "
    820        # A trick to compile ORCHIDEE depending on if we are using real*4 or real*8
    821        cd src_parameters ; \cp reqdprec.$real reqdprec.f90 ; cd ..
    822        if [ "$veget_version" == "false" ] ; then veget_version=orchidee1.9 ; fi
    823820     fi
    824821     for d in $liste_src ; do src_d=src_$d
     
    836833
    837834#============================================================================
    838 # Ehouarn: it may be directory LMDZ4 or LMDZ5 depending on tar file...
     835# Ehouarn: the directory name LMDZ* depends on version/tar file...
    839836if [ -d $MODEL/modipsl/modeles/LMD* ] ; then
    840837  echo '##########################################################'
     
    901898##################################################################
    902899
    903 set +e ; svn upgrade
     900
     901set +e ; svn upgrade ; set -e
    904902if [ "$svn" = "last" ] ; then svnopt="" ; else svnopt="-r $svn" ; fi
    905903if [ "$svn" != "" ] ; then
     
    921919echo install.sh avant_compilation `date`
    922920if [ $compile_with_fcm = 1 ] ; then makelmdz="makelmdz_fcm $optim -arch $arch -j 8 " ; else makelmdz="makelmdz $optim -arch $arch" ; fi
    923 
    924 # use the orchidee interface that has no z0h
    925 if [ "$no_z0h_orc" = 1 ] ; then
    926 veget_version="$veget_version -cpp ORCHIDEE_NOZ0H"
    927 fi
    928921
    929922# sequential compilation and bench
     
    953946  #
    954947  cd $ORCHPATH
    955   if [ -d src_parallel -a $veget = 1 ] ; then
     948  if [ -d src_parallel -a $veget != 'NONE' ] ; then
    956949     cd arch
    957950     sed  \
     
    972965     echo ./makeorchidee_fcm -j 8 -clean -noxios $opt_orc -parallel $parallel -arch $arch
    973966     echo ./makeorchidee_fcm -j 8 -noxios $opt_orc -parallel $parallel -arch $arch
    974   elif [ $veget = 1 ] ; then
     967  elif [ $veget != 'NONE' ] ; then
    975968    echo '##########################################################'
    976969    echo ' Orchidee version too old                                 '
     
    10111004fi # of if [ $parallel != "none" ]
    10121005
    1013 #echo LLLLLLLLLLLLLLLLLLLLLLLLLLL
    1014 if [ "$gfortran" = "gfortran44" ] ; then
    1015     echo Your gfortran compiler was too old so that the model was automatically
    1016     echo compiled with gfortran44 instead. It can not be used in parallel mode.
    1017     echo You can change the compiler at the begining of the install.sh
    1018     echo script and reinstall.
    1019 fi
    10201006
    10211007##################################################################
     
    10251011# Recherche de l'executable dont le nom a change au fil du temps ...
    10261012gcm=""
    1027 for exe in gcm.e bin/gcm_${grid_resolution}_phylmd_seq_orch.e bin/gcm_${grid_resolution}_phylmd_seq.e bin/gcm_${grid_resolution}_phylmd_para_mem_orch.e bin/gcm_${grid_resolution}_phylmd_para_mem.e  ; do
    1028    if [ -f $exe ] ; then gcm=$exe ; fi
     1013#for exe in gcm.e bin/gcm_${grid_resolution}_phylmd_seq_orch.e bin/gcm_${grid_resolution}_phylmd_seq.e bin/gcm_${grid_resolution}_phylmd_para_mem_orch.e bin/gcm_${grid_resolution}_phylmd_para_mem.e  ; do
     1014for exe in gcm.e bin/gcm_${grid_resolution}_phylmd${suff_exe}${suff_orc}.e ; do   if [ -f $exe ] ; then gcm=$exe ; fi
    10291015done
    10301016
     
    11611147   fi
    11621148   if [ ${hostname:0:5} = jean- ] ; then
     1149     . ../arch/arch-${arch}.env 
    11631150     echo "srun -n 2 -A $idris_acct@cpu gcm.e > listing  2>&1" >> bench.sh
    11641151   else
     
    11671154   # Add rebuild, using reb.sh if it is there
    11681155   echo 'if [ -f reb.sh ] ; then' >> bench.sh
    1169    echo '  ./reb.sh histday ; ./reb.sh histmth ; ./reb.sh histhf ; ./reh.sh histins' >> bench.sh
     1156   echo '  ./reb.sh histday ; ./reb.sh histmth ; ./reb.sh histhf ; ./reb.sh histins ; ./reb.sh stomate_history ; ./reb.sh sechiba_history ; ./reb.sh sechiba_out_2 ' >> bench.sh
    11701157   echo 'fi' >> bench.sh
    11711158else
    11721159   echo "./gcm.e > listing  2>&1" > bench.sh
     1160fi
     1161# Getting orchidee stuff
     1162if [ $veget == 'CMIP6' ] ; then
     1163    #echo 'myget 3DBenchs/BENCHorch11.tar.gz'
     1164    #myget 3DBenchs/BENCHorch11.tar.gz
     1165    #tar xvzf BENCHorch11.tar.gz
     1166    echo 'myget 3DBenchs/BENCHCMIP6.tar.gz'
     1167    myget 3DBenchs/BENCHCMIP6.tar.gz
     1168    tar xvzf BENCHCMIP6.tar.gz
     1169    sed -e "s:VEGET=n:VEGET=y:" config.def > tmp
     1170    mv -f tmp config.def
    11731171fi
    11741172echo EXECUTION DU BENCH
     
    11961194echo '##########################################################'
    11971195
    1198 fi
     1196fi # bench
    11991197
    12001198
     
    12111209./run.sh
    12121210fi
     1211set -vx
     1212
     1213#################################################################
     1214# sauvegarde des options veget pour utilisation eventuelle tutorial_prod
     1215#################################################################
     1216cd $MODEL/modipsl/modeles
     1217echo surface_env file created in $MODEL
     1218echo 'veget='$veget > surface_env
     1219#opt_veget="-v $veget_version"
     1220#echo 'opt_veget="'$opt_veget\" >> surface_env
     1221echo 'opt_veget="'-v $veget_version\" >> surface_env
     1222echo 'orchidee_rev='$orchidee_rev >> surface_env
     1223echo 'suforch='$suff_orc >> surface_env
     1224   
     1225
     1226
     1227
Note: See TracChangeset for help on using the changeset viewer.