forked from rapidsai/legate-boost
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·80 lines (63 loc) · 2.56 KB
/
build.sh
File metadata and controls
executable file
·80 lines (63 loc) · 2.56 KB
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
#!/usr/bin/env bash
set -e -E -u -o pipefail
NUMARGS=$#
ARGS=$*
HELP="$0 [<target> ...] [<flag> ...]
Build legateboost components.
where <target> is any of:
liblegateboost - build the liblegateboost.so shared library
legate-boost - build and 'pip install' the legate-boost Python package
clang-tidy - run clang-tidy on the codebase
where <flag> is any of:
--editable - install Python wheel in editable mode
--fix - clang-tidy will attempt to fix issues.
-h | --help - print the help text
"
function hasArg {
(( NUMARGS != 0 )) && (echo " ${ARGS} " | grep -q " $1 ")
}
if hasArg -h || hasArg --help; then
echo "${HELP}"
exit 0
fi
# Set defaults for vars modified by flags to this script
PIP_INSTALL_ARGS=(
--no-build-isolation
--no-deps
)
# ensure 'native' is used if CUDAARCHS isn't set
# (instead of the CMake default which is a specific architecture)
# ref: https://cmake.org/cmake/help/latest/variable/CMAKE_CUDA_ARCHITECTURES.html
declare -r CMAKE_CUDA_ARCHITECTURES="${CUDAARCHS:-native}"
if hasArg --editable; then
PIP_INSTALL_ARGS+=("--editable")
fi
legate_root=$(
python -c 'import legate.install_info as i; from pathlib import Path; print(Path(i.libpath).parent.resolve())'
)
if hasArg liblegateboost || hasArg --editable; then
echo "building liblegateboost..."
echo "Using Legate at '${legate_root}'"
cmake -S . -B build -Dlegate_ROOT="${legate_root}" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_ARCHITECTURES="${CMAKE_CUDA_ARCHITECTURES}"
cmake --build build -j
echo "done building liblegateboost"
fi
if hasArg clang-tidy; then
echo "running clang-tidy..."
# Build the project with clang
CUDA_ROOT="$(dirname "$(dirname "$(which cuda-gdb)")")"
echo "Using CUDA at '${CUDA_ROOT}'"
cmake . -B build_clang_tidy -Dlegate_ROOT="${legate_root}" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_ARCHITECTURES="${CMAKE_CUDA_ARCHITECTURES}" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CUDA_HOST_COMPILER=clang++ -DCMAKE_CUDA_COMPILER=clang++ -DCUDAToolkit_ROOT="${CUDA_ROOT}" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
FIX_ARG=""
if hasArg --fix; then
FIX_ARG="-fix"
fi
run-clang-tidy -p build_clang_tidy ${FIX_ARG} -exclude-header-filter='.*\/legate\/.*|.*\/libcudacxx\/.*' -header-filter='.*'
echo "done running clang-tidy"
fi
if hasArg legate-boost; then
echo "building legate-boost Python package..."
CUDAARCHS="${CMAKE_CUDA_ARCHITECTURES}" \
python -m pip install "${PIP_INSTALL_ARGS[@]}" .
echo "done building legate-boost Python package"
fi