diff --git a/internal/core/src/config/ConfigKnowhere.cpp b/internal/core/src/config/ConfigKnowhere.cpp index 9e0658d76c..d57681f686 100644 --- a/internal/core/src/config/ConfigKnowhere.cpp +++ b/internal/core/src/config/ConfigKnowhere.cpp @@ -72,8 +72,13 @@ KnowhereSetSimdType(const char* value) { } void -KnowhereInitThreadPool(const uint32_t num_threads) { - knowhere::ThreadPool::InitGlobalThreadPool(num_threads); +KnowhereInitBuildThreadPool(const uint32_t num_threads) { + knowhere::ThreadPool::InitGlobalBuildThreadPool(num_threads); +} + +void +KnowhereInitSearchThreadPool(const uint32_t num_threads) { + knowhere::ThreadPool::InitGlobalSearchThreadPool(num_threads); if (!knowhere::KnowhereConfig::SetAioContextPool(num_threads)) { PanicInfo("Failed to set aio context pool with num_threads " + std::to_string(num_threads)); diff --git a/internal/core/src/config/ConfigKnowhere.h b/internal/core/src/config/ConfigKnowhere.h index 1a45646ea6..d76a898946 100644 --- a/internal/core/src/config/ConfigKnowhere.h +++ b/internal/core/src/config/ConfigKnowhere.h @@ -26,6 +26,8 @@ std::string KnowhereSetSimdType(const char*); void -KnowhereInitThreadPool(const uint32_t); +KnowhereInitBuildThreadPool(const uint32_t); +void +KnowhereInitSearchThreadPool(const uint32_t); } // namespace milvus::config diff --git a/internal/core/src/segcore/segcore_init_c.cpp b/internal/core/src/segcore/segcore_init_c.cpp index 36adcdb2df..87a02bcac1 100644 --- a/internal/core/src/segcore/segcore_init_c.cpp +++ b/internal/core/src/segcore/segcore_init_c.cpp @@ -50,8 +50,13 @@ SegcoreSetNprobe(const int64_t value) { } extern "C" void -SegcoreSetKnowhereThreadPoolNum(const uint32_t num_threads) { - milvus::config::KnowhereInitThreadPool(num_threads); +SegcoreSetKnowhereBuildThreadPoolNum(const uint32_t num_threads) { + milvus::config::KnowhereInitBuildThreadPool(num_threads); +} + +extern "C" void +SegcoreSetKnowhereSearchThreadPoolNum(const uint32_t num_threads) { + milvus::config::KnowhereInitSearchThreadPool(num_threads); } // return value must be freed by the caller diff --git a/internal/core/src/segcore/segcore_init_c.h b/internal/core/src/segcore/segcore_init_c.h index 6a66c2fd3b..24a8abdab3 100644 --- a/internal/core/src/segcore/segcore_init_c.h +++ b/internal/core/src/segcore/segcore_init_c.h @@ -35,7 +35,10 @@ char* SegcoreSetSimdType(const char*); void -SegcoreSetKnowhereThreadPoolNum(const uint32_t num_threads); +SegcoreSetKnowhereBuildThreadPoolNum(const uint32_t num_threads); + +void +SegcoreSetKnowhereSearchThreadPoolNum(const uint32_t num_threads); void SegcoreCloseGlog(); diff --git a/internal/core/thirdparty/knowhere/CMakeLists.txt b/internal/core/thirdparty/knowhere/CMakeLists.txt index 00bf349ca3..213dee8afb 100644 --- a/internal/core/thirdparty/knowhere/CMakeLists.txt +++ b/internal/core/thirdparty/knowhere/CMakeLists.txt @@ -11,7 +11,7 @@ # or implied. See the License for the specific language governing permissions and limitations under the License. #------------------------------------------------------------------------------- -set( KNOWHERE_VERSION aa4a42f ) +set( KNOWHERE_VERSION 57a7fcf ) message(STATUS "Building knowhere-${KNOWHERE_SOURCE_VER} from source") message(STATUS ${CMAKE_BUILD_TYPE}) diff --git a/internal/core/unittest/test_init.cpp b/internal/core/unittest/test_init.cpp index 630bee671e..b1ee02e8ea 100644 --- a/internal/core/unittest/test_init.cpp +++ b/internal/core/unittest/test_init.cpp @@ -29,11 +29,11 @@ TEST(Init, Naive) { TEST(Init, KnowhereThreadPoolInit) { #ifdef BUILD_DISK_ANN try { - milvus::config::KnowhereInitThreadPool(0); + milvus::config::KnowhereInitSearchThreadPool(0); } catch (std::exception& e) { ASSERT_TRUE(std::string(e.what()).find( "Failed to set aio context pool") != std::string::npos); } #endif - milvus::config::KnowhereInitThreadPool(8); + milvus::config::KnowhereInitSearchThreadPool(8); } diff --git a/internal/indexnode/indexnode.go b/internal/indexnode/indexnode.go index 3ca22bb964..5379ceecb1 100644 --- a/internal/indexnode/indexnode.go +++ b/internal/indexnode/indexnode.go @@ -169,7 +169,7 @@ func (i *IndexNode) initSegcore() { C.InitCpuNum(cCPUNum) cKnowhereThreadPoolSize := C.uint32_t(hardware.GetCPUNum() * paramtable.DefaultKnowhereThreadPoolNumRatioInBuild) - C.SegcoreSetKnowhereThreadPoolNum(cKnowhereThreadPoolSize) + C.SegcoreSetKnowhereBuildThreadPoolNum(cKnowhereThreadPoolSize) localDataRootPath := filepath.Join(Params.LocalStorageCfg.Path.GetValue(), typeutil.IndexNodeRole) initcore.InitLocalChunkManager(localDataRootPath) diff --git a/internal/querynodev2/server.go b/internal/querynodev2/server.go index 1e46431f08..3acf272bc6 100644 --- a/internal/querynodev2/server.go +++ b/internal/querynodev2/server.go @@ -186,7 +186,7 @@ func (node *QueryNode) InitSegcore() error { C.SegcoreSetChunkRows(cChunkRows) cKnowhereThreadPoolSize := C.uint32_t(paramtable.Get().QueryNodeCfg.KnowhereThreadPoolSize.GetAsUint32()) - C.SegcoreSetKnowhereThreadPoolNum(cKnowhereThreadPoolSize) + C.SegcoreSetKnowhereSearchThreadPoolNum(cKnowhereThreadPoolSize) enableGrowingIndex := C.bool(paramtable.Get().QueryNodeCfg.EnableGrowingSegmentIndex.GetAsBool()) C.SegcoreSetEnableGrowingSegmentIndex(enableGrowingIndex)