Skip to content

Commit 09817f0

Browse files
authored
Rework libcuspatial CMakeLists.txt to export targets for CPM (#365)
This PR includes many of the same changes as were made in [cudf/pull/7107](rapidsai/cudf#7107). * Export `cuspatial::cuspatial` CMake alias targets. * Fixes -Wall errors discovered when changing compile flags. * Use `CPMFindPackage` to find `libcudf` installed on the system or build `libcudf` from source. edit: Depends on rapidsai/cudf#7574 and rapidsai/cudf#7734 Authors: - Paul Taylor (@trxcllnt) Approvers: - AJ Schmidt (@ajschmidt8) - Mark Harris (@harrism) - Keith Kraus (@kkraus14) URL: #365
1 parent 5dedd86 commit 09817f0

28 files changed

+720
-657
lines changed

build.sh

+23-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ARGS=$*
1818
# script, and that this script resides in the repo dir!
1919
REPODIR=$(cd $(dirname $0); pwd)
2020

21-
VALIDARGS="clean libcuspatial cuspatial tests -v -g -n -h --show_depr_warn"
21+
VALIDARGS="clean libcuspatial cuspatial tests -v -g -n -h --allgpuarch --show_depr_warn"
2222
HELP="$0 [clean] [libcuspatial] [cuspatial] [tests] [-v] [-g] [-n] [-h] [-l] [--show_depr_warn]
2323
clean - remove all existing build artifacts and configuration (start
2424
over)
@@ -29,6 +29,7 @@ HELP="$0 [clean] [libcuspatial] [cuspatial] [tests] [-v] [-g] [-n] [-h] [-l] [--
2929
-g - build for debug
3030
-n - no install step
3131
-h - print this text
32+
--allgpuarch - build for all supported GPU architectures
3233
--show_depr_warn - show cmake deprecation warnings
3334
default action (no args) is to build and install 'libcuspatial' then
3435
'cuspatial' targets
@@ -41,6 +42,7 @@ BUILD_DIRS="${LIBCUSPATIAL_BUILD_DIR} ${CUSPATIAL_BUILD_DIR}"
4142
VERBOSE_FLAG=""
4243
BUILD_TESTS=OFF
4344
BUILD_TYPE=Release
45+
BUILD_ALL_GPU_ARCH=0
4446
INSTALL_TARGET=install
4547
BUILD_DISABLE_DEPRECATION_WARNING=ON
4648

@@ -79,7 +81,10 @@ fi
7981
if hasArg -n; then
8082
INSTALL_TARGET=""
8183
fi
82-
if hasArg --show-_depr_warn; then
84+
if hasArg --allgpuarch; then
85+
BUILD_ALL_GPU_ARCH=1
86+
fi
87+
if hasArg --show_depr_warn; then
8388
BUILD_DISABLE_DEPRECATION_WARNING=OFF
8489
fi
8590

@@ -101,19 +106,32 @@ if hasArg clean; then
101106
done
102107
fi
103108

109+
if (( ${BUILD_ALL_GPU_ARCH} == 0 )); then
110+
CUSPATIAL_CMAKE_CUDA_ARCHITECTURES="-DCMAKE_CUDA_ARCHITECTURES="
111+
echo "Building for the architecture of the GPU in the system..."
112+
else
113+
CUSPATIAL_CMAKE_CUDA_ARCHITECTURES=""
114+
echo "Building for *ALL* supported GPU architectures..."
115+
fi
116+
104117
################################################################################
105118
# Configure, build, and install libcuspatial
106119
if (( ${NUMARGS} == 0 )) || hasArg libcuspatial; then
107-
108120
mkdir -p ${LIBCUSPATIAL_BUILD_DIR}
109121
cd ${LIBCUSPATIAL_BUILD_DIR}
110122
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
123+
${CUSPATIAL_CMAKE_CUDA_ARCHITECTURES} \
111124
-DCMAKE_CXX11_ABI=ON \
112125
-DBUILD_TESTS=${BUILD_TESTS} \
113126
-DDISABLE_DEPRECATION_WARNING=${BUILD_DISABLE_DEPRECATION_WARNING} \
114-
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} ..
127+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
128+
..
115129

116-
cmake --build . -j ${PARALLEL_LEVEL} --target install ${VERBOSE_FLAG}
130+
cmake --build . -j ${PARALLEL_LEVEL} ${VERBOSE_FLAG}
131+
132+
if [[ ${INSTALL_TARGET} != "" ]]; then
133+
cmake --build . -j ${PARALLEL_LEVEL} --target install ${VERBOSE_FLAG}
134+
fi
117135
fi
118136

119137
# Build and install the cuspatial Python package
@@ -127,4 +145,3 @@ if (( ${NUMARGS} == 0 )) || hasArg cuspatial; then
127145
PARALLEL_LEVEL=${PARALLEL_LEVEL} python setup.py build_ext --inplace --library-dir=${LIBCUSPATIAL_BUILD_DIR}
128146
fi
129147
fi
130-

conda/environments/cuspatial_dev_cuda10.1.yml

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ dependencies:
1414
- geopandas=0.7.0
1515
- cmake>=3.14
1616
- cython>=0.29,<0.30
17+
- gtest
18+
- gmock

conda/environments/cuspatial_dev_cuda10.2.yml

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ dependencies:
1414
- geopandas=0.7.0
1515
- cmake>=3.14
1616
- cython>=0.29,<0.30
17+
- gtest
18+
- gmock

conda/environments/cuspatial_dev_cuda11.0.yml

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ dependencies:
1414
- geopandas=0.7.0
1515
- cmake>=3.14
1616
- cython>=0.29,<0.30
17+
- gtest
18+
- gmock

conda/recipes/libcuspatial/build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# build cuspatial with verbose output
44
if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then
5-
./build.sh -v libcuspatial
5+
./build.sh -v libcuspatial --allgpuarch
66
else
7-
./build.sh -v libcuspatial tests
7+
./build.sh -v libcuspatial tests --allgpuarch
88
fi

conda/recipes/libcuspatial/meta.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ build:
3333

3434
requirements:
3535
build:
36-
- cmake >=3.12.4
36+
- cmake >=3.18
3737
host:
3838
- libcudf {{ minor_version }}.*
3939
- librmm {{ minor_version }}.*
@@ -52,4 +52,3 @@ about:
5252
license_family: Apache
5353
license_file: LICENSE
5454
summary: libcuspatial library
55-

0 commit comments

Comments
 (0)