Skip to content
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

Add random subsampling for IVF methods #2077

Merged
merged 11 commits into from
Jan 23, 2024
Prev Previous commit
Next Next commit
Remove strided subsampling
  • Loading branch information
tfeher committed Jan 21, 2024
commit abf68a627f76d4b3f2601d50f465455ad9cc29f4
14 changes: 3 additions & 11 deletions cpp/include/raft/spatial/knn/detail/ann_utils.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -618,17 +618,9 @@ void subsample(raft::resources const& res,
{
IdxT n_dim = output.extent(1);
IdxT n_train = output.extent(0);
if (seed == -1 || n_train == n_samples) {
IdxT trainset_ratio = n_samples / n_train;
RAFT_LOG_INFO("Fixed stride subsampling");
RAFT_CUDA_TRY(cudaMemcpy2DAsync(output.data_handle(),
sizeof(T) * n_dim,
input,
sizeof(T) * n_dim * trainset_ratio,
sizeof(T) * n_dim,
n_train,
cudaMemcpyDefault,
resource::get_cuda_stream(res)));
if (n_train == n_samples) {
RAFT_LOG_INFO("No subsampling");
raft::copy(output.data_handle(), input, n_dim * n_samples, resource::get_cuda_stream(res));
return;
}
RAFT_LOG_DEBUG("Random subsampling");
Expand Down