-
Notifications
You must be signed in to change notification settings - Fork 197
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
Replace faiss bfKnn #1202
Replace faiss bfKnn #1202
Conversation
Replace faiss bfKnn with code that leverages our pairwise_distance api and select_k api - by computing tiling over the inputs. This lets us remove faiss as a dependency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR is looking great! I'm just giving some intial feedback so far based on a quick scan through the files. I'll do another pass tomorrow.
docs/source/build.md
Outdated
| RAFT_STATIC_LINK_LIBRARIES | ON, OFF | ON | Build static link libraries instead of shared libraries | | ||
| DETECT_CONDA_ENV | ON, OFF | ON | Enable detection of conda environment for dependencies | | ||
| NVTX | ON, OFF | OFF | Enable NVTX Markers | | ||
| CUDA_ENABLE_KERNELINFO | ON, OFF | OFF | Enables `kernelinfo` in nvcc. This is useful for `compute-sanitizer` | | ||
| CUDA_ENABLE_LINEINFO | ON, OFF | OFF | Enable the -lineinfo option for nvcc | | ||
| CUDA_STATIC_RUNTIME | ON, OFF | OFF | Statically link the CUDA runtime | | ||
|
||
Currently, shared libraries are provided for the `libraft-nn` and `libraft-distance` components. The `libraft-nn` component depends upon [FAISS](https://github.com/facebookresearch/faiss) and the `RAFT_ENABLE_NN_DEPENDENCIES` option will build it from source if it is not already installed. | ||
Currently, shared libraries are provided for the `libraft-nn` and `libraft-distance` components. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Next step (after this PR and after the release) will be merging libraft-nn
and libraft-distance
into a single libraft.so
. The only reason it was separated was to isolate the FAISS dependency as it's the only run-time dependency that's not in the CUDA toolkit.
Codecov ReportBase: 87.99% // Head: 87.99% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## branch-23.04 #1202 +/- ##
=============================================
Coverage 87.99% 87.99%
=============================================
Files 21 21
Lines 483 483
=============================================
Hits 425 425
Misses 58 58
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
The remaining build time issues seem to be in the RBC code . It look like
raft/cpp/test/neighbors/ball_cover.cu Line 120 in a572397
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I think as a follow-on we should also make a note (maybe a github issue so we don't forget?) to profile the stream pool bits w/ nsight systems
just to make sure it's actually parallelizing the way we think it is. Otherwise, I think we've already discussed the other follow-ons (like augmenting this so the HDBSCAN reachability
computation can use it.
metric == raft::distance::DistanceType::LpUnexpanded) { | ||
float p = 0.5; // standard l2 | ||
if (metric == raft::distance::DistanceType::LpUnexpanded) p = 1.0 / metricArg; | ||
raft::linalg::unaryOp<float>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW- just as a note. The new raft::linalg::map
primitive allows us to do this really nicely (it's now being invoked directly by unary_op
, binary_op
, and ternary_op
).
default: | ||
// Create a new handle with the current stream from the stream pool | ||
raft::device_resources stream_pool_handle(handle); | ||
raft::resource::set_cuda_stream(stream_pool_handle, stream); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to add a copy overload to the handle that accepts a stream to we can make this easier.
Try to figure out if failures are in transpose code, or in tiled_knn code
Trying to resolve stream failures here
/merge |
This depends on #1202 so those changes are also included here. This should also not be merged until that PR is merged. Authors: - Corey J. Nolet (https://github.com/cjnolet) - Ben Frederickson (https://github.com/benfred) Approvers: - Ben Frederickson (https://github.com/benfred) - Vyas Ramasubramani (https://github.com/vyasr) - Ray Douglass (https://github.com/raydouglass) URL: #1340
…#1333) Now that we no longer need to rely on the FAISS dependency, this PR: 1. Consolidates the `libraft-distance` and `libraft-nn` targets into a single `libraft` artifact 2. Introduces a new `raft::compiled` target to link against the new `libraft.so` binary. Removes `raft::distance`and `raft::nn` targets. 3. Consolidates `RAFT_DISTANCE_COMPILED` and `RAFT_NN_COMPILED` pre-processor vars into a single `RAFT_COMPILED` (to match similar pattern implementated by `spdlog`) 4. Consolidates `specializations.cuh` headers 5. Updates all docs, scripts, and build infra This change has been a long time coming and is intended to be a 23.04 feature. This is further going to require updates to several projects downstream. Here's a checklist to track that progress: - [x] offline announcement - [x] cuml rapidsai/cuml#5272 - [x] cugraph rapidsai/cugraph#3348 - [x] cuopt rapidsai/cuopt#1023 - [x] cugraph-ops rapidsai/cugraph-ops#429 This PR depended on #1340 (removing FAISS from the build) and on #1202 (replacing the FAISS bfknn w/ our own), both of which have been merged. Closes #824 Authors: - Corey J. Nolet (https://github.com/cjnolet) - Ben Frederickson (https://github.com/benfred) Approvers: - Sevag H (https://github.com/sevagh) - Divye Gala (https://github.com/divyegala) - Ben Frederickson (https://github.com/benfred) - Vyas Ramasubramani (https://github.com/vyasr) URL: #1333
Replace faiss bfKnn with code that leverages our pairwise_distance api and select_k api - by tiling over the inputs.
This lets us remove faiss as a dependency
Closes #798
Closes #1159