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

Fix CAGRA OOM handling #167

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 6 additions & 3 deletions cpp/src/neighbors/detail/cagra/cagra_build.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,12 @@ index<T, IdxT> build(
RAFT_LOG_DEBUG("Insufficient GPU memory to construct CAGRA index with dataset on GPU");
// We just add the graph. User is expected to update dataset separately (e.g allocating in
// managed memory).
index<T, IdxT> idx(res, params.metric);
idx.update_graph(res, raft::make_const_mdspan(cagra_graph.view()));
return idx;
} catch (raft::logic_error& e) {
// The memory error can also manifest as logic_error.
RAFT_LOG_DEBUG("Insufficient GPU memory to construct CAGRA index with dataset on GPU");
}
index<T, IdxT> idx(res, params.metric);
idx.update_graph(res, raft::make_const_mdspan(cagra_graph.view()));
return idx;
}
} // namespace cuvs::neighbors::cagra::detail
4 changes: 4 additions & 0 deletions cpp/src/neighbors/nn_descent.cu
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <cuvs/neighbors/nn_descent.hpp>
#include <raft/core/logger.hpp>

using namespace raft;
namespace cuvs::neighbors::nn_descent {

/**
Expand Down Expand Up @@ -53,6 +54,9 @@ bool has_enough_device_memory(raft::resources const& res,
} catch (std::bad_alloc& e) {
RAFT_LOG_DEBUG("Insufficient memory for NN descent");
return false;
} catch (raft::logic_error& e) {
RAFT_LOG_DEBUG("Insufficient memory for NN descent (logic error)");
return false;
}
}

Expand Down
Loading