From d8d06047f989d09feab0f65341ead5bdb872db7e Mon Sep 17 00:00:00 2001 From: achirkin Date: Thu, 26 May 2022 09:43:30 +0200 Subject: [PATCH] Make sure the gpu vector allocated for the data generation is deallocated before the other vectors are allocated --- cpp/test/spatial/selection.cu | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cpp/test/spatial/selection.cu b/cpp/test/spatial/selection.cu index f330722908..b669ba39d1 100644 --- a/cpp/test/spatial/selection.cu +++ b/cpp/test/spatial/selection.cu @@ -361,12 +361,14 @@ struct with_ref { std::vector dists(spec.input_len * spec.n_inputs); raft::handle_t handle; - auto s = handle.get_stream(); - rmm::device_uvector dists_d(spec.input_len * spec.n_inputs, s); - raft::random::RngState r(42); - normal(handle, r, dists_d.data(), dists_d.size(), KeyT(10.0), KeyT(100.0)); - update_host(dists.data(), dists_d.data(), dists_d.size(), s); - s.synchronize(); + { + auto s = handle.get_stream(); + rmm::device_uvector dists_d(spec.input_len * spec.n_inputs, s); + raft::random::RngState r(42); + normal(handle, r, dists_d.data(), dists_d.size(), KeyT(10.0), KeyT(100.0)); + update_host(dists.data(), dists_d.data(), dists_d.size(), s); + s.synchronize(); + } return std::make_tuple(spec, algo, SelectInOutComputed(spec, RefAlgo, dists)); }