Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
70269a3
working;test
Apr 18, 2025
7012028
Merge branch 'branch-25.06' into hdbscan-cuvs
tarang-jain Apr 18, 2025
3488bb2
rm comment
Apr 18, 2025
b9e7faf
Merge branch 'branch-25.06' of https://github.com/rapidsai/cuml into …
Apr 18, 2025
f69a313
Merge branch 'hdbscan-cuvs' of https://github.com/tarang-jain/cuml in…
Apr 18, 2025
c75a170
store n_edges
Apr 22, 2025
44d404e
Merge branch 'branch-25.06' of https://github.com/rapidsai/cuml into …
Apr 22, 2025
06fd57b
Merge branch 'branch-25.06' into hdbscan-cuvs
tarang-jain Apr 24, 2025
f9f4c49
new API
tarang-jain Apr 30, 2025
273e421
Merge branch 'branch-25.06' of https://github.com/rapidsai/cuml into …
tarang-jain Apr 30, 2025
f746259
style
tarang-jain Apr 30, 2025
244a347
Merge branch 'branch-25.06' into hdbscan-cuvs
tarang-jain Apr 30, 2025
e980412
Merge branch 'branch-25.06' into hdbscan-cuvs
tarang-jain May 2, 2025
dcdebf4
move reduction op
tarang-jain May 6, 2025
3b8d167
reachability
tarang-jain May 6, 2025
a665516
Merge branch 'branch-25.06' of https://github.com/rapidsai/cuml into …
tarang-jain May 6, 2025
afe63a5
Merge branch 'hdbscan-cuvs' of https://github.com/tarang-jain/cuml in…
tarang-jain May 6, 2025
cd36c00
merge upstream;new design
tarang-jain Jun 4, 2025
2009123
passing tests
tarang-jain Jun 5, 2025
5716b89
Merge branch 'branch-25.08' into hdbscan-cuvs
tarang-jain Jun 5, 2025
a73fd3f
Merge branch 'branch-25.08' into hdbscan-cuvs
tarang-jain Jun 11, 2025
b26d08d
undo cmake change
tarang-jain Jun 11, 2025
8bd66ac
alpha in linkage params
tarang-jain Jun 11, 2025
43f539d
Merge branch 'hdbscan-cuvs' of https://github.com/tarang-jain/cuml in…
tarang-jain Jun 11, 2025
c24c8bb
merge upstream
tarang-jain Jun 16, 2025
bb7e3d6
Merge branch 'branch-25.08' of https://github.com/rapidsai/cuml into …
tarang-jain Jul 1, 2025
c8b6bde
cast metric
tarang-jain Jul 1, 2025
0d92104
re-add doc
tarang-jain Jul 1, 2025
6652c24
Merge branch 'branch-25.08' into hdbscan-cuvs
tarang-jain Jul 1, 2025
3d068bb
revert template type
tarang-jain Jul 1, 2025
ba3492f
Merge branch 'branch-25.08' into hdbscan-cuvs
tarang-jain Jul 1, 2025
6cf4729
Merge branch 'branch-25.08' into hdbscan-cuvs
tarang-jain Jul 2, 2025
977d419
Merge branch 'branch-25.08' into hdbscan-cuvs
tarang-jain Jul 2, 2025
34939df
Merge branch 'branch-25.08' into hdbscan-cuvs
tarang-jain Jul 3, 2025
41c547a
older cuvs
tarang-jain Jul 3, 2025
0bc784f
Merge branch 'branch-25.08' into slbug
tarang-jain Jul 3, 2025
54dcf1c
25.04
tarang-jain Jul 3, 2025
211fc04
Merge branch 'slbug' of https://github.com/tarang-jain/cuml into slbug
tarang-jain Jul 3, 2025
3d0fc05
custom rmm
tarang-jain Jul 3, 2025
3b6fc7f
revert cuvs tag
tarang-jain Jul 3, 2025
d622a77
style
tarang-jain Jul 3, 2025
84aa1f9
Merge branch 'branch-25.08' into slbug
tarang-jain Jul 3, 2025
7c04592
update path
tarang-jain Jul 3, 2025
b47f9b0
Merge branch 'slbug' of https://github.com/tarang-jain/cuml into slbug
tarang-jain Jul 3, 2025
dfa61d7
debug
tarang-jain Jul 3, 2025
ce51670
check where dataset is
tarang-jain Jul 3, 2025
f2bea61
Merge branch 'branch-25.08' into hdbscan-cuvs
tarang-jain Jul 3, 2025
618d06c
Merge branch 'branch-25.08' into hdbscan-cuvs
tarang-jain Jul 3, 2025
9680c08
update cuvs fetch to PR
tarang-jain Jul 3, 2025
b50e95f
Merge branch 'hdbscan-cuvs' of https://github.com/tarang-jain/cuml in…
tarang-jain Jul 3, 2025
0c32bf5
Merge branch 'branch-25.08' into hdbscan-cuvs
tarang-jain Jul 8, 2025
2c4bc21
Merge branch 'branch-25.08' of https://github.com/rapidsai/cuml into …
tarang-jain Jul 8, 2025
a0cd70c
test with custom cuvs
tarang-jain Jul 8, 2025
bcdee29
Merge branch 'hdbscan-cuvs' of https://github.com/tarang-jain/cuml in…
tarang-jain Jul 8, 2025
0c7051d
revert custom rmm
tarang-jain Jul 8, 2025
84134e0
Merge branch 'branch-25.08' of https://github.com/rapidsai/cuml into …
tarang-jain Jul 9, 2025
7817d8f
revert changes to get_cuvs.cmake
tarang-jain Jul 9, 2025
0b8a6ef
update log statement
tarang-jain Jul 9, 2025
78bdba2
Merge branch 'branch-25.08' into hdbscan-cuvs
tarang-jain Jul 9, 2025
66adf51
Merge branch 'branch-25.08' of https://github.com/rapidsai/cuml into …
tarang-jain Jul 9, 2025
304b361
Merge branch 'hdbscan-cuvs' of https://github.com/tarang-jain/cuml in…
tarang-jain Jul 9, 2025
7c366e7
rm debug statements
tarang-jain Jul 9, 2025
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
4 changes: 2 additions & 2 deletions cpp/cmake/thirdparty/get_cuvs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ function(find_and_configure_cuvs)
BUILD_EXPORT_SET cuml-exports
INSTALL_EXPORT_SET cuml-exports
CPM_ARGS
GIT_REPOSITORY https://github.com/${PKG_FORK}/cuvs.git
GIT_TAG ${PKG_PINNED_TAG}
GIT_REPOSITORY https://github.com/tarang-jain/cuvs.git
GIT_TAG build-linkage
SOURCE_SUBDIR cpp
EXCLUDE_FROM_ALL ${PKG_EXCLUDE_FROM_ALL}
OPTIONS
Expand Down
64 changes: 27 additions & 37 deletions cpp/src/hdbscan/runner.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2024, NVIDIA CORPORATION.
* Copyright (c) 2021-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -26,6 +26,8 @@

