source: BOL/LMDZ_Setup_amaury/lmdz_env.sh @ 4995

Last change on this file since 4995 was 4995, checked in by abarral, 2 months ago

(WIP) update JEANZAY lmdz_env
fix ecrad data path
run model compilation in a dedicated job
fix Adastra missing --ntasks-per-node

File size: 4.6 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      module purge
22      compilo=19.0.4 # available 2013.0, 2017.2
23      module load intel-compilers/$compilo
24      #module load intel-mpi/$compilo
25      module load intel-mkl/$compilo
26      module load hdf5/1.10.5-mpi
27      module load netcdf/4.7.2-mpi
28      module load netcdf-fortran/4.5.2-mpi
29      module load subversion/1.9.7
30      #Pour module gcc, voir : https://trac.lmd.jussieu.fr/LMDZ/wiki/PortageJeanZay
31      #module load gcc/6.5.0
32      module load nco
33      module load cdo
34      # Imputation de la consommation sur le groupe (projet) actif par defaut,
35      #   idrproj indique le groupe (projet) actif par defaut
36      #   idrproj -d newproj   redefinit "newproj" en tant que  projet actif,
37      #        alors $STORE, $WORK etc vont designer les espaces de "newproj")
38      account=$(idrproj | grep active | awk '{ print $1}')
39      root_dir="$WORK/LMDZ_Setup";
40      ARCH="X64_JEANZAY"
41      SIMRUNBASEDIR="$SCRATCH/"
42      LMDZD="$root_dir/LMDZD"
43      LMDZ_INIT="$root_dir/LMDZ_Init"
44      NB_MPI_MAX=2000
45      NB_OMP_MAX=20
46      RUNCMD="srun --label -n"
47      SUBMITCMD="sbatch -A $account@cpu"
48      ;;
49    spiri)
50      module purge
51      module load subversion/1.13.0
52      module load gcc/11.2.0
53      module load openmpi/4.0.7
54      module load cdo/2.3.0
55
56      root_dir=~/"LMDZ_SETUP_ROOT/LMDZ_Setup";
57      ARCH="X64_MESOIPSL-GNU"
58      SIMRUNBASEDIR="$SCRATCH/"
59      LMDZD="$root_dir/LMDZD"
60      LMDZ_INIT="$root_dir/LMDZ_Init"
61      NB_MPI_MAX=20
62      NB_OMP_MAX=1
63      RUNCMD="mpirun -n"  # on spirit, we can't run MPI using srun from within sbatch
64      SUBMITCMD="sbatch"
65      ;;
66    adast)
67      module purge
68      module load PrgEnv-gnu
69      module load gcc/13.2.0  # required, see https://dci.dci-gitlab.cines.fr/webextranet/user_support/index.html#prgenv-and-compilers
70
71      function cdo {  # cdo is available as a spack cmd which requires a specific, incompatible env
72        unset cdo
73        module purge
74        module load GCC-CPU-3.1.0
75        /opt/software/gaia-external/CPU/cdo-2.4.0/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spa/cdo-2.4.0-gcc-12.1-b3qr/bin/cdo "$@"
76        set_env
77      }
78
79      function ferret {
80        unset ferret
81        module purge
82        module load GCC-CPU-3.1.0
83        module load ferret
84        ferret "$@"
85        set_env
86      }
87
88      account=$(/usr/sbin/my_project.py -l 2>&1 | head -1 | cut -d " " -f 3- | cut -c 5-)
89      root_dir="$WORKDIR/LMDZ_Setup";
90      ARCH="X64_ADASTRA-GNU"
91      SIMRUNBASEDIR="$SCRATCHDIR/"
92      LMDZD="$root_dir/LMDZD"
93      LMDZ_INIT="$root_dir/LMDZ_Init"
94      NB_MPI_MAX=1  # TODO 2000 in JZ
95      NB_OMP_MAX=1  # TODO 20 in JZ
96      RUNCMD="srun --label --account=$account --constraint=GENOA -n"
97      SUBMITCMD="sbatch --constraint=GENOA --account=$account"
98      ;;
99    *) echo "WARNING: RUNNING THIS SCRIPT ON A LOCAL COMPUTER IS DISCOURAGED (lackluster cpus and memory)"
100      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
101      ARCH="local-gfortran-parallel"  # The arch file to use
102      SIMRUNBASEDIR="/tmp/SCRATCH/"  # Where the simulations will be executed ($SIMRUNBASEDIR/LMDZ_Setup/...)
103      LMDZD="$root_dir/LMDZD"  # Where the sources will be downloaded and compiled
104      LMDZ_INIT="$root_dir/LMDZ_Init"  # Where to store shared files used for initialisation
105      NB_MPI_MAX=2  # Max number of MPI cores (only for running simulations)
106      NB_OMP_MAX=1  # Max number of OMP threads (only for running simulations)
107      RUNCMD="mpirun -np" # command to run a job, as $runcmd <nprocs> <script>
108      SUBMITCMD="."  # command to sumbit a job, as $submitcmd <script>
109      ;;
110  esac
111}
112
113get_hostname
114echo "Setting up lmdz_env on $hostname"
115set_env
116
117if [[ ! (-d $root_dir && -f $root_dir/lmdz_env.sh) ]]; then
118  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
119fi
Note: See TracBrowser for help on using the repository browser.