Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making cuco, thrust, and mdspan optional dependencies. #585

Merged
Merged
Show file tree
Hide file tree
Changes from 196 commits
Commits
Show all changes
198 commits
Select commit Hold shift + click to select a range
60e7c2a
Adding pylibraft
cjnolet Mar 2, 2022
54cac54
Adding distance
cjnolet Mar 2, 2022
f1b502a
More infrastructure stuff
cjnolet Mar 2, 2022
555433b
Updating year
cjnolet Mar 2, 2022
4b448f5
Adding missing copyright headers
cjnolet Mar 2, 2022
f9aa8bc
More style
cjnolet Mar 2, 2022
9c72b7a
Proper formatting
cjnolet Mar 2, 2022
2c278ab
Updating setup
cjnolet Mar 2, 2022
c021445
Rename
cjnolet Mar 2, 2022
8de62fe
Adding rmm dependency
cjnolet Mar 2, 2022
6e5499f
Updating gitignore
cjnolet Mar 2, 2022
7fc834e
Updates
cjnolet Mar 2, 2022
401c167
adding raft_runtime public includes
cjnolet Mar 8, 2022
cb40df9
Toy example
cjnolet Mar 8, 2022
a5cea8e
Making raft::runtime the core dependency and having all other targets
cjnolet Mar 8, 2022
4322d0b
fixing style
cjnolet Mar 8, 2022
8ae80ad
Almost there...
cjnolet Mar 8, 2022
4bfde36
COpyright year
cjnolet Mar 8, 2022
6306b7b
Updating mdspan copyright
cjnolet Mar 8, 2022
b06f8e6
Fixing doxygen
cjnolet Mar 9, 2022
f4387b6
CHanging conda package to libraft-runtime so libraft-headers won't be
cjnolet Mar 9, 2022
6a92f19
Update copyrightys
cjnolet Mar 9, 2022
831fe81
MOving runtime headers into corresponding directories
cjnolet Mar 9, 2022
0fc02ca
Updating style
cjnolet Mar 9, 2022
e8ba5a1
Removing todos
cjnolet Mar 9, 2022
4a13200
updating readme
cjnolet Mar 9, 2022
8583386
Adding docs for the raft_export INSTALL_FILES option
cjnolet Mar 9, 2022
d518ba7
Updating build.md
cjnolet Mar 9, 2022
00e8a69
Merge branch 'branch-22.04' into fea-2204-pylibraft
cjnolet Mar 9, 2022
54df7de
Merge branch 'fea-2204-raft_runtime' into fea-2204-pylibraft
cjnolet Mar 9, 2022
5f6f1eb
pylibraft is compiling!
cjnolet Mar 9, 2022
bd42373
Fixing style
cjnolet Mar 9, 2022
084975c
Fixing cython style
cjnolet Mar 9, 2022
1bb7fb5
Fixing cpp style
cjnolet Mar 9, 2022
fb48427
Updating conda package to use raft-runtime instead of raft-headers
cjnolet Mar 9, 2022
aaa72e4
adding logging.
cjnolet Mar 9, 2022
b2bfe6c
Merge remote-tracking branch 'rapidsai/branch-22.04' into fea-2204-ra…
cjnolet Mar 9, 2022
939fd01
Merge remote-tracking branch 'rapidsai/branch-22.04' into fea-2204-py…
cjnolet Mar 9, 2022
d34cdf7
Merge branch 'fea-2204-raft_runtime' into fea-2204-pylibraft
cjnolet Mar 9, 2022
fba7769
Adding libraft-distance to build-time dependency for pylibraft
cjnolet Mar 9, 2022
4fc06e6
Adding libraft-distance to gpu build
cjnolet Mar 10, 2022
c6a326a
Explicity building pylibraft
cjnolet Mar 10, 2022
271b38b
Updating docs
cjnolet Mar 10, 2022
f482b67
Updates
cjnolet Mar 10, 2022
6fa6cd9
Updates
cjnolet Mar 10, 2022
f312042
Updating runtime target
cjnolet Mar 10, 2022
a4cad22
Updates
cjnolet Mar 10, 2022
8ccd270
exporting raft-exports
cjnolet Mar 10, 2022
6467705
Using raft::headers and raft::raft instead of raft::runtimne and raft…
cjnolet Mar 10, 2022
802b2f2
updting coipyright fir get_gtest
cjnolet Mar 10, 2022
7ec1100
Exorting rmm through raft-headers-exports
cjnolet Mar 10, 2022
e1edba4
Properlyu setting RAFT_LINK_LIBS
cjnolet Mar 10, 2022
12ddb51
Still working out kinks w/ headers
cjnolet Mar 10, 2022
5bbc377
Adding headers as another component
cjnolet Mar 10, 2022
869bb36
Always adding headers to components
cjnolet Mar 10, 2022
869cfce
Headers ad top-level
cjnolet Mar 11, 2022
067ea7c
Using proper name
cjnolet Mar 11, 2022
20b4053
Exporting headers
cjnolet Mar 11, 2022
a301de4
Sending rmm to raft-exports
cjnolet Mar 11, 2022
339b8b6
Adding headers to test-raft links
cjnolet Mar 11, 2022
b978436
BUilding docs last
cjnolet Mar 11, 2022
230bcff
Docs to use proper raft path
cjnolet Mar 11, 2022
36ee5dc
Adding test in pylibraft
cjnolet Mar 11, 2022
50adc87
Removing pylibraft from docs build for now
cjnolet Mar 11, 2022
2a90fc8
Updating cmkelists
cjnolet Mar 11, 2022
882a3f0
updating cmake
cjnolet Mar 11, 2022
7f10eab
Removign missing file
cjnolet Mar 11, 2022
140d13e
Updating copyright
cjnolet Mar 11, 2022
fdf9c74
Merge branch 'branch-22.04' into fea-2204-raft_runtime
cjnolet Mar 11, 2022
3b3ad45
Merge remote-tracking branch 'rapidsai/branch-22.04' into fea-2204-ra…
cjnolet Mar 11, 2022
1bf61fa
Updating README to describe the multiple components.
cjnolet Mar 11, 2022
c272d46
A coupel more update
cjnolet Mar 11, 2022
1ee3ac2
Merge remote-tracking branch 'rapidsai/branch-22.04' into fea-2204-ra…
cjnolet Mar 11, 2022
e67d014
more updates to build docs.
cjnolet Mar 11, 2022
58546fd
Merge branch 'fea-2204-raft_runtime' into fea-2204-pylibraft
cjnolet Mar 11, 2022
731bf6f
Fixing bad merge
cjnolet Mar 11, 2022
55c3896
Troubleshooting lib linking issue
cjnolet Mar 12, 2022
6d09114
Printing out conda env
cjnolet Mar 12, 2022
2abd560
Adding raft build dir to ld path
cjnolet Mar 12, 2022
7deacf5
Still debugging why libraft* is not being added to ld path in gpu build
cjnolet Mar 12, 2022
439d82d
Still trying to figure out where raft cpp artifacts are installed
cjnolet Mar 13, 2022
c0ee958
Still trying to figure out what directories are available
cjnolet Mar 13, 2022
73ba48f
Adding work dirs back
cjnolet Mar 13, 2022
39394c6
Printing out all children of /ci/artifacts/raft
cjnolet Mar 13, 2022
f263dde
Installing libraft-* conda packages from previous job
cjnolet Mar 13, 2022
a5eb563
Renaming raft runtime -> client api
cjnolet Mar 14, 2022
b792831
Merge branch 'fea-2204-raft_runtime' into fea-2204-pylibraft
cjnolet Mar 14, 2022
6f98b72
Checking in changes. Test runs but results are not corre
cjnolet Mar 14, 2022
57399bc
and... tests are passing
cjnolet Mar 14, 2022
01a0b52
Support for double precision
cjnolet Mar 14, 2022
742eea8
Fixing style
cjnolet Mar 14, 2022
f03fac3
Changing libraft_client_api to libraft_frontend
cjnolet Mar 14, 2022
117dd5d
Rename client-api -> frontend
cjnolet Mar 14, 2022
91805ec
Merge branch 'fea-2204-raft_runtime' into fea-2204-pylibraft
cjnolet Mar 14, 2022
078322e
More doc updates
cjnolet Mar 14, 2022
1bc2031
Merge branch 'fea-2204-raft_runtime' into fea-2204-pylibraft
cjnolet Mar 14, 2022
2c65908
Fixing another raft::headers -> raft::backend
cjnolet Mar 14, 2022
38f07e0
Merge branch 'fea-2204-raft_runtime' into fea-2204-pylibraft
cjnolet Mar 14, 2022
0dddac1
ugh
cjnolet Mar 14, 2022
c6157a2
Merge branch 'fea-2204-raft_runtime' into fea-2204-pylibraft
cjnolet Mar 14, 2022
1e6270b
using libraft-frontend in pylibraft meta.yml
cjnolet Mar 14, 2022
cafe000
Updating raft_runtime -> raft_frontend
cjnolet Mar 14, 2022
df84f75
Merge branch 'fea-2204-raft_runtime' into fea-2204-pylibraft
cjnolet Mar 14, 2022
1808989
fixing typo
cjnolet Mar 15, 2022
e7c86fd
Fixing raft_client -> raft_frontend
cjnolet Mar 15, 2022
cf339c0
More replacement of raft_runtime
cjnolet Mar 15, 2022
5130863
Merge branch 'fea-2204-raft_runtime' into fea-2204-pylibraft
cjnolet Mar 15, 2022
520d93d
Adding python example to readme
cjnolet Mar 15, 2022
c74b90f
Testing more distances.
cjnolet Mar 15, 2022
a4d1901
Fixing style
cjnolet Mar 15, 2022
2b710dc
Strange cython linking issue
cjnolet Mar 15, 2022
4d367c0
Updates
cjnolet Mar 15, 2022
dad6d93
Changing frontend->public
cjnolet Mar 15, 2022
db2a2e6
Merge branch 'fea-2204-raft_runtime' into fea-2204-pylibraft
cjnolet Mar 15, 2022
afb8024
Updating raft_frontend->raft_public
cjnolet Mar 15, 2022
b640d4f
libraft_public -> libraft_core
cjnolet Mar 15, 2022
66fbe3e
Updates
cjnolet Mar 15, 2022
9412e99
Fixing style
cjnolet Mar 15, 2022
9d3ffc8
Installing targets
cjnolet Mar 15, 2022
8cb3c33
Proper install target
cjnolet Mar 15, 2022
2fe7d89
removing cuco from installing headers
cjnolet Mar 16, 2022
d06ef66
Changing actual conda package back to `libraft-headers` just to minimize
cjnolet Mar 16, 2022
7fddb0b
Backing out recent build changes, removing INSTALL exports everywhere.
cjnolet Mar 16, 2022
413a108
More updates
cjnolet Mar 16, 2022
94881c2
More udpates
cjnolet Mar 16, 2022
cc1edca
Merge remote-tracking branch 'rapidsai/branch-22.04' into fea-2204-py…
cjnolet Mar 16, 2022
aa805b0
Updating README and BUILD docs to remove raft core.
cjnolet Mar 17, 2022
110b26f
More updates to dev guide
cjnolet Mar 17, 2022
66c9f9c
Couple of small fixes
cjnolet Mar 17, 2022
bdb75ba
A few more doc updates I missed
cjnolet Mar 17, 2022
0fcff5d
Review feedback
cjnolet Mar 17, 2022
0ac17f4
Merge remote-tracking branch 'rapidsai/branch-22.04' into fea-2204-py…
cjnolet Mar 18, 2022
4fc2656
Updating docs for 22.04
cjnolet Mar 18, 2022
6fd944f
Removing allocator
cjnolet Mar 18, 2022
682cd2f
removing device allocator
cjnolet Mar 18, 2022
1dfe2fc
fixing style
cjnolet Mar 18, 2022
a4cd2cf
Breaking out sparse primitives.
cjnolet Mar 18, 2022
437127e
More docs updates.
cjnolet Mar 21, 2022
ef4a9a8
Updates based on review feedback
cjnolet Mar 21, 2022
322d659
A couple additional updates to README.md
cjnolet Mar 21, 2022
42f56c9
Fixing typo
cjnolet Mar 21, 2022
eda6fcf
slight re-brand
cjnolet Mar 21, 2022
0cf80b3
One more change
cjnolet Mar 21, 2022
1ef83ff
More readme updates
cjnolet Mar 21, 2022
efa5e5a
Updates
cjnolet Mar 21, 2022
f209b1c
Somehow missed a review comment
cjnolet Mar 21, 2022
187dfa4
Removing versions.json
cjnolet Mar 21, 2022
1ccc4aa
Merge branch 'fea-2204-pylibraft' into doc-2204-updating_doxygen
cjnolet Mar 21, 2022
0ef4792
Merge branch 'branch-22.04' into doc-2204-updating_doxygen
cjnolet Mar 22, 2022
648f1c9
Fixing style
cjnolet Mar 22, 2022
6f6d9cc
Adding INSTALL_EXPORT_SET for cuco, rmm, thrust
cjnolet Mar 22, 2022
2ff3536
Calling single thrust function instead of two
cjnolet Mar 22, 2022
d0cbc92
Merge branch 'revert_thrust_rmm_cuco' into doc-2204-updating_doxygen
cjnolet Mar 22, 2022
e71543c
Merge remote-tracking branch 'rapidsai/branch-22.04' into doc-2204-up…
cjnolet Mar 22, 2022
2cd58a5
Merge remote-tracking branch 'rapidsai/branch-22.04' into doc-2204-up…
cjnolet Mar 23, 2022
2834b62
Adding docs for pylibraft
cjnolet Mar 23, 2022
b1e1ff8
pushing cuco dependency down to distance component
cjnolet Mar 23, 2022
a7f859e
Updating style
cjnolet Mar 23, 2022
454fe3c
Enabling cuco
cjnolet Mar 23, 2022
c22437b
Removing faiss dependfency from tests. Skipping cuco dependency if not
cjnolet Mar 23, 2022
3550d50
Passing faiss::faiss through raft::nn when dependencies are enabled
cjnolet Mar 23, 2022
8281679
Review feedback
cjnolet Mar 24, 2022
0ed3033
Making mdspan and thrust optional and turning off compile libraries by
cjnolet Mar 24, 2022
3dbe7d4
Turnbing on compiling tests by default but not compiling shared libs
cjnolet Mar 24, 2022
3afbd02
Fixing flag
cjnolet Mar 24, 2022
ac2066d
Merge branch 'build_2206_cuco_distance_component' into build-2204-com…
cjnolet Mar 24, 2022
b9a91a6
Installing version string
cjnolet Mar 24, 2022
ed933ae
Proper enabling/disable rules. Adding docs
cjnolet Mar 24, 2022
2f5df6e
Adding opton to build.sh to disable thrust during header-only mode
cjnolet Mar 24, 2022
a74866b
more docs
cjnolet Mar 24, 2022
c4ad1e6
Removing cuco from raft global links
cjnolet Mar 24, 2022
a94cc62
adding no-thrust example to build instrucitons
cjnolet Mar 24, 2022
70eec1e
Moving public things over to core/ package
cjnolet Mar 24, 2022
6eddecd
Updating style
cjnolet Mar 24, 2022
0c3250d
Updating style
cjnolet Mar 24, 2022
0610ea1
more style updates
cjnolet Mar 24, 2022
db6b066
Merge branch 'doc-2204-updating_doxygen' into build_2206_cuco_distanc…
cjnolet Mar 24, 2022
44387ec
Fixing deprecation warnings
cjnolet Mar 24, 2022
f7af502
Merge remote-tracking branch 'rapidsai/branch-22.04' into build_2206_…
cjnolet Mar 25, 2022
449ee37
Fixing style
cjnolet Mar 25, 2022
9183adf
Including only core elemernts
cjnolet Mar 25, 2022
dc9b9dd
Fixing bad merge
cjnolet Mar 25, 2022
f5d5c53
Fixing macro and wrappers
cjnolet Mar 25, 2022
f13aceb
Merge branch 'branch-22.06' into build_2206_cuco_distance_component
cjnolet Mar 28, 2022
934f85e
Updates based on review feedback
cjnolet Mar 31, 2022
b430cba
Merge remote-tracking branch 'rapidsai/branch-22.06' into build_2206_…
cjnolet Mar 31, 2022
88d6a94
Merge branch 'build_2206_cuco_distance_component' of github.com:cjnol…
cjnolet Mar 31, 2022
1a7295f
fixing bad merge
cjnolet Mar 31, 2022
d3f8fbe
Merge remote-tracking branch 'rapidsai/branch-22.06' into build_2206_…
cjnolet Mar 31, 2022
84d6701
Enabling NN dependencies when building tests
cjnolet Mar 31, 2022
98d28c1
making compile_libraries default to `BUILD_TESTS`
cjnolet Mar 31, 2022
24f3589
updating build.md
cjnolet Mar 31, 2022
387d374
Updating kselection. Apparently
cjnolet Mar 31, 2022
b44c88e
Updates
cjnolet Mar 31, 2022
11d4362
Updates based on review feedback
cjnolet Apr 1, 2022
4da9084
Fixing doxygen errors
cjnolet Apr 2, 2022
d00b350
Review feedback
cjnolet Apr 8, 2022
184a220
Review feedback
cjnolet Apr 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 32 additions & 13 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
In addition to the libraries included with cudatoolkit 11.0+, there are some other dependencies below for building RAFT from source. Many of the dependencies are optional and depend only on the primitives being used. All of these can be installed with cmake or [rapids-cpm](https://github.com/rapidsai/rapids-cmake#cpm) and many of them can be installed with [conda](https://anaconda.org).

#### Required
- [Thrust](https://github.com/NVIDIA/thrust) v1.15 / [CUB](https://github.com/NVIDIA/cub)
- [RMM](https://github.com/rapidsai/rmm) corresponding to RAFT version.
- [mdspan](https://github.com/rapidsai/mdspan)

#### Optional
- [cuCollections](https://github.com/NVIDIA/cuCollections) - Used in `raft::sparse::distance` API
- [mdspan](https://github.com/rapidsai/mdspan) - On by default but can be disabled.
- [Thrust](https://github.com/NVIDIA/thrust) v1.15 / [CUB](https://github.com/NVIDIA/cub) - On by default but can be disabled.
- [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 `Pyraft`
Expand All @@ -53,6 +53,11 @@ The following example will download the needed dependencies and install the RAFT
./build.sh libraft --install
```

The `--minimal-deps` flag can be used to install the headers with minimal dependencies:
```bash
./build.sh libraft --install --minimal-deps
```

### <a id="shared_cpp_libs"></a>C++ Shared Libraries (optional)

For larger projects which make heavy use of the pairwise distances or nearest neighbors APIs, shared libraries can be built to speed up compile times. These shared libraries can also significantly improve re-compile times both while developing RAFT and developing against the APIs. Build all of the available shared libraries by passing `--compile-libs` flag to `build.sh`:
Expand All @@ -69,7 +74,14 @@ Add the `--install` flag to the above example to also install the shared librari

### <a id="gtests"></a>Tests

Compile the tests using the `tests` target in `build.sh`. By default, the shared libraries are assumed to be already built and on the library path. Add `--compile-libs` to also compile them.
Compile the tests using the `tests` target in `build.sh`.

```bash
./build.sh libraft tests
```

Test compile times can be improved significantly by using the optional shared libraries. If installed, they will be used automatically when building the tests but `--compile-libs` can be used to add additional compilation units and compile them with the tests.

```bash
./build.sh libraft tests --compile-libs
```
Expand Down Expand Up @@ -110,11 +122,13 @@ RAFT's cmake has the following configurable flags available:.
| --- | --- | --- | --- |
| BUILD_TESTS | ON, OFF | ON | Compile Googletests |
| BUILD_BENCH | ON, OFF | ON | Compile benchmarks |
| raft_FIND_COMPONENTS | nn distance | | Configures the optional components as a space-separated list |
| RAFT_COMPILE_LIBRARIES | ON, OFF | OFF | Compiles all `libraft` shared libraries (these are required for Googletests) |
| RAFT_COMPILE_NN_LIBRARY | ON, OFF | ON | Compiles the `libraft-nn` shared library |
| RAFT_COMPILE_DIST_LIBRARY | ON, OFF | ON | Compiles the `libraft-distance` shared library |
| RAFT_COMPILE_NN_LIBRARY | ON, OFF | OFF | Compiles the `libraft-nn` shared library |
| RAFT_COMPILE_DIST_LIBRARY | ON, OFF | OFF | Compiles the `libraft-distance` shared library |
| RAFT_ENABLE_NN_DEPENDENCIES | ON, OFF | OFF | Searches for dependencies of nearest neighbors API, such as FAISS, and compiles them if not found. Needed for `raft::spatial::knn` |
| RAFT_ENABLE_cuco_DEPENDENCY | ON, OFF | ON | Enables the cuCollections dependency used by `raft::sparse::distance` |
| RAFT_ENABLE_thrust_DEPENDENCY | ON, OFF | ON | Enables the Thrust dependency. This can be disabled when using many simple utilities or to override with a different Thrust version. |
| RAFT_ENABLE_mdspan_DEPENDENCY | ON, OFF | ON | Enables the std::mdspan dependency. This can be disabled when using many simple utilities. |
| RAFT_ENABLE_nccl_DEPENDENCY | ON, OFF | OFF | Enables NCCL dependency used by `raft::comms` and needed to build `pyraft` |
| RAFT_ENABLE_ucx_DEPENDENCY | ON, OFF | OFF | Enables UCX dependency used by `raft::comms` and needed to build `pyraft` |
| RAFT_USE_FAISS_STATIC | ON, OFF | OFF | Statically link FAISS into `libraft-nn` |
Expand Down Expand Up @@ -212,7 +226,8 @@ set(RAFT_PINNED_TAG "branch-${RAFT_VERSION}")
function(find_and_configure_raft)
set(oneValueArgs VERSION FORK PINNED_TAG USE_FAISS_STATIC
COMPILE_LIBRARIES ENABLE_NN_DEPENDENCIES CLONE_ON_PIN
USE_NN_LIBRARY USE_DISTANCE_LIBRARY)
USE_NN_LIBRARY USE_DISTANCE_LIBRARY
ENABLE_thrust_DEPENDENCY ENABLE_mdspan_DEPENDENCY)
cmake_parse_arguments(PKG "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN} )

Expand Down Expand Up @@ -256,6 +271,8 @@ function(find_and_configure_raft)
"RAFT_ENABLE_NN_DEPENDENCIES ${PKG_ENABLE_NN_DEPENDENCIES}"
"RAFT_USE_FAISS_STATIC ${PKG_USE_FAISS_STATIC}"
"RAFT_COMPILE_LIBRARIES ${PKG_COMPILE_LIBRARIES}"
"RAFT_ENABLE_thrust_DEPENDENCY ${PKG_ENABLE_thrust_DEPENDENCY}"
"RAFT_ENABLE_mdspan_DEPENDENCY ${PKG_ENABLE_mdspan_DEPENDENCY}"
)

endfunction()
Expand All @@ -272,11 +289,13 @@ find_and_configure_raft(VERSION ${RAFT_VERSION}.00
# even if it's already installed.
CLONE_ON_PIN ON

COMPILE_LIBRARIES NO
USE_NN_LIBRARY NO
USE_DISTANCE_LIBRARY NO
ENABLE_NN_DEPENDENCIES NO # This builds FAISS if not installed
USE_FAISS_STATIC NO
COMPILE_LIBRARIES NO
USE_NN_LIBRARY NO
USE_DISTANCE_LIBRARY NO
ENABLE_NN_DEPENDENCIES NO # This builds FAISS if not installed
USE_FAISS_STATIC NO
ENABLE_thrust_DEPENDENCY YES
ENABLE_mdspan_DEPENDENCY YES
)
```

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# <div align="left"><img src="https://rapids.ai/assets/images/rapids_logo.png" width="90px"/>&nbsp;RAFT: Reusable Accelerated Functions and Tools</div>

RAFT contains fundamental widely-used algorithms and primitives for data science, graph and machine learning. The algorithms are CUDA-accelerated and form building-blocks for rapidly composing analytics.
RAFT contains fundamental widely-used algorithms and primitives for data science and machine learning. The algorithms are CUDA-accelerated and form building-blocks for rapidly composing analytics.

By taking a primitives-based approach to algorithm development, RAFT
- accelerates algorithm construction time
Expand Down
15 changes: 13 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ARGS=$*
# script, and that this script resides in the repo dir!
REPODIR=$(cd $(dirname $0); pwd)

VALIDARGS="clean libraft pyraft pylibraft docs tests bench clean -v -g --install --compile-libs --compile-nn --compile-dist --allgpuarch --nvtx --show_depr_warn -h --buildfaiss"
VALIDARGS="clean libraft pyraft pylibraft docs tests bench clean -v -g --install --compile-libs --compile-nn --compile-dist --allgpuarch --nvtx --show_depr_warn -h --buildfaiss --minimal-deps"
HELP="$0 [<target> ...] [<flag> ...]
where <target> is:
clean - remove all existing build artifacts and configuration (start over)
Expand All @@ -36,6 +36,8 @@ HELP="$0 [<target> ...] [<flag> ...]
--compile-libs - compile shared libraries for all components
--compile-nn - compile shared library for nn component
--compile-dist - compile shared library for distance component
--minimal-deps - disables dependencies like thrust so they can be overridden.
cjnolet marked this conversation as resolved.
Show resolved Hide resolved
can be useful for a pure header-only install
--allgpuarch - build for all supported GPU architectures
--buildfaiss - build faiss statically into raft
--install - install cmake targets
Expand All @@ -62,6 +64,9 @@ COMPILE_LIBRARIES=OFF
COMPILE_NN_LIBRARY=OFF
COMPILE_DIST_LIBRARY=OFF
ENABLE_NN_DEPENDENCIES=OFF

ENABLE_thrust_DEPENDENCY=ON

ENABLE_ucx_DEPENDENCY=OFF
ENABLE_nccl_DEPENDENCY=OFF

Expand Down Expand Up @@ -105,6 +110,11 @@ fi
if hasArg --install; then
INSTALL_TARGET="install"
fi

if hasArg --no-thrust; then
ENABLE_thrust_DEPENDENCY=OFF
fi

if hasArg -v; then
VERBOSE_FLAG="-v"
CMAKE_LOG_LEVEL="VERBOSE"
Expand Down Expand Up @@ -218,7 +228,8 @@ if (( ${NUMARGS} == 0 )) || hasArg libraft || hasArg docs || hasArg tests || has
-DRAFT_COMPILE_DIST_LIBRARY=${COMPILE_DIST_LIBRARY} \
-DRAFT_USE_FAISS_STATIC=${BUILD_STATIC_FAISS} \
-DRAFT_ENABLE_nccl_DEPENDENCY=${ENABLE_nccl_DEPENDENCY} \
-DRAFT_ENABLE_ucx_DEPENDENCY=${ENABLE_ucx_DEPENDENCY}
-DRAFT_ENABLE_ucx_DEPENDENCY=${ENABLE_ucx_DEPENDENCY} \
-DRAFT_ENABLE_thrust_DEPENDENCY=${ENABLE_thrust_DEPENDENCY}

if [[ ${CMAKE_TARGET} != "" ]]; then
echo "-- Compiling targets: ${CMAKE_TARGET}, verbose=${VERBOSE_FLAG}"
Expand Down
1 change: 0 additions & 1 deletion conda/recipes/libraft_distance/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ requirements:
- ucx-py {{ ucx_py_version }}
- ucx-proc=*=gpu
- gtest=1.10.0
- gmock
- librmm {{ minor_version }}
run:
- libraft-headers {{ version }}
Expand Down
1 change: 1 addition & 0 deletions conda/recipes/libraft_headers/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# Copyright (c) 2022, NVIDIA CORPORATION.

./build.sh libraft --install -v --allgpuarch
``
cjnolet marked this conversation as resolved.
Show resolved Hide resolved
1 change: 0 additions & 1 deletion conda/recipes/libraft_headers/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ requirements:
- ucx-py {{ ucx_py_version }}
- ucx-proc=*=gpu
- gtest=1.10.0
- gmock
- librmm {{ minor_version}}
- libcusolver>=11.2.1
run:
Expand Down
1 change: 0 additions & 1 deletion conda/recipes/libraft_nn/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ requirements:
- faiss-proc=*=cuda
- libfaiss 1.7.0 *_cuda
- gtest=1.10.0
- gmock
- librmm {{ minor_version }}
run:
- {{ pin_compatible('cudatoolkit', max_pin='x', min_pin='x') }}
Expand Down
55 changes: 40 additions & 15 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================
set(RAPIDS_VERSION "22.06")
set(RAFT_VERSION "${RAPIDS_VERSION}.00")

cmake_minimum_required(VERSION 3.20.1 FATAL_ERROR)
file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-22.06/RAPIDS.cmake
Expand All @@ -26,7 +28,7 @@ include(rapids-find)

rapids_cuda_init_architectures(RAFT)

project(RAFT VERSION 22.06.00 LANGUAGES CXX CUDA)
project(RAFT VERSION ${RAFT_VERSION} LANGUAGES CXX CUDA)

# Needed because GoogleBenchmark changes the state of FindThreads.cmake, causing subsequent runs to
# have different values for the `Threads::Threads` target. Setting this flag ensures
Expand Down Expand Up @@ -55,16 +57,22 @@ option(CUDA_ENABLE_KERNELINFO "Enable kernel resource usage info" OFF)
option(CUDA_ENABLE_LINEINFO "Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler)" OFF)
option(CUDA_STATIC_RUNTIME "Statically link the CUDA runtime" OFF)
option(DETECT_CONDA_ENV "Enable detection of conda environment for dependencies" ON)
option(DISABLE_DEPRECATION_WARNINGS "Disable depreaction warnings " ON)
option(DISABLE_DEPRECATION_WARNINGS "Disable deprecaction warnings " ON)
option(DISABLE_OPENMP "Disable OpenMP" OFF)
option(NVTX "Enable nvtx markers" OFF)

option(RAFT_COMPILE_LIBRARIES "Enable building raft shared library instantiations" ON)
option(RAFT_COMPILE_LIBRARIES "Enable building raft shared library instantiations" ${BUILD_TESTS})
option(RAFT_COMPILE_NN_LIBRARY "Enable building raft nearest neighbors shared library instantiations" OFF)
option(RAFT_COMPILE_DIST_LIBRARY "Enable building raft distant shared library instantiations" OFF)
option(RAFT_ENABLE_NN_DEPENDENCIES "Search for raft::nn dependencies like faiss" ${RAFT_COMPILE_LIBRARIES})

option(RAFT_ENABLE_cuco_DEPENDENCY "Enable cuCollections dependency" ON)
option(RAFT_ENABLE_mdspan_DEPENDENCY "Enable mdspan dependency" ON)
option(RAFT_ENABLE_thrust_DEPENDENCY "Enable Thrust dependency" ON)

if(BUILD_TESTS AND NOT RAFT_ENABLE_thrust_DEPENDENCY)
message(VERBOSE "RAFT: BUILD_TESTS is enabled, overriding RAFT_ENABLE_thrust_DEPENDENCY")
set(RAFT_ENABLE_thrust_DEPENDENCY ON)
endif()

# Currently, UCX and NCCL are only needed to build Pyraft and so a simple find_package() is sufficient
option(RAFT_ENABLE_nccl_DEPENDENCY "Enable NCCL dependency" OFF)
Expand All @@ -75,6 +83,7 @@ option(RAFT_EXCLUDE_FAISS_FROM_ALL "Exclude FAISS targets from RAFT's 'all' targ
include(CMakeDependentOption)
cmake_dependent_option(RAFT_USE_FAISS_STATIC "Build and statically link the FAISS library for nearest neighbors search on GPU" ON RAFT_COMPILE_LIBRARIES OFF)

message(VERBOSE "RAFT: Building optional components: ${raft_FIND_COMPONENTS}")
message(VERBOSE "RAFT: Build RAFT unit-tests: ${BUILD_TESTS}")
message(VERBOSE "RAFT: Building raft C++ benchmarks: ${BUILD_BENCH}")
message(VERBOSE "RAFT: Enable detection of conda environment for dependencies: ${DETECT_CONDA_ENV}")
Expand Down Expand Up @@ -123,6 +132,10 @@ include(cmake/modules/ConfigureCUDA.cmake)
##############################################################################
# - Requirements -------------------------------------------------------------

if(distance IN_LIST raft_FIND_COMPONENTS OR RAFT_COMPILE_LIBRARIES OR RAFT_COMPILE_DIST_LIBRARY)
set(RAFT_ENABLE_cuco_DEPENDENCY ON)
endif()

# add third party dependencies using CPM
rapids_cpm_init()

Expand Down Expand Up @@ -151,17 +164,20 @@ target_include_directories(raft INTERFACE
"$<BUILD_INTERFACE:${RAFT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>")

# Keep RAFT as lightweight as possible.
# Only CUDA libs, rmm, and mdspan should
# be used in global target.
target_link_libraries(raft INTERFACE
raft::Thrust
$<$<BOOL:${NVTX}>:CUDA::nvToolsExt>
CUDA::cublas
CUDA::curand
CUDA::cusolver
CUDA::cudart
CUDA::cusparse
rmm::rmm
$<$<BOOL:${RAFT_ENABLE_cuco_DEPENDENCY}>:cuco::cuco>
std::mdspan)
$<$<BOOL:${RAFT_ENABLE_thrust_DEPENDENCY}>:raft::Thrust>
$<$<BOOL:${RAFT_ENABLE_mdspan_DEPENDENCY}>:std::mdspan>
)

target_compile_definitions(raft INTERFACE $<$<BOOL:${NVTX}>:NVTX_ENABLED>)
target_compile_features(raft INTERFACE cxx_std_17 $<BUILD_INTERFACE:cuda_std_17>)
Expand Down Expand Up @@ -248,6 +264,7 @@ endif()

target_link_libraries(raft_distance INTERFACE
raft::raft
$<$<BOOL:${RAFT_ENABLE_cuco_DEPENDENCY}>:cuco::cuco>
$<TARGET_NAME_IF_EXISTS:raft_distance_lib>
$<TARGET_NAME_IF_EXISTS:raft::raft_distance_lib>
)
Expand Down Expand Up @@ -301,6 +318,7 @@ endif()

target_link_libraries(raft_nn INTERFACE
raft::raft
$<$<BOOL:${RAFT_ENABLE_NN_DEPENDENCIES}>:faiss::faiss>
$<TARGET_NAME_IF_EXISTS:raft_nn_lib>
$<TARGET_NAME_IF_EXISTS:raft::raft_nn_lib>)

Expand Down Expand Up @@ -341,14 +359,17 @@ install(DIRECTORY include/raft
install(FILES include/raft.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/raft)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/raft/version_config.hpp
DESTINATION include/raft)

##############################################################################
# - install export -----------------------------------------------------------
set(doc_string
[=[
Provide targets for the RAFT: Reusable Accelerated Functions and Tools

RAFT contains fundamental widely-used algorithms and primitives
for data science, graph, and ml.
for data science and machine learning.

Optional Components:
- nn
Expand All @@ -361,13 +382,18 @@ Imported Targets:

]=])

set(code_string
[=[

if(NOT TARGET raft::Thrust)
thrust_create_target(raft::Thrust FROM_OPTIONS)
set(code_string )
if(RAFT_ENABLE_thrust_DEPENDENCY)
string(APPEND code_string
[=[
if(NOT TARGET raft::Thrust)
thrust_create_target(raft::Thrust FROM_OPTIONS)
endif()
]=])
endif()

string(APPEND code_string
[=[
if(distance IN_LIST raft_FIND_COMPONENTS)
enable_language(CUDA)
endif()
Expand All @@ -381,8 +407,7 @@ if(nn IN_LIST raft_FIND_COMPONENTS)
add_library(faiss ALIAS faiss::faiss)
endif()
endif()
]=]
)
]=])

# Use `rapids_export` for 22.04 as it will have COMPONENT support
include(cmake/modules/raft_export.cmake)
Expand Down
31 changes: 15 additions & 16 deletions cpp/cmake/thirdparty/get_cuco.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,20 @@

function(find_and_configure_cuco VERSION)

if(RAFT_ENABLE_cuco_DEPENDENCY)
rapids_cpm_find(cuco ${VERSION}
GLOBAL_TARGETS cuco::cuco
BUILD_EXPORT_SET raft-exports
INSTALL_EXPORT_SET raft-exports
CPM_ARGS
GIT_REPOSITORY https://github.com/NVIDIA/cuCollections.git
GIT_TAG fb58a38701f1c24ecfe07d8f1f208bbe80930da5
OPTIONS "BUILD_TESTS OFF"
"BUILD_BENCHMARKS OFF"
"BUILD_EXAMPLES OFF"
)
endif()

rapids_cpm_find(cuco ${VERSION}
GLOBAL_TARGETS cuco::cuco
BUILD_EXPORT_SET raft-distance-exports
INSTALL_EXPORT_SET raft-distance-exports
CPM_ARGS
GIT_REPOSITORY https://github.com/NVIDIA/cuCollections.git
GIT_TAG 6ec8b6dcdeceea07ab4456d32461a05c18864411
OPTIONS "BUILD_TESTS OFF"
"BUILD_BENCHMARKS OFF"
"BUILD_EXAMPLES OFF"
)
endfunction()

# cuCollections doesn't have a version yet
find_and_configure_cuco(0.0.1)
if(RAFT_ENABLE_cuco_DEPENDENCY)
# cuCollections doesn't have a version yet
find_and_configure_cuco(0.0.1)
endif()
6 changes: 4 additions & 2 deletions cpp/cmake/thirdparty/get_libcudacxx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@

# This function finds libcudacxx and sets any additional necessary environment variables.
function(find_and_configure_libcudacxx)

include(${rapids-cmake-dir}/cpm/libcudacxx.cmake)

rapids_cpm_libcudacxx(BUILD_EXPORT_SET raft-exports
INSTALL_EXPORT_SET raft-exports)

endfunction()

find_and_configure_libcudacxx()
if(RAFT_ENABLE_cuco_DEPENDENCY)
find_and_configure_libcudacxx()
endif()
Loading