File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Use short SHA1 as version
2- set (CARDINAL_VERSION v2.5.7 )
2+ set (CARDINAL_VERSION v2.5.8 )
33set (CARDINAL_REPO_URL "https://github.com/zilliztech/cardinal.git" )
44
55set (CARDINAL_REPO_DIR "${CMAKE_CURRENT_SOURCE_DIR} /thirdparty/cardinal" )
Original file line number Diff line number Diff line change 1212#include < functional>
1313#include < memory>
1414#include < vector>
15+
16+ #include " folly/executors/CPUThreadPoolExecutor.h"
17+
1518namespace knowhere {
1619
1720void
@@ -26,6 +29,13 @@ size_t
2629GetSearchThreadPoolSize ();
2730size_t
2831GetBuildThreadPoolSize ();
32+
33+ folly::CPUThreadPoolExecutor&
34+ GetSearchThreadPool ();
35+
36+ folly::CPUThreadPoolExecutor&
37+ GetBuildThreadPool ();
38+
2939class ThreadPool {
3040 public:
3141 class ScopedOmpSetter {
Original file line number Diff line number Diff line change @@ -141,6 +141,11 @@ class ThreadPool {
141141 return pool_.getPendingTaskCount ();
142142 }
143143
144+ folly::CPUThreadPoolExecutor&
145+ GetPool () {
146+ return pool_;
147+ }
148+
144149 void
145150 SetNumThreads (uint32_t num_threads) {
146151 if (num_threads == 0 ) {
Original file line number Diff line number Diff line change @@ -37,7 +37,6 @@ typedef uint64_t size_t;
3737#include < knowhere/comp/brute_force.h>
3838#include < knowhere/comp/knowhere_config.h>
3939#include < knowhere/comp/local_file_manager.h>
40- #include < knowhere/comp/task.h>
4140#include < knowhere/comp/index_param.h>
4241#include < fstream>
4342#include < string>
@@ -691,12 +690,12 @@ SetSimdType(const std::string type) {
691690
692691void
693692SetBuildThreadPool (uint32_t num_threads) {
694- knowhere::InitBuildThreadPool (num_threads);
693+ knowhere::KnowhereConfig::SetBuildThreadPoolSize (num_threads);
695694}
696695
697696void
698697SetSearchThreadPool (uint32_t num_threads) {
699- knowhere::InitSearchThreadPool (num_threads);
698+ knowhere::KnowhereConfig::SetSearchThreadPoolSize (num_threads);
700699}
701700
702701%}
Original file line number Diff line number Diff line change 1818#include < thread>
1919#include < utility>
2020
21+ #include " folly/executors/CPUThreadPoolExecutor.h"
2122#include " knowhere/comp/thread_pool.h"
2223
2324namespace knowhere {
@@ -57,6 +58,16 @@ InitBuildThreadPool(uint32_t num_threads) {
5758 ThreadPool::InitGlobalBuildThreadPool (num_threads);
5859}
5960
61+ folly::CPUThreadPoolExecutor&
62+ GetBuildThreadPool () {
63+ return ThreadPool::GetGlobalBuildThreadPool ()->GetPool ();
64+ }
65+
66+ folly::CPUThreadPoolExecutor&
67+ GetSearchThreadPool () {
68+ return ThreadPool::GetGlobalSearchThreadPool ()->GetPool ();
69+ }
70+
6071void
6172InitSearchThreadPool (uint32_t num_threads) {
6273 ThreadPool::InitGlobalSearchThreadPool (num_threads);
You can’t perform that action at this time.
0 commit comments