Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
add global thread pool for raft gpu search (#920)
Browse files Browse the repository at this point in the history
Signed-off-by: Yusheng.Ma <[email protected]>
  • Loading branch information
Presburger authored Jun 6, 2023
1 parent 39ea52c commit 61fa067
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/index/ivf_raft/ivf_raft.cu
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,29 @@
constexpr uint32_t cuda_concurrent_size = 16;

namespace knowhere {

static std::shared_ptr<ThreadPool>
GlobalThreadPoolRaft() {
static std::shared_ptr<ThreadPool> pool = std::make_shared<ThreadPool>(cuda_concurrent_size);
return pool;
}
KNOWHERE_REGISTER_GLOBAL(GPU_RAFT_IVF_FLAT, [](const Object& object) {
return Index<IndexNodeThreadPoolWrapper>::Create(
std::make_unique<RaftIvfIndexNode<detail::raft_ivf_flat_index>>(object),
std::make_shared<ThreadPool>(cuda_concurrent_size));
std::make_unique<RaftIvfIndexNode<detail::raft_ivf_flat_index>>(object), GlobalThreadPoolRaft());
});

KNOWHERE_REGISTER_GLOBAL(GPU_RAFT_IVF_PQ, [](const Object& object) {
return Index<IndexNodeThreadPoolWrapper>::Create(
std::make_unique<RaftIvfIndexNode<detail::raft_ivf_pq_index>>(object),
std::make_shared<ThreadPool>(cuda_concurrent_size));
std::make_unique<RaftIvfIndexNode<detail::raft_ivf_pq_index>>(object), GlobalThreadPoolRaft());
});

KNOWHERE_REGISTER_GLOBAL(GPU_IVF_FLAT, [](const Object& object) {
return Index<IndexNodeThreadPoolWrapper>::Create(
std::make_unique<RaftIvfIndexNode<detail::raft_ivf_flat_index>>(object),
std::make_shared<ThreadPool>(cuda_concurrent_size));
std::make_unique<RaftIvfIndexNode<detail::raft_ivf_flat_index>>(object), GlobalThreadPoolRaft());
});

KNOWHERE_REGISTER_GLOBAL(GPU_IVF_PQ, [](const Object& object) {
return Index<IndexNodeThreadPoolWrapper>::Create(
std::make_unique<RaftIvfIndexNode<detail::raft_ivf_pq_index>>(object),
std::make_shared<ThreadPool>(cuda_concurrent_size));
std::make_unique<RaftIvfIndexNode<detail::raft_ivf_pq_index>>(object), GlobalThreadPoolRaft());
});
} // namespace knowhere

0 comments on commit 61fa067

Please sign in to comment.