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

add global thread pool for raft gpu search #920

Merged
merged 1 commit into from
Jun 6, 2023
Merged
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
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