-
Notifications
You must be signed in to change notification settings - Fork 6
/
.common_setup
72 lines (63 loc) · 3.07 KB
/
.common_setup
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
#!/bin/bash
# Source this file to:
# - set some environment variables
# - set PATH to find GEM binaries and scripts
if [[ $# -eq 0 ]] ; then
echo "Usage: . ./.common_setup compiler_suite"
echo "Example: . ./.common_setup gnu"
echo "Example: . ./.common_setup intel"
else
unset GEM_ARCH GEM_WORK GEM_STORAGE_DIR gem_DIR
export OMP_STACKSIZE=4G
export COMPILER_SUITE=${1}
platform=$(utils/os.sh)
if [ -z "${EC_ARCH}" ]; then
COMPILER_VERSION=$(utils/compiler.sh ${COMPILER_SUITE})
export COMPILER_VERSION
fi
if [ -n "${platform}" -a "${COMPILER_VERSION}" != "Unknown_Compiler" ]; then
export GEM_ARCH=${platform}-${COMPILER_SUITE}-${COMPILER_VERSION}
export GEM_WORK=work-${GEM_ARCH}
if [ -n "${storage_model}" ] ; then
DIR=$(echo $(basename $(dirname $PWD))/$(basename $PWD))
GEM_STORAGE_DIR=${storage_model}/goas/${DIR}/${GEM_ARCH}
else
GEM_STORAGE_DIR=${PWD}
fi
export GEM_STORAGE_DIR
export gem_DIR=$PWD
export ATM_MODEL_DFILES=${gem_DIR}/gem_dbase
export ATM_MODEL_VERSION=`cat MANIFEST | sed -n '/VERSION/s/.*: //p'`
export gemdyn_version=`cat src/gemdyn/MANIFEST | sed -n '/VERSION/s/.*: //p'`
export rpnphy_version=`cat src/rpnphy/MANIFEST | sed -n '/VERSION/s/.*: //p'`
export modelutils_version=`cat src/modelutils/MANIFEST | sed -n '/VERSION/s/.*: //p'`
export CMCCONST=${ATM_MODEL_DFILES}/datafiles/constants
# Check if at ECCC
if [ -n "${EC_ARCH}" ]; then
if [ -d ${PWD}/src/mach ]; then
# export mach_version (not available externally)
export mach_version=`cat src/mach/MANIFEST | sed -n '/VERSION/s/.*: //p'`
fi
# Check whether GOAS_SCRIPT_MODE variable exists
if [ -z "${GOAS_SCRIPT_MODE}" ]; then
export PATH=${PWD}/scripts:${PWD}/src/rpnphy/bin:${PWD}/src/modelutils/bin:${PWD}/src/gemdyn/bin:${PWD}/${GEM_WORK}/bin:${PATH}
echo "RPN-SI and rpnpy scripts loaded from SSM domains will be used"
else
export PATH=${PWD}/scripts:${PWD}/scripts/support:${PWD}/scripts/rpy:${PWD}/src/rpnphy/bin:${PWD}/src/modelutils/bin:${PWD}/src/gemdyn/bin:${PWD}/${GEM_WORK}/bin:${PATH}
export PYTHONPATH=${PWD}/scripts/rpy:${PYTHONPATH}
echo "GOAS_SCRIPT_MODE set: GEM scripts in scripts/support and scripts/rpy will be used instead of SSM domains scripts"
fi
# for external use, always add all scripts to PATH, without message
else
export PATH=${PWD}/scripts:${PWD}/scripts/support:${PWD}/scripts/rpy:${PWD}/src/rpnphy/bin:${PWD}/src/modelutils/bin:${PWD}/src/gemdyn/bin:${PWD}/${GEM_WORK}/bin:${PATH}
export PYTHONPATH=${PWD}/scripts/rpy:${PYTHONPATH}
fi
export TMPDIR=${TMPDIR-$(mktemp -d /tmp/$USER-XXXX)}
fi
fi
export PYTHONDONTWRITEBYTECODE=true
unset platform
# Shortcut commands for cmake and make
alias cado=${PWD}/cado
# Autocomplete for commands
source ./_cado