@@ -588,9 +588,9 @@ void kmeans_fit(
588588
589589 raft::default_logger ().set_level (pams.verbosity );
590590
591- IndexT streaming_batch_size = static_cast <IndexT>(pams.streaming_batch_size );
592- if (streaming_batch_size <= 0 || streaming_batch_size > static_cast <IndexT>(n_samples)) {
593- streaming_batch_size = static_cast <IndexT>(n_samples);
591+ IndexT device_buffer_samples = static_cast <IndexT>(pams.device_buffer_samples );
592+ if (device_buffer_samples <= 0 || device_buffer_samples > static_cast <IndexT>(n_samples)) {
593+ device_buffer_samples = static_cast <IndexT>(n_samples);
594594 }
595595
596596 constexpr bool data_on_device = raft::is_device_mdspan_v<decltype (X)>;
@@ -606,13 +606,13 @@ void kmeans_fit(
606606 rmm::device_uvector<char > local_workspace (0 , stream);
607607 rmm::device_uvector<char >& ws = workspace.has_value () ? workspace->get () : local_workspace;
608608
609- if (data_on_device && streaming_batch_size != static_cast <IndexT>(n_samples)) {
609+ if (data_on_device && device_buffer_samples != static_cast <IndexT>(n_samples)) {
610610 RAFT_LOG_WARN (
611- " KMeans: streaming_batch_size (%zu) ignored when data resides on device; using n_samples "
611+ " KMeans: device_buffer_samples (%zu) ignored when data resides on device; using n_samples "
612612 " (%zu)" ,
613- static_cast <size_t >(streaming_batch_size ),
613+ static_cast <size_t >(device_buffer_samples ),
614614 static_cast <size_t >(n_samples));
615- streaming_batch_size = static_cast <IndexT>(n_samples);
615+ device_buffer_samples = static_cast <IndexT>(n_samples);
616616 }
617617
618618 // Preallocate the host-side KMeans++ init sample buffer.
@@ -685,26 +685,26 @@ void kmeans_fit(
685685 DataT* new_centroids_ptr = new_centroids_buf.data ();
686686
687687 auto minClusterAndDistance = raft::make_device_vector<raft::KeyValuePair<IndexT, DataT>, IndexT>(
688- handle, streaming_batch_size );
689- auto L2NormBatch = raft::make_device_vector<DataT, IndexT>(handle, streaming_batch_size );
690- auto batch_weights_buf = raft::make_device_vector<DataT, IndexT>(handle, streaming_batch_size );
688+ handle, device_buffer_samples );
689+ auto L2NormBatch = raft::make_device_vector<DataT, IndexT>(handle, device_buffer_samples );
690+ auto batch_weights_buf = raft::make_device_vector<DataT, IndexT>(handle, device_buffer_samples );
691691 rmm::device_uvector<DataT> L2NormBuf_OR_DistBuf (0 , stream);
692692
693693 auto centroid_sums = raft::make_device_matrix<DataT, IndexT>(handle, n_clusters, n_features);
694694 auto weight_per_cluster = raft::make_device_vector<DataT, IndexT>(handle, n_clusters);
695695 auto clustering_cost = raft::make_device_scalar<DataT>(handle, DataT{0 });
696696
697- rmm::device_uvector<char > batch_workspace (streaming_batch_size , stream);
697+ rmm::device_uvector<char > batch_workspace (device_buffer_samples , stream);
698698
699699 auto data_batches = cuvs::spatial::knn::detail::utils::make_batch_load_iterator<DataT>(
700- handle, X.data_handle (), n_samples, n_features, streaming_batch_size , stream);
700+ handle, X.data_handle (), n_samples, n_features, device_buffer_samples , stream);
701701 // Host-path weight batches: only materialized when weights are provided and
702702 // the data resides on host
703703 std::optional<cuvs::spatial::knn::detail::utils::batch_load_iterator_dyn<DataT>> weight_batches;
704704 if constexpr (!data_on_device) {
705705 if (weight_ptr != nullptr ) {
706706 weight_batches = cuvs::spatial::knn::detail::utils::make_batch_load_iterator<DataT>(
707- handle, weight_ptr, n_samples, IndexT{1 }, streaming_batch_size , stream);
707+ handle, weight_ptr, n_samples, IndexT{1 }, device_buffer_samples , stream);
708708 } else {
709709 raft::matrix::fill (handle, batch_weights_buf.view (), DataT{1 });
710710 }
@@ -759,11 +759,11 @@ void kmeans_fit(
759759 };
760760
761761 RAFT_LOG_DEBUG (
762- " KMeans.fit: n_samples=%zu, n_features=%zu, n_clusters=%d, streaming_batch_size =%zu" ,
762+ " KMeans.fit: n_samples=%zu, n_features=%zu, n_clusters=%d, device_buffer_samples =%zu" ,
763763 static_cast <size_t >(n_samples),
764764 static_cast <size_t >(n_features),
765765 n_clusters,
766- static_cast <size_t >(streaming_batch_size ));
766+ static_cast <size_t >(device_buffer_samples ));
767767
768768 bool need_compute_norms = metric == cuvs::distance::DistanceType::L2Expanded ||
769769 metric == cuvs::distance::DistanceType::L2SqrtExpanded;
0 commit comments