-
Notifications
You must be signed in to change notification settings - Fork 4
/
setenv_C-ESM-EP.sh
executable file
·155 lines (132 loc) · 5 KB
/
setenv_C-ESM-EP.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#set +x
#set -e
# -------------------------------------------------------- >
# --
# -- Script to run a CliMAF atlas :
# -- - sets up the environment
# --
# -- Author: Jerome Servonnat
# -- Contact: jerome.servonnat__at__lsce.ipsl.fr
# --
# -------------------------------------------------------- >
date
directory_of_this_script=$(cd $(dirname $BASH_ARGV); pwd)
# Here, script install_lite.sh may set (or have set) a value for
# 'root', to a directory hosting the full C-ESM-EP code. This allow to
# have light installs. Otherwise, 'root' is set to the directory
# of current script, which is fine if it hosts a full code set
#root= #HERE
root=${root:-$directory_of_this_script}
# -- Source useful functions (my_append..)
source $root/utils.sh
# -- Setup the environment...
# -------------------------------------------------------- >
# --> At TGCC - Irene
if [[ -d "/ccc" && ! -d "/data" ]] ; then
# pcocc name for the container to use for setting the environment
docker_container=cesmep_container
export LC_ALL=C.UTF-8 # Needed by pcocc (actually by Click in python 3.6)
export LANG=C.UTF-8 # Needed by pcocc (actually by Click in python 3.6)
if ! pcocc image show $docker_container #> /dev/null 2>&1 ;
then
echo -e"\n\nBefore your first run of C-ESM-EP at TGCC, you must tell pcocc "
echo -e "which is the Docker container that satisfies C-ESM-EP prerequisites,"
echo -e "by issuing (only once) a command like"
echo -e "\n\t pcocc image import docker-archive:\$container_archive $docker_container\n"
echo -e "where \$container_archive is one of the files in :"
echo -e "\t/ccc/work/cont003/igcmg/igcmg/climaf_python_docker_archives/"
echo -e "(ask your C-ESM-EP guru for the up-to-date location and file)"
exit 1
fi
my_append -ep PATH /ccc/cont003/home/igcmg/igcmg/Tools/irene
fi
# --> At IDRIS - Jean-Zay
if [[ -d "/gpfsdswork" ]]; then
echo "loading module singularity"
set +x
module load singularity
set -x
if [ -z $singularity_container ]
then
# identify newest container among those managed by idrcontmgr
singularity_container=$(idrcontmgr ls | /usr/bin/grep sif | tail -n -1)
fi
if [ -z $singularity_container ]
then
echo -e"\n\nBefore you firt run of C-ESM-EP at IDRIS, you must "
echo -e "declare the singularity container that satisfies C-ESM-EP "
echo -e "prerequisites, by issuing (only once) these commands :"
echo -e "\n\t module load singularity"
echo -e "\t idcontmgr cp /gpfswork/rech/psl/commun/Tools/cesmep_environment/<file>\n"
echo -e "\n where <file> is the newest '.sif' file in that Tools directory"
exit 1
fi
fi
# --> On Spirit
if [[ -d "/data" && -d "/thredds/ipsl" && ! -d "/scratch/globc" ]] ; then
if [[ $(uname -n) == spirit* ]] ; then
emodule=/net/nfs/tools/Users/SU/modulefiles/jservon/climaf/env20230611_climafV3.0_IPSL1
echo Loading module $emodule for CliMAF and C-ESM-EP
set +x
module purge
module load $emodule
set -x
else
echo "C-ESM-EP is not maintained on system $(uname -n)"
exit 1
fi
fi
# --> At CNRM
if [[ -d "/cnrm" ]] ; then
unset PYTHONPATH
# CliMAF
export CLIMAF=/cnrm/est/COMMON/climaf/current
my_append -bp PYTHONPATH /cnrm/est/COMMON/climaf/add_packages/lib/python3.10/site-packages/
my_append -bp PYTHONPATH ${CLIMAF}
my_append -bp PATH ${CLIMAF}/bin
fi
# --> At Cerfacs on Scylla
if [[ -d "/data/scratch/globc/dcom/CMIP6_TOOLS/C-ESM-EP" ]] ; then
echo "We work at Cerfacs on Scylla"
unset PYTHONPATH
# CDAT
source /data/softs/python2/venvs/cesmep1.0/bin/activate
export HDF5_DISABLE_VERSION_CHECK=1
export UVCDAT_ANONYMOUS_LOG=False
# CliMAF
export CLIMAF=/data/scratch/globc/dcom/CMIP6_TOOLS/climaf
my_append -bp PYTHONPATH ${CLIMAF}
my_append -bp PATH ${CLIMAF}/bin
export CLIMAF_CACHE=/data/scratch/globc/dcom/CMIP6_TOOLS/C-ESM-EP/climafcache_${component}
fi
# --> At Cerfacs on kraken
if [[ -d "/scratch/globc/coquart/C-ESM-EP" ]] ; then
echo "We work at Cerfacs on Kraken"
unset PYTHONPATH
module load tools/cdo/1.9.5
module load tools/nco/4.7.6
# CDAT
module load python/anaconda2.7
source activate CESMEP
CONDA=/softs/anaconda2
my_append -bp LD_LIBRARY_PATH ${CONDA}/lib
my_append -bp PYTHONPATH ${CONDA}/lib/python2.7/site-packages
my_append -bp PATH $CONDA/bin
export HDF5_DISABLE_VERSION_CHECK=1
export UVCDAT_ANONYMOUS_LOG=False
# CliMAF
export CLIMAF=/scratch/globc/coquart/climaf
my_append -bp PYTHONPATH ${CLIMAF}
my_append -bp PATH ${CLIMAF}/bin
fi
# Complement PYTHONPATH and PATH
my_append -bp PYTHONPATH ${root}/share/cesmep_modules
my_append -bp PYTHONPATH ${root}
my_append -bp PYTHONPATH ${directory_of_this_script}
my_append -bp PATH ${root}
# Set CliMAF cache
export CLIMAF_CACHE=$(python3 -c 'from locations import climaf_cache; print(climaf_cache)')
echo CLIMAF_CACHE = $CLIMAF_CACHE
echo CESMEP_CLIMAF_CACHE = $CESMEP_CLIMAF_CACHE
echo PATH = $PATH
echo PYTHONPATH = $PYTHONPATH