mirror of https://github.com/milvus-io/milvus.git
init knowhere build/search thread pool; (#26449)
Signed-off-by: cqy123456 <qianya.cheng@zilliz.com>pull/26432/head
parent
065d1a962e
commit
fd37860e57
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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})
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue