-
Notifications
You must be signed in to change notification settings - Fork 623
Prepare cuml for removal of deprecated raft apis #7561
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
Changes from 5 commits
b2d1c07
7c9199d
df7d906
8883369
1d94692
cc11ecc
f13d176
0b1204e
5899a33
72776f0
0014575
ef1f3b7
bc4e91e
988ad8d
fc3da25
28aef64
320cd83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,8 +9,6 @@ | |
| #include <raft/core/device_resources.hpp> | ||
| #include <raft/core/handle.hpp> | ||
| #include <raft/label/classlabels.cuh> | ||
| #include <raft/spatial/knn/ann.cuh> | ||
| #include <raft/spatial/knn/knn.cuh> | ||
| #include <raft/util/cuda_utils.cuh> | ||
|
|
||
| #include <rmm/device_uvector.hpp> | ||
|
|
@@ -216,20 +214,6 @@ void approx_knn_build_index(raft::handle_t& handle, | |
| auto ivf_ft_pams = dynamic_cast<IVFFlatParam*>(params); | ||
| auto ivf_pq_pams = dynamic_cast<IVFPQParam*>(params); | ||
|
|
||
| index->metric_processor = raft::spatial::knn::create_processor<false, float>( | ||
| static_cast<raft::distance::DistanceType>(metric), | ||
| n, | ||
| D, | ||
| 0, | ||
| raft::resource::get_cuda_stream(handle)); | ||
| // For cosine/correlation distance, the metric processor translates distance | ||
| // to inner product via pre/post processing - pass the translated metric to | ||
| // ANN index | ||
| if (metric == ML::distance::DistanceType::CosineExpanded || | ||
| metric == ML::distance::DistanceType::CorrelationExpanded) { | ||
| metric = index->metric = ML::distance::DistanceType::InnerProduct; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you know why we used to set
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But, if I understood correctly
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes,
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's what I understood |
||
| } | ||
| index->metric_processor->preprocess(index_array); | ||
| auto index_view = raft::make_device_matrix_view<const float, int64_t>(index_array, n, D); | ||
|
|
||
| if (ivf_ft_pams) { | ||
|
|
@@ -256,8 +240,6 @@ void approx_knn_build_index(raft::handle_t& handle, | |
| } else { | ||
| RAFT_FAIL("Unrecognized index type."); | ||
| } | ||
|
|
||
| index->metric_processor->revert(index_array); | ||
| } | ||
|
|
||
| void approx_knn_search(raft::handle_t& handle, | ||
|
|
@@ -268,9 +250,6 @@ void approx_knn_search(raft::handle_t& handle, | |
| float* query_array, | ||
| int n) | ||
| { | ||
| index->metric_processor->preprocess(query_array); | ||
| index->metric_processor->set_num_queries(k); | ||
|
|
||
| auto indices_view = raft::make_device_matrix_view<int64_t, int64_t>(indices, n, k); | ||
| auto distances_view = raft::make_device_matrix_view<float, int64_t>(distances, n, k); | ||
|
|
||
|
|
@@ -294,8 +273,6 @@ void approx_knn_search(raft::handle_t& handle, | |
| RAFT_FAIL("The model is not trained"); | ||
| } | ||
|
|
||
| index->metric_processor->revert(query_array); | ||
|
|
||
| // perform post-processing to show the real distances | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about that post-processing, is it also needed ? |
||
| if (index->metric == ML::distance::DistanceType::L2SqrtExpanded || | ||
| index->metric == ML::distance::DistanceType::L2SqrtUnexpanded || | ||
|
|
@@ -311,7 +288,6 @@ void approx_knn_search(raft::handle_t& handle, | |
| raft::pow_const_op<float>(p), | ||
| raft::resource::get_cuda_stream(handle)); | ||
| } | ||
| index->metric_processor->postprocess(distances); | ||
| } | ||
|
|
||
| void knn_classify(raft::handle_t& handle, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,6 @@ | |
| #include <cuml/cluster/hdbscan.hpp> | ||
| #include <cuml/common/distance_type.hpp> | ||
|
|
||
| #include <raft/cluster/detail/agglomerative.cuh> // build_dendrogram_host | ||
| #include <raft/core/handle.hpp> | ||
| #include <raft/linalg/transpose.cuh> | ||
| #include <raft/sparse/coo.hpp> | ||
|
|
@@ -23,6 +22,7 @@ | |
| #include <thrust/execution_policy.h> | ||
| #include <thrust/transform.h> | ||
|
|
||
| #include <cuvs/cluster/agglomerative.hpp> // build_dendrogram_host | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is already included just below
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in 5899a33 |
||
| #include <cuvs/cluster/agglomerative.hpp> | ||
| #include <cuvs/distance/distance.hpp> | ||
| #include <cuvs/neighbors/all_neighbors.hpp> | ||
|
|
@@ -165,14 +165,14 @@ class ClusterCondensingTest : public ::testing::TestWithParam<ClusterCondensingI | |
| /** | ||
| * Build dendrogram of MST | ||
| */ | ||
| raft::cluster::detail::build_dendrogram_host(handle, | ||
| mst_src.data(), | ||
| mst_dst.data(), | ||
| mst_data.data(), | ||
| params.n_row - 1, | ||
| out_children.data(), | ||
| out_delta.data(), | ||
| out_size.data()); | ||
| cuvs::cluster::agglomerative::helpers::build_dendrogram_host(handle, | ||
| mst_src.data(), | ||
| mst_dst.data(), | ||
| mst_data.data(), | ||
| params.n_row - 1, | ||
| out_children.data(), | ||
| out_delta.data(), | ||
| out_size.data()); | ||
|
|
||
| /** | ||
| * Condense Hierarchy | ||
|
|
||
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.
We are tracking an issue in CI that makes the CUDA context invalid. It looks like it may be an illegal memory accesses that happens when UMAP is given a pre-computed KNN on host memory while the HMM feature enabled (making host pointers device accessible). We disabled pre-computed KNN on host from now, but ideally we would want to enable it while disabling it in the specific case of HMM enabled (we need to investigate the HMM case separately).
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.
Yes, this one has a merge conflict anyway, since this bit of code was reverted. So will remove the changes here