未验证 提交 09da953a 编写于 作者: P Patrick Weizhi Xu 提交者: GitHub

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

Signed-off-by: NPatrick Weizhi Xu <weizhi.xu@zilliz.com>
上级 5b8d716c
...@@ -74,7 +74,10 @@ KnowhereSetSimdType(const char* value) { ...@@ -74,7 +74,10 @@ KnowhereSetSimdType(const char* value) {
void void
KnowhereInitThreadPool(const uint32_t num_threads) { KnowhereInitThreadPool(const uint32_t num_threads) {
knowhere::ThreadPool::InitGlobalThreadPool(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 } // namespace milvus::config
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# or implied. See the License for the specific language governing permissions and limitations under the License. # 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 "Building knowhere-${KNOWHERE_SOURCE_VER} from source")
message(STATUS ${CMAKE_BUILD_TYPE}) message(STATUS ${CMAKE_BUILD_TYPE})
......
...@@ -10,7 +10,10 @@ ...@@ -10,7 +10,10 @@
// or implied. See the License for the specific language governing permissions and limitations under the License // or implied. See the License for the specific language governing permissions and limitations under the License
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <exception>
#include "config/ConfigKnowhere.h"
#include "gtest/gtest-death-test.h"
#include "segcore/segcore_init_c.h" #include "segcore/segcore_init_c.h"
#include "test_utils/DataGen.h" #include "test_utils/DataGen.h"
...@@ -22,3 +25,15 @@ TEST(Init, Naive) { ...@@ -22,3 +25,15 @@ TEST(Init, Naive) {
auto simd_type = SegcoreSetSimdType("auto"); auto simd_type = SegcoreSetSimdType("auto");
free(simd_type); 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);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册