source: BOL/LMDZ_Setup_amaury/lmdz_env.sh @ 4992

Last change on this file since 4992 was 4991, checked in by abarral, 5 months ago

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 size: 4.3 KB
Line 
1#!/bin/bash
2########################################################
3# This file loads the required modules and sets the paths for simulations
4# To modify the paths:
5#    1) In the <set_env> function, find the section corresponding to your machine
6#    2) Modify the variables, which are documented in the *) section of <set_env>
7# See the end of <set_env> for the explanation of each
8########################################################
9
10function get_hostname {
11  if grep -q "Adastra" /etc/motd; then
12    hostname="adastra"
13  else
14    hostname=$(hostname)
15  fi
16}
17
18function set_env {  # Platform-specific
19  case ${hostname:0:5} in
20    jean-)
21      ARCH="X64_JEANZAY"
22      module purge
23      compilo=19.0.4 # available 2013.0, 2017.2
24      module load intel-compilers/$compilo
25      #module load intel-mpi/$compilo
26      module load intel-mkl/$compilo
27      module load hdf5/1.10.5-mpi
28      module load netcdf/4.7.2-mpi
29      module load netcdf-fortran/4.5.2-mpi
30      module load subversion/1.9.7
31      #Pour module gcc, voir : https://trac.lmd.jussieu.fr/LMDZ/wiki/PortageJeanZay
32      #module load gcc/6.5.0
33      module load nco
34      module load cdo
35      # Imputation de la consommation sur le groupe (projet) actif par defaut,
36      #   idrproj indique le groupe (projet) actif par defaut
37      #   idrproj -d newproj   redefinit "newproj" en tant que  projet actif,
38      #        alors $STORE, $WORK etc vont designer les espaces de "newproj")
39      account=$(idrproj | grep active | awk '{ print $1}')
40      SUBMITCMD="sbatch -A $account@cpu "
41      RUNCMD="srun --label -n"
42      # Espaces suivants definis par defaut en fonction du groupe actif,
43      #  par exemple : SCRATCHD=$SCRATCH is /gpfsstore/rech/$groupe/$login
44                  #    * On peut aussi ne pas installer les scripts a la racine de STORE,
45                  #        mais dans STORED=$STORE/your_folder
46      SIMRUNBASEDIR="$SCRATCH/LMDZ_Setup"
47      LMDZD=$WORK
48      NB_MPI_MAX=2000
49      NB_OMP_MAX=20
50      #LMDZ_Init sur le $STORE du $groupe
51      LMDZ_INIT=$STORE/LMDZ_Init
52      ;;
53    spiri)
54      module purge
55      module load subversion/1.13.0
56      module load gcc/11.2.0
57      module load openmpi/4.0.7
58      module load cdo/2.3.0
59
60      root_dir=~/"LMDZ_SETUP_ROOT/LMDZ_Setup";
61      ARCH="X64_MESOIPSL-GNU"
62      SIMRUNBASEDIR="$SCRATCH/"
63      LMDZD="$root_dir/LMDZD"
64      LMDZ_INIT="$root_dir/LMDZ_Init"
65      NB_MPI_MAX=20
66      NB_OMP_MAX=1
67      RUNCMD="mpirun -n"  # on spirit, we can't run MPI using srun from within sbatch
68      SUBMITCMD="sbatch"
69      ;;
70    adast)
71      module purge
72  #    module load PrgEnv-gnu
73  #    module load cray-hdf5-parallel
74  #    module load netcdf-hdf5parallel/gnu/10.3
75
76      account=$(/usr/sbin/my_project.py -l 2>&1 | head -1 | cut -d " " -f 3- | cut -c 5-)
77      root_dir="$WORKDIR/LMDZ_Setup";
78      ARCH="X64_ADASTRA-GNU"
79      SIMRUNBASEDIR="$SCRATCHDIR/"
80      LMDZD="$root_dir/LMDZD"
81      LMDZ_INIT="$root_dir/LMDZ_Init"
82      NB_MPI_MAX=20  # TODO 2000 in JZ
83      NB_OMP_MAX=2  # TODO 20 in JZ
84      RUNCMD="srun --label --account=$account -n"
85      SUBMITCMD="sbatch --account=$account"
86      ;;
87    *) echo "WARNING: RUNNING THIS SCRIPT ON A LOCAL COMPUTER IS DISCOURAGED (lackluster cpus and memory)"
88      root_dir="/home/abarral/PycharmProjects/installLMDZ/LMDZ_Setup"; # Where you have extracted LMDZ_Setup. Can't use $(pwd) since this script gets copied and ran from several locations
89      ARCH="local-gfortran-parallel"  # The arch file to use
90      SIMRUNBASEDIR="/tmp/SCRATCH/"  # Where the simulations will be executed ($SIMRUNBASEDIR/LMDZ_Setup/...)
91      LMDZD="$root_dir/LMDZD"  # Where the sources will be downloaded and compiled
92      LMDZ_INIT="$root_dir/LMDZ_Init"  # Where to store shared files used for initialisation
93      NB_MPI_MAX=2  # Max number of MPI cores (only for running simulations)
94      NB_OMP_MAX=1  # Max number of OMP threads (only for running simulations)
95      RUNCMD="mpirun -np" # command to run a job, as $runcmd <nprocs> <script>
96      SUBMITCMD="."  # command to sumbit a job, as $submitcmd <script>
97      ;;
98  esac
99}
100
101get_hostname
102echo "Setting up lmdz_env on $hostname"
103set_env
104
105if [[ ! (-d $root_dir && -f $root_dir/lmdz_env.sh) ]]; then
106  echo "STOP: root_dir $root_dir not found, either you are running on an unsupported cluster, or you haven't edited lmdz_env.sh properly"; exit 1
107fi
Note: See TracBrowser for help on using the repository browser.