提交 d316f18c 编写于 作者: X XuPeng-SH 提交者: Jin Hai

Integrate libfiu for fault injection (#784)

* (feat): add libfiu for fault injection

* (feat): change libfiu from static to shared

* (feat): install libfiu
上级 60ecd68c
......@@ -178,6 +178,10 @@ if (MILVUS_WITH_PROMETHEUS)
add_compile_definitions("MILVUS_WITH_PROMETHEUS")
endif ()
if (MILVUS_WITH_FIU)
add_compile_definitions("FIU_ENABLE")
endif ()
if (CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fPIC -DELPP_THREAD_SAFE -fopenmp")
if (MILVUS_GPU_VERSION)
......
......@@ -17,8 +17,9 @@ WITH_MKL="OFF"
FAISS_ROOT="" #FAISS root path
FAISS_SOURCE="BUNDLED"
WITH_PROMETHEUS="ON"
FIU_ENABLE="OFF"
while getopts "p:d:t:f:ulrcgjhxzme" arg; do
while getopts "p:d:t:f:ulrcgjhxzmei" arg; do
case $arg in
p)
INSTALL_PREFIX=$OPTARG
......@@ -67,6 +68,9 @@ while getopts "p:d:t:f:ulrcgjhxzme" arg; do
e)
WITH_PROMETHEUS="OFF"
;;
i)
FIU_ENABLE="ON"
;;
h) # help
echo "
......@@ -86,6 +90,7 @@ parameter:
-g: build GPU version(default: OFF)
-m: build with MKL(default: OFF)
-e: build without prometheus(default: OFF)
-i: build FIU_ENABLE(default: OFF)
-h: help
usage:
......@@ -125,6 +130,7 @@ CMAKE_CMD="cmake \
-DMILVUS_GPU_VERSION=${GPU_VERSION} \
-DFAISS_WITH_MKL=${WITH_MKL} \
-DMILVUS_WITH_PROMETHEUS=${WITH_PROMETHEUS} \
-DMILVUS_WITH_FIU=${FIU_ENABLE}
../"
echo ${CMAKE_CMD}
${CMAKE_CMD}
......
......@@ -87,6 +87,8 @@ define_option(MILVUS_WITH_ZLIB "Build with zlib compression" ON)
define_option(MILVUS_WITH_OPENTRACING "Build with Opentracing" ON)
define_option(MILVUS_WITH_FIU "Build with fiu" OFF)
#----------------------------------------------------------------------
set_option_category("Test and benchmark")
......
......@@ -26,7 +26,8 @@ set(MILVUS_THIRDPARTY_DEPENDENCIES
gperftools
GRPC
ZLIB
Opentracing)
Opentracing
fiu)
message(STATUS "Using ${MILVUS_DEPENDENCY_SOURCE} approach to find dependencies")
......@@ -60,6 +61,8 @@ macro(build_dependency DEPENDENCY_NAME)
build_zlib()
elseif ("${DEPENDENCY_NAME}" STREQUAL "Opentracing")
build_opentracing()
elseif ("${DEPENDENCY_NAME}" STREQUAL "fiu")
build_fiu()
else ()
message(FATAL_ERROR "Unknown thirdparty dependency to build: ${DEPENDENCY_NAME}")
endif ()
......@@ -348,6 +351,12 @@ else ()
set(OPENTRACING_SOURCE_URL "https://github.com/opentracing/opentracing-cpp/archive/${OPENTRACING_VERSION}.tar.gz")
endif ()
if (DEFINED ENV{MILVUS_FIU_URL})
set(MILVUS_FIU_URL "$ENV{MILVUS_FIU_URL}")
else ()
set(FIU_SOURCE_URL "https://github.com/albertito/libfiu/archive/${FIU_VERSION}.tar.gz")
endif ()
# ----------------------------------------------------------------------
# Google gtest
......@@ -1268,3 +1277,45 @@ if (MILVUS_WITH_OPENTRACING)
get_target_property(OPENTRACING_INCLUDE_DIR opentracing INTERFACE_INCLUDE_DIRECTORIES)
include_directories(SYSTEM ${OPENTRACING_INCLUDE_DIR})
endif ()
# ----------------------------------------------------------------------
# fiu
macro(build_fiu)
message(STATUS "Building FIU-${FIU_VERSION} from source")
set(FIU_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/fiu_ep-prefix/src/fiu_ep")
set(FIU_SHARED_LIB "${FIU_PREFIX}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}fiu${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(FIU_INCLUDE_DIR "${FIU_PREFIX}/include")
externalproject_add(fiu_ep
URL
${FIU_SOURCE_URL}
${EP_LOG_OPTIONS}
CONFIGURE_COMMAND
""
BUILD_IN_SOURCE
1
BUILD_COMMAND
${MAKE}
${MAKE_BUILD_ARGS}
INSTALL_COMMAND
${MAKE}
"PREFIX=${FIU_PREFIX}"
install
BUILD_BYPRODUCTS
${FIU_SHARED_LIB}
)
file(MAKE_DIRECTORY "${FIU_INCLUDE_DIR}")
add_library(fiu SHARED IMPORTED)
set_target_properties(fiu
PROPERTIES IMPORTED_LOCATION "${FIU_SHARED_LIB}"
INTERFACE_INCLUDE_DIRECTORIES "${FIU_INCLUDE_DIR}")
add_dependencies(fiu fiu_ep)
endmacro()
resolve_dependency(fiu)
get_target_property(FIU_INCLUDE_DIR fiu INTERFACE_INCLUDE_DIRECTORIES)
include_directories(SYSTEM ${FIU_INCLUDE_DIR})
......@@ -141,6 +141,7 @@ set(third_party_libs
yaml-cpp
mysqlpp
zlib
fiu
${boost_lib}
)
......@@ -251,6 +252,9 @@ install(FILES
${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
${CMAKE_BINARY_DIR}/fiu_ep-prefix/src/fiu_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}fiu${CMAKE_SHARED_LIBRARY_SUFFIX}
${CMAKE_BINARY_DIR}/fiu_ep-prefix/src/fiu_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}fiu${CMAKE_SHARED_LIBRARY_SUFFIX}.0
${CMAKE_BINARY_DIR}/fiu_ep-prefix/src/fiu_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}fiu${CMAKE_SHARED_LIBRARY_SUFFIX}.1.00
DESTINATION lib)
add_subdirectory(sdk)
......@@ -10,5 +10,6 @@ GPERFTOOLS_VERSION=2.7
GRPC_VERSION=master
ZLIB_VERSION=v1.2.11
OPENTRACING_VERSION=v1.5.1
FIU_VERSION=1.00
# vim: set filetype=sh:
......@@ -128,6 +128,7 @@ set(unittest_libs
gfortran
opentracing
opentracing_mocktracer
fiu
)
if (MILVUS_WITH_PROMETHEUS)
set(unittest_libs ${unittest_libs}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册