Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add options to build.sh for cuda arch Issue#2940 #2950

Merged
merged 20 commits into from Jul 23, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -5,7 +5,6 @@ Please mark all changes in change log and use the issue from GitHub
# Milvus 0.11.0 (TBD)

## Bug
\#2852 Fix Prometheus rebuild problem.
- \#2487 Remove timeout when creating collection in dev test
- \#2532 Fix Milvus docker image report illegal instruction
- \#2551 Fix test_hybrid_db and test_rpc error
Expand All @@ -27,8 +26,10 @@ Please mark all changes in change log and use the issue from GitHub
- \#2776 Fix too many data copies during creating IVF index
- \#2813 To implemente RNSG IP
- \#2890 Fix wrong index size
- \#2852 Fix Prometheus rebuild problem.

## Feature
\#2940 Add option to build.sh for cuda arch
- \#2319 Redo metadata to support MVCC
- \#2509 Count up query statistics for debug ease
- \#2572 Support structured data index
Expand Down
7 changes: 6 additions & 1 deletion ci/jenkins/Jenkinsfile
Expand Up @@ -85,7 +85,12 @@ pipeline {
container("milvus-${BINARY_VERSION}-build-env") {
script {
try{
load "${env.WORKSPACE}/ci/jenkins/step/build.groovy"
boolean isNightlyTest = isTimeTriggeredBuild()
if (isNightlyTest || "${params.IS_MANUAL_TRIGGER_TYPE}" == "True") {
load "${env.WORKSPACE}/ci/jenkins/step/nightlyBuild.groovy"
} else {
load "${env.WORKSPACE}/ci/jenkins/step/build.groovy"
}
} catch (Exception e) {
containerLog "milvus-${BINARY_VERSION}-build-env"
throw e
Expand Down
14 changes: 14 additions & 0 deletions ci/jenkins/step/nightlyBuild.groovy
@@ -0,0 +1,14 @@
timeout(time: 120, unit: 'MINUTES') {
dir ("ci/scripts") {
withCredentials([usernamePassword(credentialsId: "${params.JFROG_CREDENTIALS_ID}", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
def checkResult = sh(script: "./check_ccache.sh -l ${params.JFROG_ARTFACTORY_URL}/ccache", returnStatus: true)

if ("${BINARY_VERSION}" == "gpu") {
sh "/bin/bash --login -c \". ./before-install.sh && ./build.sh -t ${params.BUILD_TYPE} -j4 -i ${env.MILVUS_INSTALL_PREFIX} --with_fiu --coverage -l -g -u -s \"-gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_75,code=sm_75\" \""
} else {
sh "/bin/bash --login -c \". ./before-install.sh && ./build.sh -t ${params.BUILD_TYPE} -j4 -i ${env.MILVUS_INSTALL_PREFIX} --with_fiu --coverage -l -u\""
}
sh "./update_ccache.sh -l ${params.JFROG_ARTFACTORY_URL}/ccache -u ${USERNAME} -p ${PASSWORD}"
}
}
}
10 changes: 9 additions & 1 deletion ci/scripts/build.sh
Expand Up @@ -22,6 +22,7 @@ Usage:
Install directory used by install.
-t [BUILD_TYPE] or --build_type=[BUILD_TYPE]
Build type (default: Release)
-s [CUDA_ARCH] Building for the cuda architecture
-j[N] or --jobs=[N] Allow N jobs at once; infinite jobs with no arg.
-l Run cpplint & check clang-format
-n No make and make install step
Expand All @@ -38,7 +39,7 @@ Usage:
Use \"$0 --help\" for more information about a given command.
"

ARGS=`getopt -o "i:t:j::lngcupvh" -l "install_prefix::,build_type::,jobs::,with_mkl,with_fiu,coverage,tests,privileges,help" -n "$0" -- "$@"`
ARGS=`getopt -o "i:t:s:j::lngcupvh" -l "install_prefix::,build_type::,jobs::,with_mkl,with_fiu,coverage,tests,privileges,help" -n "$0" -- "$@"`

eval set -- "${ARGS}"

Expand Down Expand Up @@ -72,6 +73,11 @@ while true ; do
-p|--privileges) PRIVILEGES="ON" ; shift ;;
-v|--verbose) VERBOSE="1" ; shift ;;
-h|--help) echo -e "${HELP}" ; exit 0 ;;
-s)
case "$2" in
"") CUDA_ARCH="DEFAULT"; shift 2 ;;
*) CUDA_ARCH=$2 ; shift 2 ;;
esac ;;
--) shift ; break ;;
*) echo "Internal error!" ; exit 1 ;;
esac
Expand All @@ -86,6 +92,7 @@ BUILD_UNITTEST=${BUILD_UNITTEST:="OFF"}
BUILD_COVERAGE=${BUILD_COVERAGE:="OFF"}
COMPILE_BUILD=${COMPILE_BUILD:="ON"}
GPU_VERSION=${GPU_VERSION:="OFF"}
CUDA_ARCH=${CUDA_ARCH:="DEFAULT"}
RUN_CPPLINT=${RUN_CPPLINT:="OFF"}
WITH_MKL=${WITH_MKL:="OFF"}
FIU_ENABLE=${FIU_ENABLE:="OFF"}
Expand Down Expand Up @@ -125,6 +132,7 @@ CMAKE_CMD="cmake \
-DFAISS_SOURCE=AUTO \
-DOpenBLAS_SOURCE=AUTO \
-DMILVUS_WITH_FIU=${FIU_ENABLE} \
-DMILVUS_CUDA_ARCH=${CUDA_ARCH} \
${MILVUS_CORE_DIR}"
echo ${CMAKE_CMD}
${CMAKE_CMD}
Expand Down
10 changes: 8 additions & 2 deletions core/build.sh
Expand Up @@ -16,9 +16,10 @@ FAISS_ROOT="" #FAISS root path
FAISS_SOURCE="BUNDLED"
WITH_PROMETHEUS="ON"
FIU_ENABLE="OFF"
CUDA_ARCH="DEFAULT"
# BUILD_OPENBLAS="ON" # not used any more

while getopts "p:d:t:f:ulrcghzmei" arg; do
while getopts "p:d:t:f:s:ulrcghzmei" arg; do
case $arg in
p)
INSTALL_PREFIX=$OPTARG
Expand Down Expand Up @@ -64,6 +65,9 @@ while getopts "p:d:t:f:ulrcghzmei" arg; do
i)
FIU_ENABLE="ON"
;;
s)
CUDA_ARCH=$OPTARG
;;
h) # help
echo "

Expand All @@ -83,10 +87,11 @@ parameter:
-m: build with MKL(default: OFF)
-e: build without prometheus(default: OFF)
-i: build FIU_ENABLE(default: OFF)
-s: build with CUDA arch(default:DEFAULT), for example '-gencode=compute_61,code=sm_61'
-h: help

usage:
./build.sh -p \${INSTALL_PREFIX} -t \${BUILD_TYPE} -f \${FAISS_ROOT} [-u] [-l] [-r] [-c] [-z] [-g] [-m] [-e] [-h]
./build.sh -p \${INSTALL_PREFIX} -t \${BUILD_TYPE} -f \${FAISS_ROOT} -s \${CUDA_ARCH}[-u] [-l] [-r] [-c] [-z] [-g] [-m] [-e] [-h]
"
exit 0
;;
Expand Down Expand Up @@ -122,6 +127,7 @@ CMAKE_CMD="cmake \
-DFAISS_WITH_MKL=${WITH_MKL} \
-DMILVUS_WITH_PROMETHEUS=${WITH_PROMETHEUS} \
-DMILVUS_WITH_FIU=${FIU_ENABLE} \
-DMILVUS_CUDA_ARCH=${CUDA_ARCH} \
../"
echo ${CMAKE_CMD}
${CMAKE_CMD}
Expand Down
2 changes: 2 additions & 0 deletions core/src/index/cmake/DefineOptionsCore.cmake
Expand Up @@ -84,6 +84,8 @@ define_option(KNOWHERE_WITH_FAISS_GPU_VERSION "Build with FAISS GPU version" ON)

define_option(FAISS_WITH_MKL "Build FAISS with MKL" OFF)

define_option(MILVUS_CUDA_ARCH "Build with CUDA arch" "DEFAULT")

#----------------------------------------------------------------------
set_option_category("Test and benchmark")

Expand Down
9 changes: 8 additions & 1 deletion core/src/index/cmake/ThirdPartyPackagesCore.cmake
Expand Up @@ -535,10 +535,17 @@ macro(build_faiss)
endif ()

if (MILVUS_GPU_VERSION)
set(FAISS_CONFIGURE_ARGS ${FAISS_CONFIGURE_ARGS}
if (MILVUS_CUDA_ARCH STREQUAL "DEFAULT")
set(FAISS_CONFIGURE_ARGS ${FAISS_CONFIGURE_ARGS}
"--with-cuda=${CUDA_TOOLKIT_ROOT_DIR}"
"--with-cuda-arch=-gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75"
)
else()
set(FAISS_CONFIGURE_ARGS ${FAISS_CONFIGURE_ARGS}
"--with-cuda=${CUDA_TOOLKIT_ROOT_DIR}"
"--with-cuda-arch=${MILVUS_CUDA_ARCH}"
)
endif ()
else ()
set(FAISS_CONFIGURE_ARGS ${FAISS_CONFIGURE_ARGS}
"CPPFLAGS=-DUSE_CPU"
Expand Down