-
Notifications
You must be signed in to change notification settings - Fork 573
/
environment.sh
213 lines (171 loc) · 6.46 KB
/
environment.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
################################################################################
#
# Set up env on ats2 for ATMD builds of Trilinos
#
# This source script gets the settings from the ATDM_CONFIG_BUILD_NAME var.
#
################################################################################
# ats2 jobs all use the same environmnet changes to the
# sourced script below will impact jobs on both of those
# machines. please be mindful of this when making changes
#
# Handle KOKKOS_ARCH
#
if [[ "$ATDM_CONFIG_COMPILER" == "GNU"* || \
"$ATDM_CONFIG_COMPILER" == "XL"* ]]; then
if [[ "$ATDM_CONFIG_KOKKOS_ARCH" == "DEFAULT" || \
"$ATDM_CONFIG_KOKKOS_ARCH" == "Power9" ]] ; then
export ATDM_CONFIG_KOKKOS_ARCH=Power9
else
echo
echo "***"
echo "*** ERROR: KOKKOS_ARCH=$ATDM_CONFIG_KOKKOS_ARCH is not a valid option"
echo "*** for the compiler GNU. Replace '$ATDM_CONFIG_KOKKOS_ARCH' in the"
echo "*** job name with 'Power9'"
echo "***"
return
fi
elif [[ "$ATDM_CONFIG_COMPILER" == "CUDA"* ]] ; then
if [[ "$ATDM_CONFIG_KOKKOS_ARCH" == "DEFAULT" || \
"$ATDM_CONFIG_KOKKOS_ARCH" == "Power9" || \
"$ATDM_CONFIG_KOKKOS_ARCH" == "Volta70" ]] ; then
export ATDM_CONFIG_KOKKOS_ARCH=Power9,Volta70
else
echo
echo "***"
echo "*** ERROR: KOKKOS_ARCH=$ATDM_CONFIG_KOKKOS_ARCH is not a valid option"
echo "*** for the CUDA compiler. Replace '$ATDM_CONFIG_KOKKOS_ARCH' in the"
echo "*** job name with one of the following options:"
echo "***"
echo "*** 'Volta70' Power9 with Volta V-100 GPU (Default)"
echo "***"
return
fi
else
echo
echo "***"
echo "*** ERROR: COMPILER=$ATDM_CONFIG_COMPILER is not supported on this system!"
echo "***"
return
fi
echo "Using $ATDM_CONFIG_SYSTEM_NAME compiler stack $ATDM_CONFIG_COMPILER to build $ATDM_CONFIG_BUILD_TYPE code with Kokkos node type $ATDM_CONFIG_NODE_TYPE"
# Some basic settings
export ATDM_CONFIG_ENABLE_SPARC_SETTINGS=ON
export ATDM_CONFIG_USE_NINJA=ON
export ATDM_CONFIG_BUILD_COUNT=8 # Assume building on the shared login node!
# Set ctest -j parallel level for non-CUDA builds
if [ "$ATDM_CONFIG_NODE_TYPE" == "OPENMP" ] ; then
export ATDM_CONFIG_CTEST_PARALLEL_LEVEL=8
export OMP_NUM_THREADS=2
else
export ATDM_CONFIG_CTEST_PARALLEL_LEVEL=16
fi
# Purge then load StdEnv to get back to a fresh env in case previous other
# modules were loaded.
module purge --silent
module load StdEnv
# Load the sparc-dev/xxx module
sparc_module_name=$(get_sparc_dev_module_name "$ATDM_CONFIG_COMPILER")
module load ${sparc_module_name}
# Set up stuff related the the host compiler
if [[ "$ATDM_CONFIG_COMPILER" == *"GNU"* ]]; then
export COMPILER_ROOT=/usr/tce/packages/gcc/gcc-7.3.1
export LD_LIBRARY_PATH=${COMPILER_ROOT}/lib:${LD_LIBRARY_PATH}
export BINUTILS_ROOT=${COMPILER_ROOT}
export LIBRARY_PATH=${BINUTILS_ROOT}/lib
export LIBRARY_PATH=${CBLAS_ROOT}/lib:${LIBRARY_PATH}
export INCLUDE=${BINUTILS_ROOT}/include:${INCLUDE}
export CPATH=${BINUTILS_ROOT}/include:${CPATH}
# ToDo: Add support for xl when needed
fi
# Set up stuff related to CUDA
if [[ "$ATDM_CONFIG_COMPILER" == "CUDA"* ]]; then
export CUDA_BIN_PATH=$CUDA_HOME
# OpenMPI Settings
export OMPI_CXX=${ATDM_CONFIG_NVCC_WRAPPER}
if [ ! -x "$OMPI_CXX" ]; then
echo "No nvcc_wrapper found"
return
fi
# NOTE: The above export overrides the value set by the module load above
# CUDA Settings
if [[ ! -d /tmp/${USER} ]] ; then
echo "Creating /tmp/${USER} for nvcc wrapper!"
mkdir /tmp/${USER}
fi
# ATDM Settings
export ATDM_CONFIG_USE_CUDA=ON
export ATDM_CONFIG_USE_OPENMP=OFF
export ATDM_CONFIG_USE_PTHREADS=OFF
export ATDM_CONFIG_CTEST_PARALLEL_LEVEL=4
# Kokkos Settings
export ATDM_CONFIG_Kokkos_ENABLE_SERIAL=ON
export KOKKOS_NUM_DEVICES=4
# CTEST Settings
# Trilinos_CTEST_RUN_CUDA_AWARE_MPI is used by ats2/local-driver.sh
export Trilinos_CTEST_RUN_CUDA_AWARE_MPI=1
fi
#
# Final setup for all build configurations
#
# Prepend path to ninja after all of the modules are loaded
export PATH=/projects/atdm_devops/vortex/ninja-fortran-1.8.2:$PATH
# Prepend path to updated and patched CMake 3.17.2
module unload cmake
export PATH=/projects/atdm_devops/vortex/cmake-3.17.2/bin:$PATH
# Set a standard git so everyone has the same git
module load git/2.20.0
# ATDM specific config variables
export ATDM_CONFIG_LAPACK_LIBS="-L${LAPACK_ROOT}/lib;-llapack;-lgfortran;-lgomp"
export ATDM_CONFIG_BLAS_LIBS="-L${BLAS_ROOT}/lib;-lblas;-lgfortran;-lgomp;-lm"
# NOTE: Invalid libbfd.so requires below for Trilinos to compile
export ATDM_CONFIG_BINUTILS_LIBS="${BINUTILS_ROOT}/lib/libbfd.a;-lz;${BINUTILS_ROOT}/lib/libiberty.a"
export ATDM_CONFIG_USE_HWLOC=OFF
export ATDM_CONFIG_HDF5_LIBS="-L${HDF5_ROOT}/lib;${HDF5_ROOT}/lib/libhdf5_hl.a;${HDF5_ROOT}/lib/libhdf5.a;-lz;-ldl"
export ATDM_CONFIG_NETCDF_LIBS="-L${NETCDF_ROOT}/lib;${NETCDF_ROOT}/lib/libnetcdf.a;${PNETCDF_ROOT}/lib/libpnetcdf.a;${ATDM_CONFIG_HDF5_LIBS};-lcurl"
export ATDM_CONFIG_SUPERLUDIST_INCLUDE_DIRS=${SUPERLUDIST_ROOT}/include
export ATDM_CONFIG_SUPERLUDIST_LIBS="${SUPERLUDIST_ROOT}/lib64/libsuperlu_dist.a"
# Set common MPI wrappers
export MPICC=`which mpicc`
export MPICXX=`which mpicxx`
export MPIF90=`which mpif90`
export ATDM_CONFIG_MPI_EXEC=${ATDM_SCRIPT_DIR}/ats2/trilinos_jsrun
export ATDM_CONFIG_MPI_POST_FLAGS="--rs_per_socket;4"
export ATDM_CONFIG_MPI_EXEC_NUMPROCS_FLAG="-p"
# System-info for what ATS-2 system we are using
if [[ "${ATDM_CONFIG_KNOWN_HOSTNAME}" == "vortex" ]] ; then
export ATDM_CONFIG_ATS2_LOGIN_NODE=vortex60
export ATDM_CONFIG_ATS2_LAUNCH_NODE=vortex59
# NOTE: If more login and launch nodes gets added to 'vortex', we will need
# to change this to a list of node names instead of just one. But we will
# deal with that later if that occurs.
else
echo "Error, the ats2 env on system '${ATDM_CONFIG_KNOWN_HOSTNAME}'"
return
fi
#
# Define functions for running on compute nodes
#
function atdm_ats2_get_allocated_compute_node_name() {
if [[ "${LSB_HOSTS}" != "" ]] ; then
echo ${LSB_HOSTS} | cut -d' ' -f2
else
echo
fi
}
export -f atdm_ats2_get_allocated_compute_node_name
function atdm_ats2_get_node_type() {
current_hostname=$(hostname)
if [[ "${current_hostname}" == "${ATDM_CONFIG_ATS2_LOGIN_NODE}" ]] ; then
echo "login_node"
elif [[ "${current_hostname}" == "${ATDM_CONFIG_ATS2_LAUNCH_NODE}" ]] ; then
echo "launch_node"
else
echo "compute_node"
fi
}
export -f atdm_ats2_get_node_type
#
# All done!
#
export ATDM_CONFIG_COMPLETED_ENV_SETUP=TRUE