11#! /bin/bash
22
3- # Copyright (c) 2019-2021 , NVIDIA CORPORATION.
3+ # Copyright (c) 2019-2022 , NVIDIA CORPORATION.
44
55# cugraph build script
66
@@ -20,26 +20,25 @@ REPODIR=$(cd $(dirname $0); pwd)
2020LIBCUGRAPH_BUILD_DIR=${LIBCUGRAPH_BUILD_DIR:= ${REPODIR} / cpp/ build}
2121LIBCUGRAPH_ETL_BUILD_DIR=${LIBCUGRAPH_ETL_BUILD_DIR:= ${REPODIR} / cpp/ libcugraph_etl/ build}
2222
23- VALIDARGS=" clean uninstall libcugraph libcugraph_etl cugraph pylibcugraph cpp-mgtests docs -v -g -n --allgpuarch --buildfaiss --show_depr_warn --skip_cpp_tests -h --help"
23+ VALIDARGS=" clean uninstall uninstall_cmake_deps libcugraph libcugraph_etl cugraph pylibcugraph cpp-mgtests docs -v -g -n --allgpuarch --skip_cpp_tests -h --help"
2424HELP=" $0 [<target> ...] [<flag> ...]
2525 where <target> is:
26- clean - remove all existing build artifacts and configuration (start over)
27- uninstall - uninstall libcugraph and cugraph from a prior build/install (see also -n)
28- libcugraph - build libcugraph.so and SG test binaries
29- libcugraph_etl - build libcugraph_etl.so and SG test binaries
30- cugraph - build the cugraph Python package
31- pylibcugraph - build the pylibcugraph Python package
32- cpp-mgtests - build libcugraph and libcugraph_etl MG tests. Builds MPI communicator, adding MPI as a dependency.
33- docs - build the docs
26+ clean - remove all existing build artifacts and configuration (start over)
27+ uninstall - uninstall libcugraph and cugraph from a prior build/install (see also -n)
28+ uninstall_cmake_deps - uninstall headers from external dependencies installed by cmake (raft, rmm, cuco, etc.) (see also -n)
29+ libcugraph - build libcugraph.so and SG test binaries
30+ libcugraph_etl - build libcugraph_etl.so and SG test binaries
31+ cugraph - build the cugraph Python package
32+ pylibcugraph - build the pylibcugraph Python package
33+ cpp-mgtests - build libcugraph and libcugraph_etl MG tests. Builds MPI communicator, adding MPI as a dependency.
34+ docs - build the docs
3435 and <flag> is:
35- -v - verbose build mode
36- -g - build for debug
37- -n - do not install after a successful build
38- --allgpuarch - build for all supported GPU architectures
39- --buildfaiss - build faiss statically into cugraph
40- --show_depr_warn - show cmake deprecation warnings
41- --skip_cpp_tests - do not build the SG test binaries as part of the libcugraph and libcugraph_etl targets
42- -h - print this text
36+ -v - verbose build mode
37+ -g - build for debug
38+ -n - do not install after a successful build
39+ --allgpuarch - build for all supported GPU architectures
40+ --skip_cpp_tests - do not build the SG test binaries as part of the libcugraph and libcugraph_etl targets
41+ -h - print this text
4342
4443 default action (no args) is to build and install 'libcugraph' then 'libcugraph_etl' then 'pylibcugraph' then 'cugraph' then 'docs' targets
4544
@@ -52,12 +51,11 @@ BUILD_DIRS="${LIBCUGRAPH_BUILD_DIR} ${LIBCUGRAPH_ETL_BUILD_DIR} ${CUGRAPH_BUILD_
5251
5352# Set defaults for vars modified by flags to this script
5453VERBOSE_FLAG=" "
54+ CMAKE_VERBOSE_OPTION=" "
5555BUILD_TYPE=Release
5656INSTALL_TARGET=install
57- BUILD_DISABLE_DEPRECATION_WARNING=ON
5857BUILD_CPP_TESTS=ON
5958BUILD_CPP_MG_TESTS=OFF
60- BUILD_STATIC_FAISS=OFF
6159BUILD_ALL_GPU_ARCH=0
6260
6361# Set defaults for vars that may not have been defined externally
9391# Process flags
9492if hasArg -v; then
9593 VERBOSE_FLAG=" -v"
94+ CMAKE_VERBOSE_OPTION=" --log-level=VERBOSE"
9695fi
9796if hasArg -g; then
9897 BUILD_TYPE=Debug
103102if hasArg --allgpuarch; then
104103 BUILD_ALL_GPU_ARCH=1
105104fi
106- if hasArg --buildfaiss; then
107- BUILD_STATIC_FAISS=ON
108- fi
109- if hasArg --show_depr_warn; then
110- BUILD_DISABLE_DEPRECATION_WARNING=OFF
111- fi
112105if hasArg --skip_cpp_tests; then
113106 BUILD_CPP_TESTS=OFF
114107fi
115108if hasArg cpp-mgtests; then
116109 BUILD_CPP_MG_TESTS=ON
117110fi
118111
119- # If clean or uninstall given, run them prior to any other steps
112+ # If clean or uninstall targets given, run them prior to any other steps
120113if hasArg uninstall; then
121- # uninstall libcugraph
122114 if [[ " $INSTALL_PREFIX " != " " ]]; then
123115 rm -rf ${INSTALL_PREFIX} /include/cugraph
124116 rm -f ${INSTALL_PREFIX} /lib/libcugraph.so
125117 rm -rf ${INSTALL_PREFIX} /include/cugraph_c
126118 rm -f ${INSTALL_PREFIX} /lib/libcugraph_c.so
127119 rm -rf ${INSTALL_PREFIX} /include/cugraph_etl
128120 rm -f ${INSTALL_PREFIX} /lib/libcugraph_etl.so
121+ rm -rf ${INSTALL_PREFIX} /lib/cmake/cugraph
122+ rm -rf ${INSTALL_PREFIX} /lib/cmake/cugraph_etl
129123 fi
130124 # This may be redundant given the above, but can also be used in case
131125 # there are other installed files outside of the locations above.
@@ -134,9 +128,25 @@ if hasArg uninstall; then
134128 fi
135129 # uninstall cugraph and pylibcugraph installed from a prior "setup.py
136130 # install"
131+ # FIXME: if multiple versions of these packages are installed, this only
132+ # removes the latest one and leaves the others installed. build.sh uninstall
133+ # can be run multiple times to remove all of them, but that is not obvious.
137134 pip uninstall -y cugraph pylibcugraph
138135fi
139136
137+ if hasArg uninstall_cmake_deps; then
138+ if [[ " $INSTALL_PREFIX " != " " ]]; then
139+ rm -rf ${INSTALL_PREFIX} /include/raft
140+ rm -rf ${INSTALL_PREFIX} /lib/cmake/raft
141+ rm -rf ${INSTALL_PREFIX} /include/cub
142+ rm -rf ${INSTALL_PREFIX} /lib/cmake/cub
143+ rm -rf ${INSTALL_PREFIX} /include/cuco
144+ rm -rf ${INSTALL_PREFIX} /lib/cmake/cuco
145+ rm -rf ${INSTALL_PREFIX} /include/rmm
146+ rm -rf ${INSTALL_PREFIX} /lib/cmake/rmm
147+ fi
148+ fi
149+
140150if hasArg clean; then
141151 # Ignore errors for clean since missing files, etc. are not failures
142152 set +e
@@ -151,6 +161,7 @@ if hasArg clean; then
151161 find . -name " __pycache__" -type d -exec rm -rf {} \; > /dev/null 2>&1
152162 find . -name " *.cpp" -type f -delete
153163 find . -name " *.cpython*.so" -type f -delete
164+ find . -type d -name _external_repositories -exec rm -rf {} \; > /dev/null 2>&1
154165 popd > /dev/null
155166 fi
156167
@@ -180,14 +191,13 @@ if buildAll || hasArg libcugraph; then
180191 fi
181192 mkdir -p ${LIBCUGRAPH_BUILD_DIR}
182193 cd ${LIBCUGRAPH_BUILD_DIR}
183- cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
194+ cmake -B " ${LIBCUGRAPH_BUILD_DIR} " -S " ${REPODIR} /cpp" \
195+ -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
184196 -DCMAKE_CUDA_ARCHITECTURES=${CUGRAPH_CMAKE_CUDA_ARCHITECTURES} \
185- -DDISABLE_DEPRECATION_WARNING=${BUILD_DISABLE_DEPRECATION_WARNING} \
186197 -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
187- -DBUILD_STATIC_FAISS=${BUILD_STATIC_FAISS} \
188198 -DBUILD_TESTS=${BUILD_CPP_TESTS} \
189199 -DBUILD_CUGRAPH_MG_TESTS=${BUILD_CPP_MG_TESTS} \
190- ${REPODIR} /cpp
200+ ${CMAKE_VERBOSE_OPTION}
191201 cmake --build " ${LIBCUGRAPH_BUILD_DIR} " -j${PARALLEL_LEVEL} --target ${INSTALL_TARGET} ${VERBOSE_FLAG}
192202fi
193203
@@ -207,7 +217,8 @@ if buildAll || hasArg libcugraph_etl; then
207217 -DDISABLE_DEPRECATION_WARNING=${BUILD_DISABLE_DEPRECATION_WARNING} \
208218 -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
209219 -DBUILD_TESTS=${BUILD_CPP_TESTS} \
210- -DBUILD_CUGRAPH_MG_TESTS=${BUILD_CPP_MG_TESTS} --log-level=VERBOSE \
220+ -DBUILD_CUGRAPH_MG_TESTS=${BUILD_CPP_MG_TESTS} \
221+ ${CMAKE_VERBOSE_OPTION} \
211222 ${REPODIR} /cpp/libcugraph_etl
212223 cmake --build " ${LIBCUGRAPH_ETL_BUILD_DIR} " -j${PARALLEL_LEVEL} --target ${INSTALL_TARGET} ${VERBOSE_FLAG}
213224fi
@@ -242,10 +253,10 @@ if buildAll || hasArg docs; then
242253 if [ ! -d ${LIBCUGRAPH_BUILD_DIR} ]; then
243254 mkdir -p ${LIBCUGRAPH_BUILD_DIR}
244255 cd ${LIBCUGRAPH_BUILD_DIR}
245- cmake -DCMAKE_INSTALL_PREFIX= ${INSTALL_PREFIX} \
246- -DDISABLE_DEPRECATION_WARNING =${BUILD_DISABLE_DEPRECATION_WARNING } \
247- -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${REPODIR} /cpp \
248- -DBUILD_STATIC_FAISS= ${BUILD_STATIC_FAISS }
256+ cmake -B " ${LIBCUGRAPH_BUILD_DIR} " -S " ${REPODIR} /cpp " \
257+ -DCMAKE_INSTALL_PREFIX =${INSTALL_PREFIX } \
258+ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
259+ ${CMAKE_VERBOSE_OPTION }
249260 fi
250261 cd ${LIBCUGRAPH_BUILD_DIR}
251262 cmake --build " ${LIBCUGRAPH_BUILD_DIR} " -j${PARALLEL_LEVEL} --target docs_cugraph ${VERBOSE_FLAG}
0 commit comments