From d99d0a431d5726c3ec0602c0a205b2d986d3dfdd Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Mon, 7 Nov 2022 16:57:22 -0500 Subject: [PATCH 1/3] Updating minimum gcc version (and a couple other things) --- README.md | 7 ++++--- docs/source/build.md | 11 ++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 79ab874c27..42b14f8542 100755 --- a/README.md +++ b/README.md @@ -20,10 +20,11 @@ While not exhaustive, the following general categories help summarize the accele | **Statistics** | sampling, moments and summary statistics, metrics | | **Tools & Utilities** | common utilities for developing CUDA applications, multi-node multi-gpu infrastructure | -RAFT provides a header-only C++ library and pre-compiled shared libraries that can 1) speed up compile times and 2) enable the APIs to be used without CUDA-enabled compilers. + +All of RAFT's C++ APIs can be accessed header-only and optional pre-compiled shared libraries can 1) speed up compile times and 2) enable the APIs to be used without CUDA-enabled compilers. In addition to the C++ library, RAFT also provides 2 Python libraries: -- `pylibraft` - lightweight low-level Python wrappers around RAFT algorithms and primitives. +- `pylibraft` - lightweight low-level Python wrappers around RAFT's host-accessable APIs. - `raft-dask` - multi-node multi-GPU communicator infrastructure for building distributed algorithms on the GPU with Dask. ## Getting started @@ -78,7 +79,7 @@ raft::distance::pairwise_distance(handle, input.view(), input.view(), output.vie ### Python Example -The `pylibraft` package contains a Python API for RAFT algorithms and primitives. `pylibraft` integrates nicely into other libraries by being very lightweight with minimal dependencies and accepting any object that supports the `__cuda_array_interface__`, such as [CuPy's ndarray](https://docs.cupy.dev/en/stable/user_guide/interoperability.html#rmm). The package is currently limited to pairwise distances and RMAT graph generation, but we will continue adding more in future releases. +The `pylibraft` package contains a Python API for RAFT algorithms and primitives. `pylibraft` integrates nicely into other libraries by being very lightweight with minimal dependencies and accepting any object that supports the `__cuda_array_interface__`, such as [CuPy's ndarray](https://docs.cupy.dev/en/stable/user_guide/interoperability.html#rmm). The number of RAFT algorithms exposed in this package is continuing to grow from release to release. The example below demonstrates computing the pairwise Euclidean distances between CuPy arrays. `pylibraft` is a low-level API that prioritizes efficiency and simplicity over being pythonic, which is shown here by pre-allocating the output memory before invoking the `pairwise_distance` function. Note that CuPy is not a required dependency for `pylibraft`. diff --git a/docs/source/build.md b/docs/source/build.md index b75e67d82f..0aecad4d9a 100644 --- a/docs/source/build.md +++ b/docs/source/build.md @@ -3,6 +3,7 @@ ## Building and installing RAFT ### CUDA/GPU Requirements +- GCC 9.0+ (9.5.0+ recommended) - CUDA Toolkit 11.0+ - NVIDIA driver 450.80.02+ - Pascal architecture of better (compute capability >= 6.0) @@ -18,14 +19,14 @@ In addition to the libraries included with cudatoolkit 11.0+, there are some oth #### Optional - [cuCollections](https://github.com/NVIDIA/cuCollections) - Used in `raft::sparse::distance` API. - [Libcu++](https://github.com/NVIDIA/libcudacxx) v1.7.0 -- [FAISS](https://github.com/facebookresearch/faiss) v1.7.0 - Used in `raft::spatial::knn` API and needed to build tests. -- [NCCL](https://github.com/NVIDIA/nccl) - Used in `raft::comms` API and needed to build `raft-dask` -- [UCX](https://github.com/openucx/ucx) - Used in `raft::comms` API and needed to build `raft-dask` +- [FAISS](https://github.com/facebookresearch/faiss) v1.7.0 - Used in `raft::neighbors` API.. +- [NCCL](https://github.com/NVIDIA/nccl) - Used in `raft::comms` API and needed to build `raft-dask`. +- [UCX](https://github.com/openucx/ucx) - Used in `raft::comms` API and needed to build `raft-dask`. - [Googletest](https://github.com/google/googletest) - Needed to build tests - [Googlebench](https://github.com/google/benchmark) - Needed to build benchmarks - [Doxygen](https://github.com/doxygen/doxygen) - Needed to build docs -C++ RAFT is a header-only library but provides the option of building shared libraries with template instantiations for common types to speed up compile times for larger projects. +All of RAFT's C++ APIs can be used header-only but pre-compiled shared libraries also contain some host-accessable APIs and template instantiations to accelerate compile times. The recommended way to build and install RAFT is to use the `build.sh` script in the root of the repository. This script can build both the C++ and Python artifacts and provides options for building and installing the headers, tests, benchmarks, and individual shared libraries. @@ -189,7 +190,7 @@ There are two different strategies for including RAFT in downstream projects, de ### C++ header-only integration using cmake -When the needed [build dependencies](#required_depenencies) are already satisfied, RAFT can be trivially integrated into downstream projects by cloning the repository and adding `cpp/include` from RAFT to the include path: +When the needed [build dependencies](#build-dependencies) are already satisfied, RAFT can be trivially integrated into downstream projects by cloning the repository and adding `cpp/include` from RAFT to the include path: ```cmake set(RAFT_GIT_DIR ${CMAKE_CURRENT_BINARY_DIR}/raft CACHE STRING "Path to RAFT repo") ExternalProject_Add(raft From f29e60026306821db8b156bde16167dd0a4c561b Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Mon, 7 Nov 2022 16:59:19 -0500 Subject: [PATCH 2/3] Using nightly branch --- README.md | 2 +- docs/source/build.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 42b14f8542..ddaf8b3f8d 100755 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ After [installing](https://github.com/rapidsai/rapids-cmake#installation) rapids ```cmake -set(RAFT_VERSION "22.04") +set(RAFT_VERSION "22.12") set(RAFT_FORK "rapidsai") set(RAFT_PINNED_TAG "branch-${RAFT_VERSION}") diff --git a/docs/source/build.md b/docs/source/build.md index 0aecad4d9a..7c22fa35b7 100644 --- a/docs/source/build.md +++ b/docs/source/build.md @@ -227,7 +227,7 @@ The following `cmake` snippet enables a flexible configuration of RAFT: ```cmake -set(RAFT_VERSION "22.10") +set(RAFT_VERSION "22.12") set(RAFT_FORK "rapidsai") set(RAFT_PINNED_TAG "branch-${RAFT_VERSION}") From 38349cc3111bd83edaf3469510b3270fe2c0c5ab Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Tue, 8 Nov 2022 15:18:14 -0500 Subject: [PATCH 3/3] Updating build docs to be a little more explict --- docs/source/build.md | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/docs/source/build.md b/docs/source/build.md index 7c22fa35b7..c3ae659981 100644 --- a/docs/source/build.md +++ b/docs/source/build.md @@ -3,6 +3,7 @@ ## Building and installing RAFT ### CUDA/GPU Requirements +- cmake 3.23.1+ - GCC 9.0+ (9.5.0+ recommended) - CUDA Toolkit 11.0+ - NVIDIA driver 450.80.02+ @@ -183,12 +184,33 @@ The following will build the docs along with the C++ and Python packages: ``` - ## Using RAFT in downstream projects -There are two different strategies for including RAFT in downstream projects, depending on whether or not the required dependencies are already installed and available on the `lib` and `include` paths. +There are a few different strategies for including RAFT in downstream projects, depending on whether the [required build dependencies](#build-dependencies) have already been installed and are available on the `lib` and `include` paths. + +Using cmake, you can enable CUDA support right in your project's declaration: +```cmake +project(YOUR_PROJECT VERSION 0.1 LANGUAGES CXX CUDA) +``` + +Please note that some additional compiler flags might need to be added when building against RAFT. For example, if you see an error like this `The experimental flag '--expt-relaxed-constexpr' can be used to allow this.`. The necessary flags can be set with cmake: +```cmake +target_compile_options(your_target_name PRIVATE $<$:--expt-extended-lambda --expt-relaxed-constexpr>) +``` + +Further, it's important that the language level be set to at least C++ 17. This can be done with cmake: +```cmake +set_target_properties(your_target_name +PROPERTIES CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED ON + POSITION_INDEPENDENT_CODE ON + INTERFACE_POSITION_INDEPENDENT_CODE ON) +``` + -### C++ header-only integration using cmake +### C++ header-only integration When the needed [build dependencies](#build-dependencies) are already satisfied, RAFT can be trivially integrated into downstream projects by cloning the repository and adding `cpp/include` from RAFT to the include path: ```cmake @@ -203,9 +225,9 @@ ExternalProject_Add(raft set(RAFT_INCLUDE_DIR ${RAFT_GIT_DIR}/raft/cpp/include CACHE STRING "RAFT include variable") ``` -If RAFT has already been installed, such as by using the `build.sh` script, use `find_package(raft)` and the `raft::raft` target if using RAFT to interact only with the public APIs of consuming projects. +If RAFT has already been installed, such as by using the `build.sh` script, use `find_package(raft)` and the `raft::raft` target. -### Using pre-compiled shared libraries +### Using C++ pre-compiled shared libraries Use `find_package(raft COMPONENTS nn distance)` to enable the shared libraries and transitively pass dependencies through separate targets for each component. In this example, the `raft::distance` and `raft::nn` targets will be available for configuring linking paths in addition to `raft::raft`. These targets will also pass through any transitive dependencies (such as FAISS for the `nn` package).