Optimize transfer/compute overlap in out-of-core KMeans - #2538
Optimize transfer/compute overlap in out-of-core KMeans#2538viclafargue wants to merge 8 commits into
Conversation
|
/ok to test 4b8a5c5 |
|
/ok to test 9dd96bf |
| auto data_batches = cuvs::spatial::knn::detail::utils::make_batch_load_iterator<DataT>( | ||
| handle, X.data_handle(), n_samples, n_features, device_buffer_samples, stream); | ||
| auto batch_mr = data_on_device ? raft::resource::get_workspace_resource_ref(handle) | ||
| : raft::resource::get_large_workspace_resource_ref(handle); |
There was a problem hiding this comment.
if the data is already device accessible, why are we even using the workspace?
There was a problem hiding this comment.
Furthermore, if the large workspace is managed, the transfer speed is slightly slower (I found 55 GB/s versus 48 GB/s). I agree that the batchsize is not bounded here (it can be as large as the dataset) but I would argue for falling back to the large workspace only at the breaking point where allocating from the regular workspace is not possible. That calculation can get complicated to account for whether or not weights are present, so I'll tag @achirkin for some ideas.
There was a problem hiding this comment.
Actually since this is unbounded (only bounded by dataset size) lets just stick to large_mr @viclafargue. Since compute will overlap, its not a big deal.
|
A question about the python path: is there a way to set a stream pool for the single gpu ooc kmeans when using a python wrapper? If not, then there will be no h2d/compute overlap in this case. Is it intentional? |
Thanks for spotting this! I added some code to allow users to set up memory and stream pools from the C and Python cuVS APIs. |
Summary
This PR improves data-transfer and compute overlap for host-resident out-of-core KMeans using a cyclic two-buffer pipeline.
Implementation
Benchmark under similar configuration
10 GiB pinned-host FP32 dataset (10,485,760 × 256), 2,560 clusters, three iterations, ten 1 GiB out-of-core batches, and 131,072-sample assignment tiles.
mainProfile
Main branch :

This PR :

This PR (multi-GPU) :
