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

View File

@ -220,18 +220,3 @@ MACRO (import_mysql_inc)
include_directories(${MYSQL_INCLUDE_DIR}) include_directories(${MYSQL_INCLUDE_DIR})
endif () endif ()
ENDMACRO (import_mysql_inc) 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 exit 0
fi fi
CACHE="${BUILD_CACHE:-ccache}"
export CONAN_REVISIONS_ENABLED=1 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)" unameOut="$(uname -s)"
case "${unameOut}" in case "${unameOut}" in
Darwin*) Darwin*)
@ -205,8 +209,8 @@ case "${unameOut}" in
fi fi
llvm_prefix="$(brew --prefix llvm@${llvm_version})" llvm_prefix="$(brew --prefix llvm@${llvm_version})"
export CLANG_TOOLS_PATH="${llvm_prefix}/bin" export CLANG_TOOLS_PATH="${llvm_prefix}/bin"
export CC="ccache ${llvm_prefix}/bin/clang" export CC="${CACHE} ${llvm_prefix}/bin/clang"
export CXX="ccache ${llvm_prefix}/bin/clang++" export CXX="${CACHE} ${llvm_prefix}/bin/clang++"
export ASM="${llvm_prefix}/bin/clang" export ASM="${llvm_prefix}/bin/clang"
export CFLAGS="-Wno-deprecated-declarations -I$(brew --prefix libomp)/include" export CFLAGS="-Wno-deprecated-declarations -I$(brew --prefix libomp)/include"
export CXXFLAGS=${CFLAGS} export CXXFLAGS=${CFLAGS}
@ -276,9 +280,9 @@ else
make -j ${jobs} install || exit 1 make -j ${jobs} install || exit 1
fi fi
if command -v ccache &> /dev/null if command -v ${CACHE} &> /dev/null
then then
ccache -s ${CACHE} -s
fi fi
popd popd