Support segcoreinit

Signed-off-by: FluorineDog <guilin.gou@zilliz.com>
This commit is contained in:
FluorineDog 2021-04-16 14:02:49 +08:00 committed by yefu.chen
parent 13f41f160b
commit ce7a5ea699
10 changed files with 36 additions and 11 deletions

View File

@ -14,7 +14,6 @@ set(indexbuilder_bench_srcs
add_executable(all_bench ${bench_srcs})
target_link_libraries(all_bench
milvus_segcore
milvus_indexbuilder
log
pthread
)

View File

@ -52,6 +52,10 @@ set_target_properties(index_log PROPERTIES RULE_LAUNCH_COMPILE "")
set_target_properties(index_log PROPERTIES RULE_LAUNCH_LINK "")
include_directories(${MILVUS_THIRDPARTY_SRC})
set(config_srcs
knowhere/archive/KnowhereConfig.cpp
)
set(vector_index_srcs
knowhere/index/IndexType.cpp
knowhere/index/vector_index/adapter/VectorAdapter.cpp
@ -149,6 +153,7 @@ if (NOT TARGET knowhere)
add_library(
knowhere STATIC
${external_srcs}
${config_srcs}
${vector_index_srcs}
${vector_offset_index_srcs}
)

View File

@ -9,7 +9,7 @@
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations under the License.
#include "index/archive/KnowhereConfig.h"
#include "KnowhereConfig.h"
#ifdef MILVUS_GPU_VERSION
#include "knowhere/index/vector_index/helpers/FaissGpuResourceMgr.h"
#endif

View File

@ -15,7 +15,7 @@ set(SEGCORE_FILES
SealedIndexingRecord.cpp
SegmentInterface.cpp
SegcoreConfig.cpp
SegcoreInit.cpp
segcore_init_c.cpp
)
add_library(milvus_segcore SHARED
${SEGCORE_FILES}

View File

@ -10,12 +10,26 @@
// or implied. See the License for the specific language governing permissions and limitations under the License
#include "index/thirdparty/faiss/FaissHook.h"
#include "segcore/SegcoreInit.h"
#include "segcore/segcore_init_c.h"
#include "knowhere/archive/KnowhereConfig.h"
#include <iostream>
#include "utils/Log.h"
namespace milvus::segcore {
void
SegcoreInit() {
std::string cpu_flags;
faiss::hook_init(cpu_flags);
static void
SegcoreInitImpl() {
namespace eg = milvus::engine;
eg::KnowhereConfig::SetSimdType(eg::KnowhereConfig::SimdType::AUTO);
eg::KnowhereConfig::SetBlasThreshold(16384);
eg::KnowhereConfig::SetEarlyStopThreshold(0);
eg::KnowhereConfig::SetLogHandler();
eg::KnowhereConfig::SetStatisticsLevel(0);
el::Configurations el_conf;
el_conf.setGlobally(el::ConfigurationType::Enabled, std::to_string(false));
}
} // namespace milvus::segcore
extern "C" void
SegcoreInit() {
milvus::segcore::SegcoreInitImpl();
}

View File

@ -8,8 +8,13 @@
// Unless required by applicable law or agreed to in writing, software distributed under the License
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations under the License
#ifdef __cplusplus
extern "C" {
#endif
namespace milvus::segcore {
void
SegcoreInit();
#ifdef __cplusplus
}
#endif

View File

@ -14,7 +14,7 @@
//
#include "test_utils/DataGen.h"
#include <gtest/gtest.h>
#include "segcore/SegcoreInit.h"
#include "segcore/segcore_init_c.h"
TEST(Init, Naive) {
using namespace milvus;

View File

@ -8,6 +8,7 @@ package querynode
#include "segcore/collection_c.h"
#include "segcore/segment_c.h"
#include "segcore/segcore_init_c.h"
*/
import "C"
@ -103,6 +104,7 @@ func NewQueryNodeWithoutID(ctx context.Context, factory msgstream.Factory) *Quer
func (node *QueryNode) Init() error {
ctx := context.Background()
C.SegcoreInit()
registerReq := &queryPb.RegisterNodeRequest{
Base: &commonpb.MsgBase{
SourceID: Params.QueryNodeID,

View File

@ -3,7 +3,7 @@ package storage
/*
#cgo CFLAGS: -I${SRCDIR}/cwrapper
#cgo LDFLAGS: -L${SRCDIR}/cwrapper/output -l:libwrapper.a -l:libparquet.a -l:libarrow.a -l:libthrift.a -l:libutf8proc.a -lstdc++ -lm
#cgo LDFLAGS: -L${SRCDIR}/cwrapper/output -lwrapper -lparquet -larrow -lthrift -lutf8proc -lstdc++ -lm
#include <stdlib.h>
#include "ParquetWrapper.h"
*/