Ignore:
Timestamp:
Jun 20, 2024, 7:22:04 PM (2 weeks ago)
Author:
abarral
Message:

Improve docs
Fix bug on sequential sim when running locally
Fix crash when running init without slurm (ce0l w/o OMP_NUM_THREADS=1)
Fix crash for climato=0 due to missing limit.nc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOL/LMDZ_Setup_amaury/setup.sh

    r4986 r4991  
    88####################################################################
    99function define_expert_options {
    10   #NOTE : $optim  is part of $LMDZname (see definition of LMDZname below),
    11   #   so that running with "-debug" needs to (re)install the model (install=-install in main.sh)
    12   #   If you have already installed the model, and only want to recompile the gcm in debug mode,
    13   #   add "-debug" to the compilation options in the compile.sh script created in the present folder, and run it (./compile.sh gcm)
    14   #   ALTERNATIVELY : you can remove $optim in the definition of "LMDZname" below
    15   #optim=""
    16   optim="-debug"  # TODO temp
    17 
    18   #NOTE : "testmode=y" is for running in test mode :
    19   # the simulation job "tmp_$SIM" (created on $SCRATCHDIR) is automatically changed for a short run,
    20   # and submitted to the Jean-Zay "test" queue :
    21   #  a/ time=00:10:00  (run time limit = 10 min; for test queue, it must be 30 min maximum)
    22   #  b/ nday=1 (this line, forcing nday to 1 day, is "hidden" in script_SIMU, by default it is commented out)
    23   #  c/ #SBATCH --qos=qos_cpu-dev (this line is in script_SIMU, by default it is commented out)
    24   #If you want to change "time", or "nday", but still run in "test" mode, modify the "if [ $debug = 1 ]...; fi" further below.
    25   testmode="y"  # TODO revert
    26 
    27   # Radiative code : "oldrad" or "rrtm" or "ecrad"
     10  # optim: either "" or "-debug" to compile in debug mode (slower but better diagnosis of segfaults)
     11  optim=""
     12
     13  # "n" or "y". If testmode="y", then simulations run for a single day per period.
     14  # NOTE: you must set mthend accordingly !
     15  testmode="n"
     16
     17  # Radiative code: "oldrad" / "rrtm" / "ecrad"
    2818  rad="rrtm"
    2919
    30   # AEROSOLS : n (=no) / clim (=average 1995-2014) / spla (interactive dust and sea salt)
     20  #   !!! STRONG recommendation : experiments with DIFFERENT Orchidee or aerosol options should be performed in DIFFERENT LMDZ_Setup folders
     21  #   !!! (especially as they may need different initial files)
     22
     23  # AEROSOLS : "n" (=no) / "clim" (=average 1995-2014) / "spla" (interactive dust and sea salt)
    3124  # (WARNING : if you first run the scripts with aerosols=n, then you want to change to =clim ,
    3225  #   you'll need to remove the INIT and LIMIT folders that have been created, then run main.sh with init=1
    3326  #   in order to re-run the initialisation job, which downloads the aerosol files and interpolates them)
    3427  aerosols="clim"
    35   aerosols="n"  # TODO revert when we fix/investigate the aerosols issue
     28  aerosols="n"  # TODO TEMP
    3629
    3730  # SURFACE/VEGETATION SCHEME
    38   # It is controlled by the single variable "veget" which can have the following values
    39   # - "none": bucket scheme
    40   # - "CMIP6" or "orch2.0": orchidee version used in CMIP exercise, rev 5661
    41   # - "orch2.2": orchidee version used in IPSLCM7 configuration
    42   # - number: orchidee version number : only rev 7983 on branch _2_2, and 7994 on trunk, are available
     31  # - "none" (bucket scheme) / "CMIP6" or "orch2.0" (orchidee version used in CMIP exercise) / "orch2.2" (orchidee version used in IPSLCM7 configuration) / number (orchidee version number - only rev 7983 on branch _2_2, and 7994 on trunk, are available)
     32  # TODO check w/ Adriana why only 7983 & 7994, see if still relevant - is it a compilation issue ? Or an INIT issue ?
    4333  veget="CMIP6"
    44 
    45   #AS : If you have installed the model with a given "veget" option, and you want to change it :
    46   #   --> RECOMMENDED : re-install the model from scratch in a new TEST_PROD folder
    47   #   TODO Amaury: check w/ Adriana what the use case is for lmdz_setup here
    48   #   --> EXPERT : If you want to keep your previous installation, and not go through the install_lmdz.sh routine,
    49   #    you will need to (a) install the proper version of ORCHIDEE in the modipsl/modeles directory, and
    50   #                     (b) set the "veget" options (opt_veget, orchidee_rev, suforch) to their proper values
    51   #                        in the file $LMDZD/modipsl/modeles/surface_env
    52   # (NB : no need to initialise these vars here:
    53   #     surface_env is either (re)created when (re)installing the model (run with install=-install),
    54   #     or it already exists (install="").
    55 
    56   # New snow scheme INLANDSIS (y/n)
    57   # (this flag activates INLANDSIS compilation;
    58   # not yet done : treatment of specific restart and def file)
     34#  veget="6592"  # TODO correct bug in install_lmdz where we don't know which fcm arg to fwd if we only give the rev... see w/ Laurent (choice in ols install_lmdz: only support >2.0)
     35
     36  # New snow scheme INLANDSIS! "y" / "n"
     37  # This flag activates INLANDSIS compilation; not yet done : treatment of specific restart and def file
    5938  inlandsis="n"
     39
     40  # netcdf: 0 (use existing library) / 1 (recompile netcdf, slow)
     41  netcdf=0
    6042
    6143  # --->>> ALSO PAY ATTENTION TO OUTPUT files, frequency, level -------------
     
    6648  #          For aerosols=n, the corresponding flags will automatically be set to "n".
    6749  #   With XIOS : adjust DEF/XMLfiles*/file*xml
    68 
    69   netcdf=0
    7050}
    7151
    7252# /!\ DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU ARE DOING /!\
    7353
    74 function enable_groupe {  # In job scripts, sed platform-specific headers
     54function enable_platform {  # In job scripts, sed platform-specific headers
    7555  local file="$1"
    7656  local platform
     
    205185  fi
    206186
    207   if [[ $climato = 0 && $freq = yr ]]; then
     187  if [[ $climato = 0 && $freq = "yr" ]]; then
    208188     echo "STOP: Running simulations with interannual SSTs is possible only month by month and a true calendar."
    209189     echo "Change <climato> to <1> or <freq> to <mo> or modify setup.sh (experts)"; exit 1
     
    397377    cp reb.sh "$local/$SIM/reb.sh"; chmod +x "$local/$SIM/reb.sh"
    398378    sed -i'' -e "s:^rebuild=.*.$:rebuild=$LMDZD/$LMDZname/modipsl/bin/rebuild:" "$local/$SIM/reb.sh"
    399     enable_groupe "$local/$SIM/reb.sh"
     379    enable_platform "$local/$SIM/reb.sh"
    400380
    401381    # Copy .def
     
    454434  "$local/script_SIMU" >| "$SIMRUNDIR/tmp_$SIM"
    455435
    456   enable_groupe "$SIMRUNDIR/tmp_$SIM"
     436  enable_platform "$SIMRUNDIR/tmp_$SIM"
    457437
    458438  if [[ $testmode = "y" ]]; then
     
    539519  done
    540520  cd - > /dev/null
     521
     522  if [[ $rad = "ecrad" && ! -d ecrad_data ]]; then
     523    cd "$local"; wget https://lmdz.lmd.jussieu.fr/pub/3DInputData/ecrad/ecrad_data.tar; tar xvf ecrad_data.tar; cd - > /dev/null
     524  fi
    541525}
    542526
     
    648632  sed -e 's/anneeref=.*.$/anneeref='\$yr'/' DEF/run.def >| run.def
    649633  echo Starting initialisation
    650   $RUNCMD 1 $ce0l
     634  OMP_NUM_THREADS=1 $RUNCMD 1 $ce0l  # ce0l requires MPI=OMP=1
    651635  if [ $climato = 0 ]; then mv limit.nc limit.\$yr.nc; fi
    652636done
     
    672656
    673657# Copy initial and forcing files in $local/$INIT and $local/$LIMIT; also in $local/INPUT_SPLA if $aerosols=spla
    674 for f in sta* limit.nc gri*nc; do cp \$f $local/$INIT/\$f; done
     658for f in sta* gri*nc; do cp \$f $local/$INIT/\$f; done
     659if [[ $climato = 1 ]]; then cp limit.nc $local/$INIT/limit.nc; fi
    675660mkdir -p $local/$LIMIT
    676661for f in limit*.nc ; do cp \$f $local/$LIMIT/\$f; done
     
    691676  # ANCIEN MULTI STEP   esac
    692677...eod
    693     enable_groupe tmp
     678    enable_platform tmp
    694679    echo "###############################################################################"
    695680    echo "Submitting initialisation job <$SUBMITCMD tmp> from $(pwd)"
     
    705690     $SUBMITCMD "tmp_$SIM"
    706691     echo '###############################################################################'
     692  fi
     693}
     694
     695function message_post_submit {
     696  if [[ $ok_guide = "y" && $init = 1 ]]; then
     697    echo "Once initialisation is finished, you have to create nudging files"
     698    echo "Edit era2gcm.sh and set the desired parameters in section <User choices>"
     699    echo "Make sure you have acces to the chosen ERA files, and the required modules are loaded, then run : ./era2gcm.sh"
     700    if [[ $aerosols = "spla" ]]; then
     701      echo "Your aerosol choice is <spla>, so you need ERA 10m-winds interpolated on LMDZ grid. Use script era2gcm_uv10m.sh"
     702    fi
     703  else
     704    echo "Si tout se passe bien, vous avez initialisé et lancé automatiquement la simulation."
     705    echo "Le job qui a été lancé se trouve sur $SIMRUNTOPDIR/$MAINDIR/tmp_$SIM"
    707706  fi
    708707}
     
    724723fetch_simu_init_files
    725724run_sim_or_init
     725message_post_submit
    726726
    727727exit 1
     
    730730# COMPILATION OPTIONS depending on the user choices and LMDZ revision number $mysvn
    731731#-------------------------------------------------------
    732 if [[ $rad = "ecrad" && ! -d ecrad_data ]]; then
    733     cd "$local"; wget https://lmdz.lmd.jussieu.fr/pub/3DInputData/ecrad/ecrad_data.tar; tar xvf ecrad_data.tar; cd - > /dev/null
    734 fi
    735732
    736733if [[ $rad = "ecrad" && $aerosols != "n" && $mysvn -lt 4489 ]] ; then echo "Les aerosols tropospheriques ne sont pas pris en charge par ecrad avant LMDZ rev 4489, ici rev est $mysvn"; exit 1; fi
     
    760757
    761758
    762 if [ $ok_guide = y -a $init = 1 ]; then
    763    echo Once initialisation is finished, you have to create nudging files
    764    echo Edit era2gcm.sh and set the desired parameters in section "User choices"
    765    echo Make sure you have acces to the chosen ERA files, and the required modules are load
    766    echo Then run : ./era2gcm.sh
    767    if [ "$aerosols" = "spla" ]; then
    768      echo Your aerosol choice is "spla", so you need ERA 10m-winds interpolated on LMDZ grid
    769      echo Use script era2gcm_uv10m.sh
    770    fi
    771 else
    772    echo Si tout se passe bien, vous avez initialise et lance automatiquement
    773    echo la simulation.
    774    echo Si vous voulez modifier les caracteristiques du job, comme le temps
    775    echo max ou le nombre de proc, il se trouve sur
    776    echo $SIMRUNTOPDIR/$MAINDIR/tmp_$SIM
    777 fi
     759
    778760
    779761###############################################################################
Note: See TracChangeset for help on using the changeset viewer.