Changeset 5386 for BOL/script_install


Ignore:
Timestamp:
Dec 5, 2024, 2:45:34 PM (11 days ago)
Author:
abarral
Message:

Add -verbose option
Add wrapper to display generic error message if we exit because of set -e

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOL/script_install/install_lmdz.sh

    r5385 r5386  
    130130
    131131    jobcmd=""
     132    verbose=0
    132133}
    133134
     
    135136    while (($# > 0)); do
    136137        case $1 in
    137             "-h") cat <<........fin
    138         $0 [ -v version ] [ -r svn_release ]
    139                [ -parallel PARA ] [ -d GRID_RESOLUTION ] [ -bench 0/1 ]
    140                [-name LOCAL_MODEL_NAME] [-rad RADIATIF]
    141 
    142         -v       "version" like 20150828.trunk, see http://www.lmd.jussieu.fr/~lmdz/Distrib/LISMOI.trunk (default <$version>)
    143 
    144         -r       "svn_release" : either the svn release number or "last" (default <$svn_lmdz>)
    145 
    146         -parallel parallel support: mpi, omp, mpi_omp (mpi with openMP) or none (default: <$parallel>)
    147 
    148         -d        "grid resolution": should be among the available benchs if -bench 1 (valid values: 48x36x19, 48x36x39) (default : <$grid_resolution>)
    149 
    150         -bench     activating the bench or not (0/1) (default: <$bench>)
    151 
    152         -unstable  use unstable tar instead of testing
    153 
    154         -name      name of the folder to install to (default <$MODEL>)
    155 
    156         -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>)
    157 
    158         -xios      use (download and compile) the XIOS library (will compile the parallel NetCDF4-HDF5 library) (requires to also have -parallel mpi_omp)
    159 
    160         -cosp       to run with cospv1 or cospv2 [none/v1/v2] (default <$cosp>)
    161 
    162         -rad        radiative code: oldrad, rrtm or ecrad (default <$rad>)
    163 
    164         -nofcm      to compile without fcm
    165 
    166         -SCM        install 1D version automatically
    167 
    168         -debug      compile everything in debug mode
    169 
    170         -benchphysiq   to choose which physics.def package to use in the bench (default <$benchphysiq>)
    171 
    172         -compilephysiq   physics to compile the model with (default <$compphysiq>)
    173 
    174         -veget      surface/vegetation scheme treatment controlled by the single variable veget which can have the following values: none: bucket scheme (default); CMIP6 | veget2.0: orchidee version used in CMIP exercise, rev 5661; veget2.2: orchidee branch 2.2, rev 8529 (bundled); number: orchidee version number  [only orch>2.0] (default $veget)
    175 
    176         -spla       activate interactive aerosols
    177 
    178         -inlandsis  activate new snow scheme
    179 
    180         -arch       name of the arch to use (default <$arch>)
    181 
    182         -arch_dir   where to find the arch files (default <$arch_dir>)
    183 
    184         -make_j     number of processes to parallelize installations (default <$make_j>)
    185 
    186         -jobcmd     command prepended to fcm compile jobs, e.g. "srun" (default <$jobcmd>)
    187 
    188         -noclean    will only download necessary files (but no thorough check is made on the integrity of existing files), and will recompile everything (very quick if it's already been compiled before)
    189 
    190         -icolmdz    to compile the icolmdz executable as well as the lonlat one
    191 
    192 ........fin
    193                   exit 1;;
    194138            "-v") version=$2; shift; shift;;
    195139            "-r") svn_lmdz=$2; shift; shift;;
     
    230174            "-noclean") clean_install=0; shift;;
    231175            "-icolmdz") icolmdz=1; shift;;
    232             *)  bash install_lmdz.sh -h; exit 1
     176            "-verbose") verbose=1; shift;;
     177            "-h" | *) cat <<........fin
     178        $0 [ -v version ] [ -r svn_release ]
     179               [ -parallel PARA ] [ -d GRID_RESOLUTION ] [ -bench 0/1 ]
     180               [-name LOCAL_MODEL_NAME] [-rad RADIATIF]
     181
     182        -v       "version" like 20150828.trunk, see http://www.lmd.jussieu.fr/~lmdz/Distrib/LISMOI.trunk (default <$version>)
     183
     184        -r       "svn_release" : either the svn release number or "last" (default <$svn_lmdz>)
     185
     186        -parallel parallel support: mpi, omp, mpi_omp (mpi with openMP) or none (default: <$parallel>)
     187
     188        -d        "grid resolution": should be among the available benchs if -bench 1 (valid values: 48x36x19, 48x36x39) (default : <$grid_resolution>)
     189
     190        -bench     activating the bench or not (0/1) (default: <$bench>)
     191
     192        -unstable  use unstable tar instead of testing
     193
     194        -name      name of the folder to install to (default <$MODEL>)
     195
     196        -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>)
     197
     198        -xios      use (download and compile) the XIOS library (will compile the parallel NetCDF4-HDF5 library) (requires to also have -parallel mpi_omp)
     199
     200        -cosp       to run with cospv1 or cospv2 [none/v1/v2] (default <$cosp>)
     201
     202        -rad        radiative code: oldrad, rrtm or ecrad (default <$rad>)
     203
     204        -nofcm      to compile without fcm
     205
     206        -SCM        install 1D version automatically
     207
     208        -debug      compile everything in debug mode
     209
     210        -benchphysiq   to choose which physics.def package to use in the bench (default <$benchphysiq>)
     211
     212        -compilephysiq   physics to compile the model with (default <$compphysiq>)
     213
     214        -veget      surface/vegetation scheme treatment controlled by the single variable veget which can have the following values: none: bucket scheme (default); CMIP6 | veget2.0: orchidee version used in CMIP exercise, rev 5661; veget2.2: orchidee branch 2.2, rev 8529 (bundled); number: orchidee version number  [only orch>2.0] (default $veget)
     215
     216        -spla       activate interactive aerosols
     217
     218        -inlandsis  activate new snow scheme
     219
     220        -arch       name of the arch to use (default <$arch>)
     221
     222        -arch_dir   where to find the arch files (default <$arch_dir>)
     223
     224        -make_j     number of processes to parallelize installations (default <$make_j>)
     225
     226        -jobcmd     command prepended to fcm compile jobs, e.g. "srun" (default <$jobcmd>)
     227
     228        -noclean    will only download necessary files (but no thorough check is made on the integrity of existing files), and will recompile everything (very quick if it's already been compiled before)
     229
     230        -icolmdz    to compile the icolmdz executable as well as the lonlat one
     231
     232        -verbose    to print every executed command
     233
     234........fin
     235                  exit 0;;
    233236        esac
    234237    done
     
    305308      fortran_file="lmdz1d"
    306309    fi
     310
     311    if [[ $verbose = 1 ]]; then set -vx; fi
    307312}
    308313
     
    10421047echo "install_lmdz.sh DEBUT $(date)"
    10431048
    1044 set_default_params
    1045 read_cmdline_args "$@"
    1046 ensure_correct_option_combinations
    1047 download_modipsl_tar
    1048 get_lmdz_version
    1049 get_dynamico_icosa_version
    1050 get_orchidee_version
    1051 init_arch
    1052 check_available_software
    1053 check_compiler
    1054 install_netcdf
    1055 install_IOIPSL
    1056 install_XIOS
    1057 compile_orchidee
    1058 compile_lmdz
    1059 compile_icolmdzor
    1060 run_bench
    1061 run_bench_icosa
     1049function wrapper_run_all() {
     1050    set_default_params
     1051    read_cmdline_args "$@"
     1052    ensure_correct_option_combinations
     1053    download_modipsl_tar
     1054    get_lmdz_version
     1055    get_dynamico_icosa_version
     1056    get_orchidee_version
     1057    init_arch
     1058    check_available_software
     1059    check_compiler
     1060    install_netcdf
     1061    install_IOIPSL
     1062    install_XIOS
     1063    compile_orchidee
     1064    compile_lmdz
     1065    compile_icolmdzor
     1066    run_bench
     1067    run_bench_icosa
     1068}
     1069
     1070set +e; (set -e && wrapper_run_all "$@"); err_status=$?; set -e  # workaround to make sure set -e is propagated to wrapper_run_all & check the result
     1071if (($err_status)); then
     1072   echo "EXIT (error)"
     1073   echo "install_lmdz.sh failed"
     1074   set +u
     1075   if [[ $verbose != 1 ]]; then
     1076       echo "Consider using the \`-verbose\` flag to see precisely where it stopped."
     1077   fi
     1078fi
Note: See TracChangeset for help on using the changeset viewer.