Use Knowhere AIO Context Init Defalut Value and Panic when Fail (#26286)

Signed-off-by: Patrick Weizhi Xu <weizhi.xu@zilliz.com>
pull/26319/head
Patrick Weizhi Xu 2023-08-13 20:53:30 +08:00 committed by GitHub
parent 5b8d716cbc
commit 09da953a19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 2 deletions

View File

@ -74,7 +74,10 @@ KnowhereSetSimdType(const char* value) {
void
KnowhereInitThreadPool(const uint32_t num_threads) {
knowhere::ThreadPool::InitGlobalThreadPool(num_threads);
knowhere::KnowhereConfig::SetAioContextPool(num_threads, 32);
if (!knowhere::KnowhereConfig::SetAioContextPool(num_threads)) {
PanicInfo("Failed to set aio context pool with num_threads " +
std::to_string(num_threads));
}
}
} // namespace milvus::config

View File

@ -11,7 +11,7 @@
# or implied. See the License for the specific language governing permissions and limitations under the License.
#-------------------------------------------------------------------------------
set( KNOWHERE_VERSION 4f99dc0)
set( KNOWHERE_VERSION aa4a42f )
message(STATUS "Building knowhere-${KNOWHERE_SOURCE_VER} from source")
message(STATUS ${CMAKE_BUILD_TYPE})

View File

@ -10,7 +10,10 @@
// or implied. See the License for the specific language governing permissions and limitations under the License
#include <gtest/gtest.h>
#include <exception>
#include "config/ConfigKnowhere.h"
#include "gtest/gtest-death-test.h"
#include "segcore/segcore_init_c.h"
#include "test_utils/DataGen.h"
@ -22,3 +25,15 @@ TEST(Init, Naive) {
auto simd_type = SegcoreSetSimdType("auto");
free(simd_type);
}
TEST(Init, KnowhereThreadPoolInit) {
#ifdef BUILD_DISK_ANN
try {
milvus::config::KnowhereInitThreadPool(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);
}