#include <raft/cluster/detail/agglomerative.cuh> // build_dendrogram_host
#include <raft/cluster/detail/mst.cuh> // build_sorted_mst
#include <raft/core/device_coo_matrix.hpp>
#include <raft/core/device_mdspan.hpp>
#include <raft/core/handle.hpp>
#include <raft/core/kvp.hpp>
#include <raft/core/resource/thrust_policy.hpp>
Expand All @@ -40,6 +42,7 @@
#include <thrust/scatter.h>
#include <thrust/transform.h>

#include <cuvs/cluster/agglomerative.hpp>
#include <cuvs/neighbors/reachability.hpp>

namespace ML {
Expand Down Expand Up @@ -173,8 +176,8 @@ void build_linkage(const raft::handle_t& handle,
// Note that (min_samples+1) is parsed while allocating space for the COO matrix and to the
// mutual_reachability_graph function. This was done to account for self-loops in the knn graph
// and be consistent with Scikit learn Contrib.
raft::sparse::COO<value_t, value_idx> mutual_reachability_coo(stream,
(params.min_samples + 1) * m * 2);
size_t mutual_reachability_nnz = ((params.min_samples + 1) * m * 2);
raft::sparse::COO<value_t, value_idx> mutual_reachability_coo(stream, mutual_reachability_nnz);

cuvs::neighbors::reachability::mutual_reachability_graph(
handle,
Expand All @@ -186,42 +189,29 @@ void build_linkage(const raft::handle_t& handle,
metric,
params.alpha);

/**
* Construct MST sorted by weights
*/

rmm::device_uvector<value_idx> color(m, stream);
FixConnectivitiesRedOp<value_idx, value_t> red_op(core_dists, m);
// during knn graph connection
raft::cluster::detail::build_sorted_mst(handle,
X,
mutual_reachability_indptr.data(),
mutual_reachability_coo.cols(),
mutual_reachability_coo.vals(),
m,
n,
out.get_mst_src(),
out.get_mst_dst(),
out.get_mst_weights(),
color.data(),
mutual_reachability_coo.nnz,
red_op,
static_cast<raft::distance::DistanceType>(metric),
(size_t)10);
value_idx n_edges = m - 1;

/**
* Perform hierarchical labeling
*/
size_t n_edges = m - 1;

raft::cluster::detail::build_dendrogram_host(handle,
out.get_mst_src(),
out.get_mst_dst(),
out.get_mst_weights(),
n_edges,
out.get_children(),
out.get_deltas(),
out.get_sizes());
cuvs::cluster::agglomerative::build_linkage(
handle,
raft::make_device_matrix_view<const value_t, value_idx>(X, m, n),
metric,
raft::make_device_vector_view<value_idx, value_idx>(mutual_reachability_indptr.data(), m + 1),
raft::make_device_coo_matrix_view<value_t, value_idx, value_idx, size_t>(
mutual_reachability_coo.vals(),
raft::make_device_coordinate_structure_view(mutual_reachability_coo.rows(),
mutual_reachability_coo.cols(),
value_idx(m),
value_idx(m),
mutual_reachability_nnz)),
raft::make_device_coo_matrix_view<value_t, value_idx, value_idx, value_idx>(
out.get_mst_weights(),
raft::make_device_coordinate_structure_view(
out.get_mst_src(), out.get_mst_dst(), value_idx(m), value_idx(m), n_edges)),
raft::make_device_matrix_view<value_idx, value_idx>(out.get_children(), n_edges, 2),
raft::make_device_vector_view<value_t, value_idx>(out.get_deltas(), n_edges),
raft::make_device_vector_view<value_idx, value_idx>(out.get_sizes(), n_edges),
red_op);
}

template <typename value_idx = int64_t, typename value_t = float>
Expand Down