Opt compile time for Mac (#23453)

Signed-off-by: Enwei Jiao <enwei.jiao@zilliz.com>
This commit is contained in:
Enwei Jiao 2023-04-19 10:24:30 +08:00 committed by GitHub
parent 4508786819
commit e9dcba3050
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 47 deletions

View File

@ -19,7 +19,6 @@ on:
- Makefile
- '!**.md'
- '!build/ci/jenkins/**'
# FIXME(wxyu): not need to run code check, update the ci-passed rules and remove these two lines
- go.mod
- go.sum
@ -31,18 +30,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: 'Generate CCache Hash'
env:
CORE_HASH: ${{ hashFiles( 'internal/core/**/*.cpp', 'internal/core/**/*.cc', 'internal/core/**/*.c', 'internal/core/**/*.h', 'internal/core/**/*.hpp', 'internal/core/**/CMakeLists.txt') }}
run: |
echo "corehash=${CORE_HASH}" >> $GITHUB_ENV
echo "Set CCache hash to ${CORE_HASH}"
- name: Mac Cache CCache Volumes
uses: pat-s/always-upload-cache@v3
with:
path: /var/tmp/ccache
key: macos-ccache-${{ env.corehash }}
restore-keys: macos-ccache-
- name: Setup Go environment
uses: actions/setup-go@v2.2.0
with:
@ -56,22 +43,18 @@ jobs:
- name: Mac Cache Conan Packages
uses: pat-s/always-upload-cache@v3
with:
path: ~/.conan
key: macos-conan-${{ hashFiles('internal/core/conanfile.*') }}
restore-keys: macos-conan-
path: ~/.conan/data
key: macos-conan
- name: Code Check
env:
CCACHE_DIR: /var/tmp/ccache
CCACHE_COMPILERCHECK: content
CCACHE_COMPRESS: 1
CCACHE_COMPRESSLEVEL: 5
CCACHE_MAXSIZE: 2G
BUILD_CACHE: sccache
AWS_ACCESS_KEY_ID: ${{ secrets.BUILD_CACHE_S3_AK }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.BUILD_CACHE_S3_SK }}
SCCACHE_BUCKET: milvus-github-action-build-cache
SCCACHE_REGION: us-west-2
run: |
if [[ ! -d "/var/tmp/ccache" ]];then
mkdir -p /var/tmp/ccache
fi
ls -alh /var/tmp/ccache
brew install libomp ninja openblas ccache pkg-config
brew install libomp ninja openblas sccache pkg-config
pip3 install conan==1.58.0
if [[ ! -d "/usr/local/opt/llvm" ]]; then
ln -s /usr/local/opt/llvm@14 /usr/local/opt/llvm

View File

@ -95,7 +95,6 @@ set( CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${CONAN_PROTOBUF_ROOT})
include( CTest )
include( BuildUtils )
include( DefineOptions )
using_ccache_if_defined(MILVUS_USE_CCACHE)
include( ExternalProject )
include( GNUInstallDirs )

View File

@ -220,18 +220,3 @@ MACRO (import_mysql_inc)
include_directories(${MYSQL_INCLUDE_DIR})
endif ()
ENDMACRO (import_mysql_inc)
MACRO(using_ccache_if_defined MILVUS_USE_CCACHE)
if (MILVUS_USE_CCACHE)
find_program(CCACHE_FOUND ccache)
if (CCACHE_FOUND)
message(STATUS "Using ccache: ${CCACHE_FOUND}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_FOUND})
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_FOUND})
# let ccache preserve C++ comments, because some of them may be
# meaningful to the compiler
set(ENV{CCACHE_COMMENTS} "1")
endif (CCACHE_FOUND)
endif ()
ENDMACRO(using_ccache_if_defined)

View File

@ -188,8 +188,12 @@ if [[ ${MAKE_CLEAN} == "ON" ]]; then
exit 0
fi
CACHE="${BUILD_CACHE:-ccache}"
export CONAN_REVISIONS_ENABLED=1
conan remote add default-conan-local https://milvus01.jfrog.io/artifactory/api/conan/default-conan-local
if [[ ! `conan remote list` == *default-conan-local* ]]; then
conan remote add default-conan-local https://milvus01.jfrog.io/artifactory/api/conan/default-conan-local
fi
unameOut="$(uname -s)"
case "${unameOut}" in
Darwin*)
@ -205,8 +209,8 @@ case "${unameOut}" in
fi
llvm_prefix="$(brew --prefix llvm@${llvm_version})"
export CLANG_TOOLS_PATH="${llvm_prefix}/bin"
export CC="ccache ${llvm_prefix}/bin/clang"
export CXX="ccache ${llvm_prefix}/bin/clang++"
export CC="${CACHE} ${llvm_prefix}/bin/clang"
export CXX="${CACHE} ${llvm_prefix}/bin/clang++"
export ASM="${llvm_prefix}/bin/clang"
export CFLAGS="-Wno-deprecated-declarations -I$(brew --prefix libomp)/include"
export CXXFLAGS=${CFLAGS}
@ -276,9 +280,9 @@ else
make -j ${jobs} install || exit 1
fi
if command -v ccache &> /dev/null
if command -v ${CACHE} &> /dev/null
then
ccache -s
${CACHE} -s
fi
popd