Skip to content
Open
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
41b0713
add example
divyegala Jun 17, 2026
b10c02c
initial integration
divyegala Jun 24, 2026
1b934dd
attempt to fix tile linkage
divyegala Jun 24, 2026
c7f7cbd
working test, remove example
divyegala Jun 24, 2026
86c9311
style check
divyegala Jun 24, 2026
e352629
start integrating other metrics
divyegala Jun 25, 2026
d6560fc
if constexpr exit
divyegala Jun 25, 2026
6742853
passing KMeans tests
divyegala Jun 25, 2026
db6b385
undo kvp, add constrains and alignments to tile export
divyegala Jun 30, 2026
0a3da06
add reproducible benchmark scripts
divyegala Jun 30, 2026
9da31ae
benchmark sweep
divyegala Jun 30, 2026
35291ec
index dtype
divyegala Jul 2, 2026
f48ec5f
new reduce
divyegala Jul 9, 2026
842863e
try int64 vector constant
divyegala Jul 9, 2026
9fb768d
new tile shape for sm90
divyegala Jul 9, 2026
88ddda8
using prebuilt cubins
divyegala Jul 11, 2026
099324a
use 13.4 tile
divyegala Jul 15, 2026
fe77c61
relaxed cubin, sm100 dispatch, new reduction strat
divyegala Jul 18, 2026
7e086b1
split tile for relaxed and strict sm120 abi
divyegala Jul 22, 2026
82d14a6
remove i64, batch i32 to save binary size
divyegala Jul 22, 2026
b0efee6
working through
divyegala Jul 28, 2026
9b2d2cb
new tiles and reduction shapes for sm120
divyegala Jul 29, 2026
54125c0
new kernel from huy
divyegala Aug 4, 2026
4173cd5
add changes
tarang-jain Aug 6, 2026
05301a3
add changes
tarang-jain Aug 6, 2026
27f2069
cutile pip at build time
divyegala Aug 6, 2026
9f38f18
merge upstream
divyegala Aug 6, 2026
a69cb01
Delete cpp/src/cluster/detail/.nfs000000001cb8b01800001a98
divyegala Aug 6, 2026
2185f1c
Delete benchmark_kmeans.py
divyegala Aug 6, 2026
2fdd7f7
Delete run_benchmark_kmeans.sh
divyegala Aug 6, 2026
2fb6253
correct dependencies
divyegala Aug 6, 2026
afc3cb5
package and style check
divyegala Aug 6, 2026
e28ecd9
Delete cpp/src/cluster/detail/.nfs000000001cb8b01800001a98
divyegala Aug 6, 2026
22b0845
allow rattler to install from pypi/pip
divyegala Aug 7, 2026
169309d
Merge remote-tracking branch 'origin/cutile-python-to-cpp' into cutil…
divyegala Aug 7, 2026
f1bf39d
fix upstream merge
divyegala Aug 10, 2026
25fe50b
fix test
divyegala Aug 10, 2026
f225d05
inertia calculation with unexpanded l2 metric
divyegala Aug 11, 2026
52e6be6
correct from host to build deps
divyegala Aug 11, 2026
e6b36d1
batch
divyegala Aug 11, 2026
d5c56ae
use cutile from conda
divyegala Aug 11, 2026
ccec474
fix ==
divyegala Aug 11, 2026
d63649e
use sass within family
divyegala Aug 11, 2026
b7ad920
address reviews
divyegala Aug 11, 2026
720af43
Merge remote-tracking branch 'upstream/main' into cutile-python-to-cpp
divyegala Aug 11, 2026
8f8e721
delete resource
divyegala Aug 11, 2026
c92ed15
python and cutile in build not host
divyegala Aug 11, 2026
53d04f5
correctly express python
divyegala Aug 11, 2026
7f4c205
fix c
divyegala Aug 11, 2026
1a08b55
Merge branch 'main' of https://github.com/rapidsai/cuvs into kmeanspp
tarang-jain Aug 12, 2026
9715ac3
use find package
divyegala Aug 12, 2026
a6ddd7b
Merge branch 'main' into cutile-python-to-cpp
divyegala Aug 12, 2026
9cdc427
use build prefix python
divyegala Aug 13, 2026
114bef8
Merge remote-tracking branch 'origin/cutile-python-to-cpp' into cutil…
divyegala Aug 13, 2026
766eefc
hint python early
divyegala Aug 13, 2026
810a582
explicilty find python
divyegala Aug 13, 2026
1234cdd
Merge branch 'main' of https://github.com/rapidsai/cuvs into kmeanspp
tarang-jain Aug 13, 2026
66c3b40
Merge branch 'cutile-python-to-cpp' of https://github.com/divyegala/c…
tarang-jain Aug 13, 2026
1adb7f3
Merge remote-tracking branch 'upstream/main' into kmeanspp
tarang-jain Aug 14, 2026
5de8c03
Optimize single-GPU KMeans++ initialization
tarang-jain Aug 14, 2026
4b0aab2
Merge branch 'kmeanspp' of https://github.com/tarang-jain/cuvs into k…
tarang-jain Aug 14, 2026
a4b4b01
Merge branch 'main' into kmeanspp
tarang-jain Aug 14, 2026
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
55 changes: 33 additions & 22 deletions cpp/src/cluster/detail/kmeans.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -394,34 +394,14 @@ void initScalableKMeansPlusPlus(raft::resources const& handle,
int niter = std::min(8, (int)ceil(log(psi)));
RAFT_LOG_DEBUG("KMeans||: psi = %g, log(psi) = %g, niter = %d ", psi, log(psi), niter);

auto newMinClusterDistanceVec = raft::make_device_vector<DataT, IndexT>(handle, n_samples);

// <<<< Step-3 >>> : for O( log(psi) ) times do
for (int iter = 0; iter < niter; ++iter) {
RAFT_LOG_DEBUG("KMeans|| - Iteration %d: # potential centroids sampled - %d",
iter,
potentialCentroids.extent(0));

cuvs::cluster::kmeans::detail::minClusterDistanceCompute<DataT, IndexT>(
handle,
X,
potentialCentroids,
minClusterDistanceVec.view(),
L2NormX.view(),
L2NormBuf_OR_DistBuf,
params.metric,
params.batch_samples,
params.batch_centroids,
workspace);

cuvs::cluster::kmeans::detail::computeClusterCost(
handle,
minClusterDistanceVec.view(),
workspace,
raft::make_device_scalar_view<DataT>(clusterCost.data()),
raft::identity_op{},
raft::add_op{});

psi = clusterCost.value(stream);

// <<<< Step-4 >>> : Sample each point x in X independently and identify new
// potentialCentroids
raft::random::uniform(
Expand Down Expand Up @@ -458,6 +438,37 @@ void initScalableKMeansPlusPlus(raft::resources const& handle,
potentialCentroids =
raft::make_device_matrix_view<DataT, IndexT>(centroidsBuf.data(), tot_centroids, n_features);
/// <<<< End of Step-5 >>>

// Update d(x, C) using only the newly sampled candidates.
if (Cp.extent(0) > 0 && iter + 1 < niter) {
cuvs::cluster::kmeans::detail::minClusterDistanceCompute<DataT, IndexT>(
handle,
X,
Cp,
newMinClusterDistanceVec.view(),
L2NormX.view(),
L2NormBuf_OR_DistBuf,
params.metric,
params.batch_samples,
params.batch_centroids,
workspace);

raft::linalg::map(handle,
minClusterDistanceVec.view(),
raft::min_op{},
raft::make_const_mdspan(minClusterDistanceVec.view()),
raft::make_const_mdspan(newMinClusterDistanceVec.view()));

cuvs::cluster::kmeans::detail::computeClusterCost(
handle,
minClusterDistanceVec.view(),
workspace,
raft::make_device_scalar_view<DataT>(clusterCost.data()),
raft::identity_op{},
raft::add_op{});

psi = clusterCost.value(stream);
}
} /// <<<< Step-6 >>>

RAFT_LOG_DEBUG("KMeans||: total # potential centroids sampled - %d",
Expand Down
Loading