-
Notifications
You must be signed in to change notification settings - Fork 1
/
100-build-kokkos
executable file
·72 lines (60 loc) · 1.84 KB
/
100-build-kokkos
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 -l
#
# IPPL Toolchain Build recipe for Kokkos
#
P=kokkos
V_MAJOR=4
V_MINOR=1
V=${V_MAJOR}.${V_MINOR}.00
# Default to serial if no backend specified
build_type=${build_type:-serial}
NJOBS=${NJOBS:-16}
compute_capability=${compute_capability:-AMPERE80}
cpu_arch=${cpu_arch:-NATIVE}
trap "itb_exit" EXIT
FNAME="$P-$V.tar.gz"
DOWNLOAD_URL="https://github.com/kokkos/kokkos/archive/$V/${FNAME}"
SRC_FILE="${ITB_DOWNLOAD_DIR}/${FNAME}"
if [ ! -f "$SRC_FILE" ]; then
# download
curl -L \
--output "${SRC_FILE}" \
"$DOWNLOAD_URL"
# unpack
mkdir -p "${ITB_SRC_DIR}/$P" && cd "$_" || exit "${ITB_ERR_SYSTEM}"
tar xvf "${SRC_FILE}" || exit "${ITB_ERR_UNTAR}"
fi
compiler=${compiler:-"$(which gcc)"}
NVCC_WRAPPER_DEFAULT_COMPILER=${NVCC_WRAPPER_DEFAULT_COMPILER:-$compiler}
CUDA=${CUDA:-OFF}
SERIAL=${SERIAL:-OFF}
OPENMP=${OPENMP:-OFF}
if [[ "$build_type" == "cuda" ]]; then
CUDA=ON
SERIAL=ON
elif [[ "$build_type" == "serial" ]]; then
SERIAL=ON
elif [[ "$build_type" == "openmp" ]]; then
OPENMP=ON
fi
if [ "$CUDA" == "ON" ]; then
compiler="${ITB_SRC_DIR}/$P/$P-$V/bin/nvcc_wrapper"
fi
mkdir -p "${ITB_SRC_DIR}/$P"/"build_$build_type" && cd "$_" || exit "${ITB_ARG_ERR}"
cmake \
-DCMAKE_INSTALL_PREFIX="/psi/home/adelmann/git/ippl-build-scripts/install_${build_type}" \
-DCMAKE_CXX_COMPILER="${compiler}" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_CXX_EXTENSIONS=OFF \
-DKokkos_ENABLE_SERIAL="${SERIAL}" \
-DKokkos_ARCH_"${compute_capability}"="${CUDA}" \
-DKokkos_ARCH_"${cpu_arch}"=ON \
-DKokkos_ENABLE_OPENMP="${OPENMP}" \
-DKokkos_ENABLE_CUDA="${CUDA}" \
-DKokkos_ENABLE_CUDA_LAMBDA="${CUDA}" \
-DKokkos_ENABLE_CUDA_UVM=OFF \
"${ITB_SRC_DIR}"/$P/$P-$V || exit "${ITB_ERR_CONFIGURE}"
# compile & install
make -j "${NJOBS}"
make install