提交 ff79e179 编写于 作者: Z zhiru

cmake: integerated knowhere

Former-commit-id: bd87ac66e3bc90a85a4fb6517711c4a2c36caaef
上级 01f2db33
......@@ -31,6 +31,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(BUILD_TYPE "release")
else()
set(BUILD_TYPE "debug")
SET(CMAKE_VERBOSE_MAKEFILE on)
endif()
message(STATUS "Build type = ${BUILD_TYPE}")
......@@ -70,21 +71,21 @@ set(MILVUS_BINARY_DIR ${PROJECT_BINARY_DIR})
find_package(CUDA)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -Xcompiler -fPIC -std=c++11 -D_FORCE_INLINES -arch sm_60 --expt-extended-lambda")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -O0 -g")
message("CUDA_TOOLKIT_ROOT_DIR=${CUDA_TOOLKIT_ROOT_DIR}")
message("CUDA_NVCC_FLAGS=${CUDA_NVCC_FLAGS}")
message(STATUS "CUDA_TOOLKIT_ROOT_DIR=${CUDA_TOOLKIT_ROOT_DIR}")
message(STATUS "CUDA_NVCC_FLAGS=${CUDA_NVCC_FLAGS}")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED on)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
message("building milvus_engine on x86 architecture")
message(STATUS "building milvus_engine on x86 architecture")
set(MILVUS_BUILD_ARCH x86_64)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(ppc)")
message("building milvus_engine on ppc architecture")
message(STATUS "building milvus_engine on ppc architecture")
set(MILVUS_BUILD_ARCH ppc64le)
else()
message("unknown processor type")
message("CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}")
message(WARNING "unknown processor type")
message(WARNING "CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}")
set(MILVUS_BUILD_ARCH unknown)
endif()
......@@ -94,6 +95,8 @@ else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g -fPIC -DELPP_THREAD_SAFE -fopenmp")
endif()
set(ALLOW_DUPLICATE_CUSTOM_TARGETS TRUE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(ExternalProject)
......@@ -104,13 +107,13 @@ include(ThirdPartyPackages)
include_directories(${MILVUS_SOURCE_DIR})
link_directories(${MILVUS_BINARY_DIR})
if (NOT DEFINED KNOWHERE_BUILD_DIR)
message(FATAL_ERROR "You must set environment variable KNOWHERE_BUILD_DIR")
endif()
message(STATUS "Build with ${KNOWHERE_BUILD_DIR}")
include_directories(${KNOWHERE_BUILD_DIR}/include)
include_directories(${KNOWHERE_BUILD_DIR}/include/SPTAG/AnnService)
link_directories(${KNOWHERE_BUILD_DIR}/lib)
#if (NOT DEFINED KNOWHERE_BUILD_DIR)
# message(FATAL_ERROR "You must set environment variable KNOWHERE_BUILD_DIR")
#endif()
#message(STATUS "Build with ${KNOWHERE_BUILD_DIR}")
#include_directories(${KNOWHERE_BUILD_DIR}/include)
#include_directories(${KNOWHERE_BUILD_DIR}/include/SPTAG/AnnService)
#link_directories(${KNOWHERE_BUILD_DIR}/lib)
## Following should be check
......@@ -119,7 +122,7 @@ set(MILVUS_ENGINE_SRC ${PROJECT_SOURCE_DIR}/src)
add_compile_definitions(PROFILER=${PROFILER})
message("MILVUS_ENABLE_PROFILING = ${MILVUS_ENABLE_PROFILING}")
message(STATUS "MILVUS_ENABLE_PROFILING = ${MILVUS_ENABLE_PROFILING}")
if (MILVUS_ENABLE_PROFILING STREQUAL "ON")
ADD_DEFINITIONS(-DMILVUS_ENABLE_PROFILING)
endif()
......
......@@ -83,9 +83,9 @@ if [[ ! -d cmake_build ]]; then
MAKE_CLEAN="ON"
fi
pushd `pwd`/src/core
./build.sh ${KNOWHERE_OPTIONS}
popd
#pushd `pwd`/src/core
#./build.sh ${KNOWHERE_OPTIONS}
#popd
cd cmake_build
......
......@@ -4,6 +4,15 @@
# Proprietary and confidential.
#-------------------------------------------------------------------------------
add_subdirectory(core)
set(CORE_INCLUDE_DIRS ${CORE_INCLUDE_DIRS} PARENT_SCOPE)
foreach(dir ${CORE_INCLUDE_DIRS})
message("dir = ${dir}")
include_directories(${dir})
endforeach()
#include_directories(${CMAKE_SOURCE_DIR}/src/core/thirdparty/SPTAG/AnnService)
aux_source_directory(cache cache_files)
aux_source_directory(config config_files)
aux_source_directory(server server_files)
......@@ -87,12 +96,12 @@ set(client_grpc_lib
set(third_party_libs
knowhere
SPTAGLibStatic
arrow
jemalloc_pic
faiss
openblas
lapack
# SPTAGLibStatic
# arrow
# jemalloc_pic
# faiss
# openblas
# lapack
easyloggingpp
sqlite
${client_grpc_lib}
......@@ -115,14 +124,14 @@ set(third_party_libs
cudart
)
if(${BUILD_FAISS_WITH_MKL} STREQUAL "ON")
set(third_party_libs ${third_party_libs}
${MKL_LIBS})
else()
set(third_party_libs ${third_party_libs}
lapack
openblas)
endif()
#if(${BUILD_FAISS_WITH_MKL} STREQUAL "ON")
# set(third_party_libs ${third_party_libs}
# ${MKL_LIBS})
#else()
# set(third_party_libs ${third_party_libs}
# lapack
# openblas)
#endif()
if (MILVUS_ENABLE_PROFILING STREQUAL "ON")
set(third_party_libs ${third_party_libs}
......@@ -171,13 +180,13 @@ set(server_libs
set(knowhere_libs
knowhere
SPTAGLibStatic
arrow
jemalloc_pic
faiss
openblas
lapack
tbb
# SPTAGLibStatic
# arrow
# jemalloc_pic
# faiss
# openblas
# lapack
# tbb
)
add_executable(milvus_server
......@@ -195,8 +204,8 @@ target_link_libraries(milvus_server ${server_libs} ${knowhere_libs} ${third_part
install(TARGETS milvus_server DESTINATION bin)
install(FILES
${KNOWHERE_BUILD_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}tbb${CMAKE_SHARED_LIBRARY_SUFFIX}
${KNOWHERE_BUILD_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}tbb${CMAKE_SHARED_LIBRARY_SUFFIX}.2
${CMAKE_SOURCE_DIR}/src/core/thirdparty/tbb/${CMAKE_SHARED_LIBRARY_PREFIX}tbb${CMAKE_SHARED_LIBRARY_SUFFIX}
${CMAKE_SOURCE_DIR}/src/core/thirdparty/tbb/${CMAKE_SHARED_LIBRARY_PREFIX}tbb${CMAKE_SHARED_LIBRARY_SUFFIX}.2
${CMAKE_BINARY_DIR}/mysqlpp_ep-prefix/src/mysqlpp_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlpp${CMAKE_SHARED_LIBRARY_SUFFIX}
${CMAKE_BINARY_DIR}/mysqlpp_ep-prefix/src/mysqlpp_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlpp${CMAKE_SHARED_LIBRARY_SUFFIX}.3
${CMAKE_BINARY_DIR}/mysqlpp_ep-prefix/src/mysqlpp_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlpp${CMAKE_SHARED_LIBRARY_SUFFIX}.3.2.4
......
......@@ -5,6 +5,7 @@
#-------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.14)
message(STATUS "---------------core--------------")
message(STATUS "Building using CMake version: ${CMAKE_VERSION}")
set(KNOWHERE_VERSION "0.1.0")
......@@ -42,14 +43,14 @@ find_package(CUDA)
#set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -O0 -g")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
message("building milvus_engine on x86 architecture")
message(STATUS "building milvus_engine on x86 architecture")
set(KNOWHERE_BUILD_ARCH x86_64)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(ppc)")
message("building milvus_engine on ppc architecture")
message(STATUS "building milvus_engine on ppc architecture")
set(KNOWHERE_BUILD_ARCH ppc64le)
else()
message("unknown processor type")
message("CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}")
message(WARNING "unknown processor type")
message(WARNING "CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}")
set(KNOWHERE_BUILD_ARCH unknown)
endif()
......@@ -60,14 +61,21 @@ else()
endif()
message(STATUS "Build type = ${BUILD_TYPE}")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(CORE_SOURCE_DIR ${PROJECT_SOURCE_DIR})
set(CORE_BINARY_DIR ${PROJECT_BINARY_DIR})
message(STATUS "Core source dir: ${PROJECT_SOURCE_DIR}")
message(STATUS "Core binary dir: ${PROJECT_BINARY_DIR}")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CORE_SOURCE_DIR}/cmake")
include(ExternalProject)
include(DefineOptions)
include(BuildUtils)
include(ThirdPartyPackages)
include(DefineOptionsCore)
include(BuildUtilsCore)
include(ThirdPartyPackagesCore)
add_subdirectory(src)
set(CORE_INCLUDE_DIRS ${CORE_INCLUDE_DIRS} PARENT_SCOPE)
if(BUILD_UNIT_TEST STREQUAL "ON")
add_subdirectory(test)
endif()
......
......@@ -75,7 +75,7 @@ function(ExternalProject_Use_Cache project_name package_file install_path)
"Extracting ${package_file} to ${install_path}"
COMMAND
${CMAKE_COMMAND} -E tar xzvf ${package_file} ${install_path}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
WORKING_DIRECTORY ${CORE_BINARY_DIR}
)
ExternalProject_Add_StepTargets(${project_name} extract)
......
......@@ -104,7 +104,7 @@ macro(config_summary)
message(STATUS " Source directory: ${CMAKE_CURRENT_SOURCE_DIR}")
if(${CMAKE_EXPORT_COMPILE_COMMANDS})
message(
STATUS " Compile commands: ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json")
STATUS " Compile commands: ${CORE_BINARY_DIR}/compile_commands.json")
endif()
foreach(category ${KNOWHERE_OPTION_CATEGORIES})
......
set(TBB_DIR ${CMAKE_SOURCE_DIR}/thirdparty/tbb)
set(TBB_DIR ${CORE_SOURCE_DIR}/thirdparty/tbb)
set(TBB_LIBRARIES ${TBB_DIR}/libtbb.so)
include_directories(${TBB_DIR}/include)
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
link_directories(${CUDA_TOOLKIT_ROOT_DIR}/lib64)
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR}/thirdparty)
include_directories(${CMAKE_SOURCE_DIR}/thirdparty/SPTAG/AnnService)
include_directories(${CMAKE_SOURCE_DIR}/thirdparty/jsoncons-0.126.0/include)
include_directories(${CORE_SOURCE_DIR}/include)
include_directories(${CORE_SOURCE_DIR}/thirdparty)
include_directories(${CORE_SOURCE_DIR}/thirdparty/SPTAG/AnnService)
include_directories(${CORE_SOURCE_DIR}/thirdparty/jsoncons-0.126.0/include)
set(SPTAG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../thirdparty/SPTAG)
set(SPTAG_SOURCE_DIR ${CORE_SOURCE_DIR}/thirdparty/SPTAG)
file(GLOB HDR_FILES
${SPTAG_SOURCE_DIR}/AnnService/inc/Core/*.h
${SPTAG_SOURCE_DIR}/AnnService/inc/Core/Common/*.h
......@@ -26,7 +26,9 @@ file(GLOB SRC_FILES
#add_library(SPTAGLib SHARED ${SRC_FILES} ${HDR_FILES})
#target_link_libraries(SPTAGLib ${TBB_LIBRARIES})
add_library(SPTAGLibStatic STATIC ${SRC_FILES} ${HDR_FILES})
if(NOT TARGET SPTAGLibStatic)
add_library(SPTAGLibStatic STATIC ${SRC_FILES} ${HDR_FILES})
endif()
set(external_srcs
knowhere/adapter/sptag.cpp
......@@ -58,7 +60,7 @@ set(depend_libs
openblas
lapack
arrow
jemalloc_pic
${ARROW_PREFIX}/lib/libjemalloc_pic.a
cudart
cublas
gomp
......@@ -66,11 +68,13 @@ set(depend_libs
pthread
)
add_library(
knowhere STATIC
${external_srcs}
${index_srcs}
)
if(NOT TARGET knowhere)
add_library(
knowhere STATIC
${external_srcs}
${index_srcs}
)
endif()
#target_compile_options(knowhere PUBLIC "-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
target_link_libraries(
......@@ -112,24 +116,42 @@ INSTALL(FILES ${OPENBLAS_REAL_STATIC_LIB}
DESTINATION lib
)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/thirdparty/tbb/libtbb.so.2
INSTALL(FILES ${CORE_SOURCE_DIR}/thirdparty/tbb/libtbb.so.2
# RENAME "libtbb.so.2"
DESTINATION lib
)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/thirdparty/tbb/libtbb.so
INSTALL(FILES ${CORE_SOURCE_DIR}/thirdparty/tbb/libtbb.so
# RENAME "libtbb.so"
DESTINATION lib
)
set(CORE_INCLUDE_DIRS
${CORE_SOURCE_DIR}/include
${CORE_SOURCE_DIR}/thirdparty
${CORE_SOURCE_DIR}/thirdparty/SPTAG/AnnService
${CORE_SOURCE_DIR}/thirdparty/jsoncons-0.126.0/include
${ARROW_INCLUDE_DIR}
${FAISS_INCLUDE_DIR}
${OPENBLAS_INCLUDE_DIR}
${LAPACK_INCLUDE_DIR}
${CORE_SOURCE_DIR}/thirdparty/tbb/include
)
set(CORE_INCLUDE_DIRS ${CORE_INCLUDE_DIRS} PARENT_SCOPE)
#include_directories(SYSTEM ${CORE_SOURCE_DIR}/include)
#include_directories(SYSTEM ${CORE_SOURCE_DIR}/thirdparty/jsoncons-0.126.0/include)
#include_directories(SYSTEM ${CORE_SOURCE_DIR}/thirdparty/tbb/include)
#include_directories(SYSTEM ${SPTAG_SOURCE_DIR}/AnnService/inc)
INSTALL(DIRECTORY
${CMAKE_SOURCE_DIR}/include/knowhere
${CMAKE_SOURCE_DIR}/thirdparty/jsoncons-0.126.0/include/jsoncons
${CMAKE_SOURCE_DIR}/thirdparty/jsoncons-0.126.0/include/jsoncons_ext
${CORE_SOURCE_DIR}/include/knowhere
${CORE_SOURCE_DIR}/thirdparty/jsoncons-0.126.0/include/jsoncons
${CORE_SOURCE_DIR}/thirdparty/jsoncons-0.126.0/include/jsoncons_ext
${ARROW_INCLUDE_DIR}/arrow
# ${ARROW_INCLUDE_DIR}/parquet
${FAISS_PREFIX}/include/faiss
${OPENBLAS_INCLUDE_DIR}/
${CMAKE_SOURCE_DIR}/thirdparty/tbb/include/tbb
${CORE_SOURCE_DIR}/thirdparty/tbb/include/tbb
DESTINATION
include)
......
include_directories(${CMAKE_SOURCE_DIR}/thirdparty)
include_directories(${CMAKE_SOURCE_DIR}/thirdparty/SPTAG/AnnService)
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR}/thirdparty/jsoncons-0.126.0/include)
include_directories(${CORE_SOURCE_DIR}/thirdparty)
include_directories(${CORE_SOURCE_DIR}/thirdparty/SPTAG/AnnService)
include_directories(${CORE_SOURCE_DIR}/include)
include_directories(${CORE_SOURCE_DIR}/thirdparty/jsoncons-0.126.0/include)
include_directories(/usr/local/cuda/include)
link_directories(/usr/local/cuda/lib64)
link_directories(${CMAKE_SOURCE_DIR}/thirdparty/tbb)
link_directories(${CORE_SOURCE_DIR}/thirdparty/tbb)
set(unittest_libs
gtest gmock gtest_main gmock_main)
message(STATUS "arrow prefix: ${ARROW_PREFIX}")
message(STATUS "libjemalloc_pic path: ${ARROW_PREFIX}/lib/libjemalloc_pic.a")
set(depend_libs
faiss openblas lapack
arrow jemalloc_pic
arrow "${ARROW_PREFIX}/lib/libjemalloc_pic.a"
tbb
)
......@@ -24,32 +26,36 @@ set(basic_libs
#<IVF-TEST>
#<<<<<<<<<<
set(ivf_srcs
${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/ivf.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/gpu_ivf.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/cloner.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/idmap.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/adapter/structure.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/common/exception.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/common/timer.cpp
${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/ivf.cpp
${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/gpu_ivf.cpp
${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/cloner.cpp
${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/idmap.cpp
${CORE_SOURCE_DIR}/src/knowhere/adapter/structure.cpp
${CORE_SOURCE_DIR}/src/knowhere/common/exception.cpp
${CORE_SOURCE_DIR}/src/knowhere/common/timer.cpp
utils.cpp
)
add_executable(test_ivf test_ivf.cpp ${ivf_srcs})
if(NOT TARGET test_ivf)
add_executable(test_ivf test_ivf.cpp ${ivf_srcs})
endif()
target_link_libraries(test_ivf ${depend_libs} ${unittest_libs} ${basic_libs})
#<<<<<<<<<<
#<IDMAP-TEST>
#<<<<<<<<<<
set(idmap_srcs
${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/idmap.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/ivf.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/cloner.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/gpu_ivf.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/adapter/structure.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/common/exception.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/common/timer.cpp
${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/idmap.cpp
${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/ivf.cpp
${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/cloner.cpp
${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/gpu_ivf.cpp
${CORE_SOURCE_DIR}/src/knowhere/adapter/structure.cpp
${CORE_SOURCE_DIR}/src/knowhere/common/exception.cpp
${CORE_SOURCE_DIR}/src/knowhere/common/timer.cpp
utils.cpp
)
add_executable(test_idmap test_idmap.cpp ${idmap_srcs})
if(NOT TARGET test_idmap)
add_executable(test_idmap test_idmap.cpp ${idmap_srcs})
endif()
target_link_libraries(test_idmap ${depend_libs} ${unittest_libs} ${basic_libs})
#<<<<<<<<<<
......@@ -57,17 +63,19 @@ target_link_libraries(test_idmap ${depend_libs} ${unittest_libs} ${basic_libs})
#<KDT-TEST>
#<<<<<<<<<<
set(kdt_srcs
${CMAKE_SOURCE_DIR}/src/knowhere/index/preprocessor/normalize.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/kdt_parameters.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/cpu_kdt_rng.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/adapter/structure.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/adapter/sptag.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/common/exception.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/adapter/arrow.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/common/timer.cpp
${CORE_SOURCE_DIR}/src/knowhere/index/preprocessor/normalize.cpp
${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/kdt_parameters.cpp
${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/cpu_kdt_rng.cpp
${CORE_SOURCE_DIR}/src/knowhere/adapter/structure.cpp
${CORE_SOURCE_DIR}/src/knowhere/adapter/sptag.cpp
${CORE_SOURCE_DIR}/src/knowhere/common/exception.cpp
${CORE_SOURCE_DIR}/src/knowhere/adapter/arrow.cpp
${CORE_SOURCE_DIR}/src/knowhere/common/timer.cpp
utils.cpp
)
add_executable(test_kdt test_kdt.cpp ${kdt_srcs})
if(NOT TARGET test_kdt)
add_executable(test_kdt test_kdt.cpp ${kdt_srcs})
endif()
target_link_libraries(test_kdt
SPTAGLibStatic
${depend_libs} ${unittest_libs} ${basic_libs})
......
include_directories(${CMAKE_SOURCE_DIR}/thirdparty)
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CORE_SOURCE_DIR}/thirdparty)
include_directories(${CORE_SOURCE_DIR}/include)
include_directories(/usr/local/cuda/include)
link_directories(/usr/local/cuda/lib64)
link_directories(${CMAKE_SOURCE_DIR}/thirdparty/tbb)
link_directories(${CORE_SOURCE_DIR}/thirdparty/tbb)
set(unittest_libs
gtest gmock gtest_main gmock_main)
set(depend_libs
faiss openblas lapack
arrow jemalloc_pic
arrow ${ARROW_PREFIX}/lib/libjemalloc_pic.a
tbb
)
......@@ -21,6 +21,8 @@ set(basic_libs
#<GPU-TEST>
#<<<<<<<<<<
add_executable(test_gpu gpuresource_test.cpp)
if(NOT TARGET test_gpu)
add_executable(test_gpu gpuresource_test.cpp)
endif()
target_link_libraries(test_gpu ${depend_libs} ${unittest_libs} ${basic_libs})
#<<<<<<<<<<
......@@ -14,33 +14,35 @@ else ()
endif ()
message(${OpenMP_CXX_FLAGS})
include_directories(${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/nsg)
include_directories(${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/nsg)
#include_directories(/home/zilliz/opt/app/pyenv/versions/3.6.8/include/python3.6m)
#include_directories(/home/zilliz/opt/app/pyenv/versions/3.6.8/envs/megasearch_testframework_dev/lib/python3.6/site-packages/numpy/core/include)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/nsg nsg_src)
aux_source_directory(${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/nsg nsg_src)
#add_library(nsg_raw SHARED ${nsg_src})
#target_link_libraries(nsg_raw
# gomp)
set(interface_src
${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/ivf.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/gpu_ivf.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/cloner.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/idmap.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/index/vector_index/nsg_index.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/adapter/structure.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/common/exception.cpp
${CMAKE_SOURCE_DIR}/src/knowhere/common/timer.cpp
${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/ivf.cpp
${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/gpu_ivf.cpp
${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/cloner.cpp
${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/idmap.cpp
${CORE_SOURCE_DIR}/src/knowhere/index/vector_index/nsg_index.cpp
${CORE_SOURCE_DIR}/src/knowhere/adapter/structure.cpp
${CORE_SOURCE_DIR}/src/knowhere/common/exception.cpp
${CORE_SOURCE_DIR}/src/knowhere/common/timer.cpp
../utils.cpp
)
add_executable(test_nsg
test_nsg.cpp
${interface_src}
${nsg_src}
)
if(NOT TARGET test_nsg)
add_executable(test_nsg
test_nsg.cpp
${interface_src}
${nsg_src}
)
endif()
#target_link_libraries(test_nsg
# # libprofiler.so
## -ltcmalloc
......
......@@ -6,6 +6,8 @@
link_directories(
"${CMAKE_BINARY_DIR}/lib"
)
#include_directories(${CMAKE_SOURCE_DIR}/src/core/include)
#include_directories(${CMAKE_SOURCE_DIR}/src/core/thirdparty/SPTAG/AnnService)
aux_source_directory(${MILVUS_ENGINE_SRC}/db db_srcs)
aux_source_directory(${MILVUS_ENGINE_SRC}/config config_files)
......@@ -38,6 +40,13 @@ set(unittest_libs
cudart
)
#message(STATUS "unittest core dir: ${CMAKE_CURRENT_BINARY_DIR}/core")
#add_subdirectory(${CMAKE_SOURCE_DIR}/src/core ${CMAKE_CURRENT_BINARY_DIR}/core)
foreach(dir ${CORE_INCLUDE_DIRS})
message("dir = ${dir}")
include_directories(${dir})
endforeach()
add_subdirectory(server)
add_subdirectory(db)
add_subdirectory(knowhere)
......
......@@ -69,24 +69,24 @@ set(db_libs
set(knowhere_libs
knowhere
SPTAGLibStatic
arrow
jemalloc_pic
faiss
openblas
lapack
tbb
# SPTAGLibStatic
# arrow
# jemalloc_pic
# faiss
# openblas
# lapack
# tbb
cudart
cublas
)
if(${BUILD_FAISS_WITH_MKL} STREQUAL "ON")
set(db_libs ${db_libs} ${MKL_LIBS} ${MKL_LIBS})
else()
set(db_libs ${db_libs}
lapack
openblas)
endif()
#if(${BUILD_FAISS_WITH_MKL} STREQUAL "ON")
# set(db_libs ${db_libs} ${MKL_LIBS} ${MKL_LIBS})
#else()
# set(db_libs ${db_libs}
# lapack
# openblas)
#endif()
target_link_libraries(db_test ${db_libs} ${knowhere_libs} ${unittest_libs})
......
......@@ -8,13 +8,13 @@ set(helper
set(knowhere_libs
knowhere
SPTAGLibStatic
arrow
jemalloc_pic
faiss
openblas
lapack
tbb
# SPTAGLibStatic
# arrow
# jemalloc_pic
# faiss
# openblas
# lapack
# tbb
cudart
cublas
)
......
......@@ -72,13 +72,13 @@ add_executable(metrics_test ${count_test_src} ${require_files} )
set(knowhere_libs
knowhere
SPTAGLibStatic
arrow
jemalloc_pic
faiss
openblas
lapack
tbb
# SPTAGLibStatic
# arrow
# jemalloc_pic
# faiss
# openblas
# lapack
# tbb
)
target_link_libraries(metrics_test
......@@ -96,12 +96,12 @@ target_link_libraries(metrics_test
mysqlpp
${unittest_libs}
)
if(${BUILD_FAISS_WITH_MKL} STREQUAL "ON")
target_link_libraries(metrics_test ${MKL_LIBS} ${MKL_LIBS})
else()
target_link_libraries(metrics_test
lapack
openblas)
endif()
#if(${BUILD_FAISS_WITH_MKL} STREQUAL "ON")
# target_link_libraries(metrics_test ${MKL_LIBS} ${MKL_LIBS})
#else()
# target_link_libraries(metrics_test
# lapack
# openblas)
#endif()
install(TARGETS metrics_test DESTINATION bin)
\ No newline at end of file
......@@ -69,24 +69,24 @@ set(scheduler_libs
set(knowhere_libs
knowhere
SPTAGLibStatic
arrow
jemalloc_pic
faiss
openblas
lapack
tbb
# SPTAGLibStatic
# arrow
# jemalloc_pic
# faiss
# openblas
# lapack
# tbb
cudart
cublas
)
if (${BUILD_FAISS_WITH_MKL} STREQUAL "ON")
set(db_libs ${db_libs} ${MKL_LIBS} ${MKL_LIBS})
else ()
set(db_libs ${db_libs}
lapack
openblas)
endif ()
#if (${BUILD_FAISS_WITH_MKL} STREQUAL "ON")
# set(db_libs ${db_libs} ${MKL_LIBS} ${MKL_LIBS})
#else ()
# set(db_libs ${db_libs}
# lapack
# openblas)
#endif ()
target_link_libraries(scheduler_test ${scheduler_libs} ${knowhere_libs} ${unittest_libs})
......
......@@ -34,9 +34,9 @@ cuda_add_executable(server_test
set(require_libs
knowhere
faiss
openblas
lapack
# faiss
# openblas
# lapack
stdc++
cudart
cublas
......@@ -51,13 +51,13 @@ set(require_libs
pthread
)
if(${BUILD_FAISS_WITH_MKL} STREQUAL "ON")
set(require_libs ${require_libs} ${MKL_LIBS} ${MKL_LIBS})
else()
set(require_libs ${require_libs}
lapack
openblas)
endif()
#if(${BUILD_FAISS_WITH_MKL} STREQUAL "ON")
# set(require_libs ${require_libs} ${MKL_LIBS} ${MKL_LIBS})
#else()
# set(require_libs ${require_libs}
# lapack
# openblas)
#endif()
target_link_libraries(server_test
${require_libs}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册