From f60189196cd4f62bf39f5d503f31db6eb4bda85b Mon Sep 17 00:00:00 2001 From: Zhiru Zhu Date: Fri, 15 Nov 2019 17:44:38 +0800 Subject: [PATCH] update build.sh and install.md --- core/build.sh | 168 +++++++++++++++++++++++++------------------------- install.md | 13 ++-- 2 files changed, 93 insertions(+), 88 deletions(-) diff --git a/core/build.sh b/core/build.sh index 85dea0ab..7d901e3c 100755 --- a/core/build.sh +++ b/core/build.sh @@ -18,64 +18,64 @@ FAISS_ROOT="" #FAISS root path FAISS_SOURCE="BUNDLED" WITH_PROMETHEUS="ON" -while getopts "p:d:t:f:ulrcgjhxzme" arg -do - case $arg in - p) - INSTALL_PREFIX=$OPTARG - ;; - d) - DB_PATH=$OPTARG - ;; - t) - BUILD_TYPE=$OPTARG # BUILD_TYPE - ;; - f) - FAISS_ROOT=$OPTARG - FAISS_SOURCE="AUTO" - ;; - u) - echo "Build and run unittest cases" ; - BUILD_UNITTEST="ON"; - ;; - l) - RUN_CPPLINT="ON" - ;; - r) - if [[ -d ${BUILD_OUTPUT_DIR} ]]; then - rm ./${BUILD_OUTPUT_DIR} -r - MAKE_CLEAN="ON" - fi - ;; - c) - BUILD_COVERAGE="ON" - ;; - z) - PROFILING="ON" - ;; - j) - USE_JFROG_CACHE="ON" - ;; - x) - CUSTOMIZATION="OFF" # force use ori faiss - ;; - g) - GPU_VERSION="ON" - ;; - m) - WITH_MKL="ON" - ;; - e) - WITH_PROMETHEUS="OFF" - ;; - h) # help - echo " +while getopts "p:d:t:f:ulrcgjhxzme" arg; do + case $arg in + p) + INSTALL_PREFIX=$OPTARG + ;; + d) + DB_PATH=$OPTARG + ;; + t) + BUILD_TYPE=$OPTARG # BUILD_TYPE + ;; + f) + FAISS_ROOT=$OPTARG + FAISS_SOURCE="AUTO" + ;; + u) + echo "Build and run unittest cases" + BUILD_UNITTEST="ON" + ;; + l) + RUN_CPPLINT="ON" + ;; + r) + if [[ -d ${BUILD_OUTPUT_DIR} ]]; then + rm ./${BUILD_OUTPUT_DIR} -r + MAKE_CLEAN="ON" + fi + ;; + c) + BUILD_COVERAGE="ON" + ;; + z) + PROFILING="ON" + ;; + j) + USE_JFROG_CACHE="ON" + ;; + x) + CUSTOMIZATION="OFF" # force use ori faiss + ;; + g) + GPU_VERSION="ON" + ;; + m) + WITH_MKL="ON" + ;; + e) + WITH_PROMETHEUS="OFF" + ;; + h) # help + echo " parameter: -p: install prefix(default: $(pwd)/milvus) -d: db data path(default: /tmp/milvus) -t: build type(default: Debug) --f: faiss root path(default: empty) +-f: FAISS root path(default: empty). The path should be an absolute path + containing the pre-installed lib/ and include/ directory of FAISS -u: building unit test options(default: OFF) -l: run cpplint, clang-format and clang-tidy(default: OFF) -r: remove previous build directory(default: OFF) @@ -84,30 +84,30 @@ parameter: -j: use jfrog cache build directory(default: OFF) -g: build GPU version(default: OFF) -m: build with MKL(default: OFF) --e: build without prometheus +-e: build without prometheus(default: OFF) -h: help usage: ./build.sh -p \${INSTALL_PREFIX} -t \${BUILD_TYPE} -f \${FAISS_ROOT} [-u] [-l] [-r] [-c] [-z] [-j] [-g] [-m] [-e] [-h] " - exit 0 - ;; - ?) - echo "ERROR! unknown argument" - exit 1 - ;; - esac + exit 0 + ;; + ?) + echo "ERROR! unknown argument" + exit 1 + ;; + esac done if [[ ! -d ${BUILD_OUTPUT_DIR} ]]; then - mkdir ${BUILD_OUTPUT_DIR} + mkdir ${BUILD_OUTPUT_DIR} fi cd ${BUILD_OUTPUT_DIR} # remove make cache since build.sh -l use default variables # force update the variables each time -make rebuild_cache > /dev/null 2>&1 +make rebuild_cache >/dev/null 2>&1 CMAKE_CMD="cmake \ -DBUILD_UNIT_TEST=${BUILD_UNITTEST} \ @@ -129,25 +129,25 @@ echo ${CMAKE_CMD} ${CMAKE_CMD} if [[ ${MAKE_CLEAN} == "ON" ]]; then - make clean + make clean fi if [[ ${RUN_CPPLINT} == "ON" ]]; then - # cpplint check - make lint - if [ $? -ne 0 ]; then - echo "ERROR! cpplint check failed" - exit 1 - fi - echo "cpplint check passed!" + # cpplint check + make lint + if [ $? -ne 0 ]; then + echo "ERROR! cpplint check failed" + exit 1 + fi + echo "cpplint check passed!" - # clang-format check - make check-clang-format - if [ $? -ne 0 ]; then - echo "ERROR! clang-format check failed" - exit 1 - fi - echo "clang-format check passed!" + # clang-format check + make check-clang-format + if [ $? -ne 0 ]; then + echo "ERROR! clang-format check failed" + exit 1 + fi + echo "clang-format check passed!" # # clang-tidy check # make check-clang-tidy @@ -158,11 +158,11 @@ if [[ ${RUN_CPPLINT} == "ON" ]]; then # echo "clang-tidy check passed!" else - # strip binary symbol - if [[ ${BUILD_TYPE} != "Debug" ]]; then - strip src/milvus_server - fi + # strip binary symbol + if [[ ${BUILD_TYPE} != "Debug" ]]; then + strip src/milvus_server + fi - # compile and build - make -j 8 install || exit 1 + # compile and build + make -j 8 install || exit 1 fi diff --git a/install.md b/install.md index 4d2088a3..6711b41f 100644 --- a/install.md +++ b/install.md @@ -29,10 +29,15 @@ $ ./build.sh -t Release ``` By default, it will build CPU version. To build GPU version, add `-g` option -``` +```shell $ ./build.sh -g ``` +If you want to know the complete build options, run +```shell +$./build.sh -h +``` + When the build is completed, all the stuff that you need in order to run Milvus will be installed under `[Milvus root path]/core/milvus`. ## Launch Milvus server @@ -43,13 +48,13 @@ $ cd [Milvus root path]/core/milvus Add `lib/` directory to `LD_LIBRARY_PATH` -``` +```shell $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:[Milvus root path]/core/milvus/lib ``` Then start Milvus server: -``` +```shell $ cd scripts $ ./start_server.sh ``` @@ -65,7 +70,7 @@ $ ./stop_server.sh `protocol https not supported or disabled in libcurl`. First, make sure you have `libcurl4-openssl-dev` installed in your system. Then try reinstall CMake from source with `--system-curl` option: -``` +```shell $ ./bootstrap --system-curl $ make $ sudo make install -- GitLab