Skip to content

Commit 89f5386

Browse files
Update build scripts (#1619)
* update build scripts Signed-off-by: Alexandr Guzhva <alexanderguzhva@gmail.com> * fix clang-tidy Signed-off-by: Alexandr Guzhva <alexanderguzhva@gmail.com> * continue fixing clang-tidy Signed-off-by: Alexandr Guzhva <alexanderguzhva@gmail.com> * more fixes Signed-off-by: Alexandr Guzhva <alexanderguzhva@gmail.com> * more fixes Signed-off-by: Alexandr Guzhva <alexanderguzhva@gmail.com> * more cleanup Signed-off-by: Alexandr Guzhva <alexanderguzhva@gmail.com> * more fixes Signed-off-by: Alexandr Guzhva <alexanderguzhva@gmail.com> * more cleanup Signed-off-by: Alexandr Guzhva <alexanderguzhva@gmail.com> * more formatting Signed-off-by: Alexandr Guzhva <alexanderguzhva@gmail.com> --------- Signed-off-by: Alexandr Guzhva <alexanderguzhva@gmail.com>
1 parent 95b6f47 commit 89f5386

52 files changed

Lines changed: 1204 additions & 892 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-tidy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Checks: >
2626
performance-trivially-destructible, performance-inefficient-vector-operation,
2727
performance-move-const-arg, performance-move-constructor-init,
2828
performance-noexcept-move-constructor, performance-no-automatic-move,
29-
performance-type-promotion-in-math-fn
29+
performance-type-promotion-in-math-fn, -clang-analyzer-optin.core.EnumCastOutOfRange,
30+
-modernize-use-ranges
3031
3132
WarningsAsErrors: '*'
3233
HeaderFilterRegex: '^(?:.*\/knowhere\/include\/.+\.h)|(?:.*\/knowhere\/src\/.+\.h)$'

.claude/skills/building/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ description: Use when building knowhere from source, configuring build options (
1010
```bash
1111
# Ubuntu/Debian
1212
sudo apt install build-essential libopenblas-openmp-dev libaio-dev python3-dev python3-pip
13-
pip3 install conan==2.25.1 --user
13+
pip3 install conan==2.28.1 --user
1414
conan profile detect --force
1515
conan remote add default-conan-local2 https://milvus01.jfrog.io/artifactory/api/conan/default-conan-local2
1616
export PATH=$PATH:$HOME/.local/bin

.github/workflows/analyzer.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: Build & Analyzer
4040
run: |
4141
make WITH_UT=True \
42-
&& find src -type f | grep -E "\.cc$" | xargs /usr/bin/run-clang-tidy-14.py -quiet -p=./build/Release
42+
&& find src -type f | grep -E "\.cc$" | xargs /usr/bin/run-clang-tidy-22.py -quiet -p=./build/Release
4343
- name: Save Cache
4444
uses: ./.github/actions/cache-save
4545
with:

.github/workflows/release-python.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ jobs:
2020
include:
2121
- os: ubuntu-22.04
2222
arch: x86_64
23-
# - os: ubuntu-20.04
24-
# arch: aarch64
2523
# - os: macos-11
2624
# arch: x86_64
2725
# - os: macos-11
@@ -37,20 +35,21 @@ jobs:
3735

3836
- uses: actions/checkout@v3
3937

40-
- uses: pypa/cibuildwheel@v2.12.1
38+
- uses: pypa/cibuildwheel@v3.4.1
4139
env:
42-
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311*"
43-
CIBW_SKIP: "*musllinux*" # faiss-cpu fails to build on musllinux
40+
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*"
41+
CIBW_SKIP: "*musllinux* cp31?t-*" # faiss-cpu fails to build on musllinux; skip free-threaded CPython.
4442
CIBW_ARCHS: ${{ matrix.arch }}
43+
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
44+
CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux_2_28"
4545
CIBW_BEFORE_ALL_LINUX: "bash scripts/install_deps.sh && make"
46-
# Use portable wheel build script instead of plain setup.py
47-
CIBW_BEFORE_BUILD: "pip3 install pytest numpy faiss-cpu bfloat16 auditwheel"
46+
CIBW_BEFORE_BUILD: "python -m pip install wheel pytest 'numpy>=2,<3' ml-dtypes faiss-cpu auditwheel"
4847
# Custom build command using our portable wheel builder
4948
CIBW_BUILD_FRONTEND: "build"
5049
# Note: cibuildwheel will use our build_portable_wheel.sh via setup.py
5150
# The script automatically handles auditwheel repair
52-
CIBW_TEST_REQUIRES: "pytest numpy<2 faiss-cpu bfloat16"
53-
CIBW_TEST_COMMAND: "pytest {project}/tests/python/test_index_with_random.py"
51+
CIBW_TEST_REQUIRES: "wheel pytest numpy>=2,<3 ml-dtypes faiss-cpu"
52+
CIBW_TEST_COMMAND: "python -m pytest {project}/tests/python/test_index_with_random.py"
5453
CIBW_ENVIRONMENT: "SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.tag }}"
5554
with:
5655
package-dir: python
@@ -61,7 +60,7 @@ jobs:
6160

6261
upload:
6362
needs: [build_wheels]
64-
runs-on: ubuntu-20.04
63+
runs-on: ubuntu-22.04
6564
steps:
6665
- uses: actions/download-artifact@v3
6766
with:

.github/workflows/ut.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,15 @@ jobs:
103103
- name: Setup Python
104104
uses: actions/setup-python@v2
105105
with:
106-
python-version: "3.8"
106+
python-version: "3.10"
107107
- name: Install Dependency
108108
run: |
109109
bash scripts/install_deps.sh
110-
pip3 install pytest faiss-cpu
110+
python -m pip install wheel pytest 'numpy>=2,<3' ml-dtypes faiss-cpu
111111
- name: Install GCC 12
112112
# GCC 11 (ubuntu-22.04 default) has incomplete C++20 support:
113113
# std::partial_ordering, std::strong_ordering, std::weak_ordering
114114
# from <compare> are not available, causing abseil build failures.
115-
# Installed after install_deps.sh so bfloat16 builds with GCC 11
116-
# (bfloat16 fails on GCC 12 due to missing #include <memory>).
117115
run: |
118116
sudo apt-get update
119117
sudo apt-get install -y gcc-12 g++-12
@@ -139,4 +137,4 @@ jobs:
139137
cd python && pip3 install dist/*-manylinux*.whl
140138
- name: Test
141139
run: |
142-
pytest tests/python/test_index_with_random.py
140+
python -m pytest tests/python/test_index_with_random.py

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ coverage/
5555

5656
# virtualenv
5757
venv/
58+
**/.venv/
5859
**/dist/
5960
**/knowhere.egg-info/
6061
**/knowhere/knowhere_wrap.cpp

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ CARDINAL_VERSION_FORCE_CHECKOUT ?=
3131
WITH_DEBUG ?=
3232
CONAN_PROFILE ?=
3333

34+
# CMake 4.x removed compatibility with cmake_minimum_required versions below
35+
# 3.5. Export this so Conan-built third-party packages inherit it too.
36+
export CMAKE_POLICY_VERSION_MINIMUM ?= 3.5
37+
3438
# Prevent build-flag variables from leaking into the environment of child
3539
# processes (conan / cmake). Without this, GNU Make exports command-line
3640
# variables such as WITH_ASAN to every sub-process, which causes the custom
@@ -104,7 +108,7 @@ ifneq ($(CARDINAL_VERSION_FORCE_CHECKOUT),)
104108
endif
105109

106110
ifdef CONAN_PROFILE
107-
CONAN_SETTINGS += -pr $(CONAN_PROFILE)
111+
CONAN_SETTINGS += -pr:h $(CONAN_PROFILE) -pr:b $(CONAN_PROFILE)
108112
endif
109113

110114
.PHONY: build test \
@@ -173,7 +177,7 @@ help: ## Show available targets
173177
@echo " WITH_CARDINAL=True Enable Cardinal build"
174178
@echo " CARDINAL_VERSION_FORCE_CHECKOUT=True Force Cardinal checkout to configured version"
175179
@echo " WITH_DEBUG=True Debug build (default: Release)"
176-
@echo " CONAN_PROFILE=<p> Use a custom Conan profile (e.g. clang, gcc-15)"
180+
@echo " CONAN_PROFILE=<p> Use one custom Conan profile for host and build"
177181
@echo " LIBCXX=<lib> Override compiler.libcxx (auto-detected from OS)"
178182
@echo ""
179183
@echo "Examples:"
@@ -183,5 +187,5 @@ help: ## Show available targets
183187
@echo " make WITH_GPU=True WITH_UT=True # GPU UT"
184188
@echo " make WITH_DEBUG=True WITH_UT=True # CPU debug + UT"
185189
@echo " make LIBCXX=libc++ # override compiler.libcxx"
186-
@echo " make CONAN_PROFILE=gcc15 # CPU with custom profile"
190+
@echo " make CONAN_PROFILE=/path/to/profile # CPU with custom profile"
187191
@echo ""

ci/docker/builder/cpu/ubuntu20.04/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3 \
3333
# install knowhere dependancies
3434
RUN apt update \
3535
&& apt install -y libopenblas-openmp-dev libcurl4-openssl-dev libaio-dev libevent-dev lcov \
36-
&& pip3 install conan==2.25.1 \
36+
&& pip3 install conan==2.28.1 \
3737
&& conan profile detect --force \
3838
&& conan remote add default-conan-local2 https://milvus01.jfrog.io/artifactory/api/conan/default-conan-local2 \
3939
&& export PATH=$PATH:$HOME/.local/bin

ci/docker/builder/cpu/ubuntu22.04/Dockerfile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ ENV CMAKE_TAR="cmake-3.28.5-linux-x86_64.tar.gz"
66
ENV CCACHE_VERSION="v4.9.1"
77
ENV CCACHE_DIR="ccache-4.9.1-linux-x86_64"
88
ENV CCACHE_TAR="ccache-4.9.1-linux-x86_64.tar.xz"
9-
ENV BFLOAT16_WHL="bfloat16-1.4.0-cp311-cp311-linux_x86_64.whl"
109

1110
RUN apt update \
1211
&& apt install -y ca-certificates apt-transport-https software-properties-common lsb-release \
@@ -26,7 +25,7 @@ RUN apt update \
2625
&& apt remove --purge -y \
2726
&& rm -rf /var/lib/apt/lists/*
2827

29-
# install cmake, ccache and bfloat16
28+
# install cmake, ccache and Python BF16 dtype support
3029
RUN cd /tmp \
3130
&& wget https://github.com/Kitware/CMake/releases/download/${CMAKE_VERSION}/${CMAKE_TAR} \
3231
&& tar --strip-components=1 -xz -C /usr/local -f ${CMAKE_TAR} \
@@ -35,14 +34,12 @@ RUN cd /tmp \
3534
&& tar -xf ${CCACHE_TAR} \
3635
&& cp ${CCACHE_DIR}/ccache /usr/local/bin \
3736
&& rm -f ${CCACHE_TAR} \
38-
&& wget https://github.com/zilliztech/knowhere/releases/download/v2.3.1/${BFLOAT16_WHL} \
39-
&& pip3 install ${BFLOAT16_WHL} \
40-
&& rm -f ${BFLOAT16_WHL}
37+
&& pip3 install 'numpy>=2,<3' ml-dtypes
4138

4239
# install knowhere dependancies
4340
RUN apt update \
4441
&& apt install -y libopenblas-openmp-dev libcurl4-openssl-dev libaio-dev libevent-dev lcov \
45-
&& pip3 install conan==2.25.1 \
42+
&& pip3 install conan==2.28.1 \
4643
&& conan profile detect --force \
4744
&& conan remote add default-conan-local2 https://milvus01.jfrog.io/artifactory/api/conan/default-conan-local2
4845
# clone knowhere repo and build to update .conan2

ci/docker/builder/cpu/ubuntu22.04/arm64/Dockerfile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ ENV CMAKE_VERSION="v3.30.5"
55
ENV CMAKE_TAR="cmake-3.30.5-linux-aarch64.tar.gz"
66
ENV CCACHE_DIR="ccache-4.9.1"
77
ENV CCACHE_SRC_TAR="v4.9.1.tar.gz"
8-
ENV BFLOAT16_WHL="bfloat16-1.4.0-cp311-cp311-linux_aarch64.whl"
98

109
RUN apt update \
1110
&& apt install -y ca-certificates apt-transport-https software-properties-common lsb-release \
@@ -25,7 +24,7 @@ RUN apt update \
2524
&& apt remove --purge -y \
2625
&& rm -rf /var/lib/apt/lists/*
2726

28-
# install cmake, ccache and bfloat16
27+
# install cmake, ccache and Python BF16 dtype support
2928
RUN cd /tmp \
3029
&& wget https://github.com/Kitware/CMake/releases/download/${CMAKE_VERSION}/${CMAKE_TAR} \
3130
&& tar --strip-components=1 -xz -C /usr/local -f ${CMAKE_TAR} \
@@ -37,14 +36,12 @@ RUN cd /tmp \
3736
&& cmake -D CMAKE_BUILD_TYPE=Release .. \
3837
&& make -j3 && make install \
3938
&& cd ../.. && rm -rf ${CCACHE_DIR} ${CCACHE_SRC_TAR} \
40-
&& wget https://github.com/zilliztech/knowhere/releases/download/v2.3.1/${BFLOAT16_WHL} \
41-
&& pip3 install ${BFLOAT16_WHL} \
42-
&& rm -f ${BFLOAT16_WHL}
39+
&& pip3 install 'numpy>=2,<3' ml-dtypes
4340

4441
# install knowhere dependancies
4542
RUN apt update \
4643
&& apt install -y libopenblas-openmp-dev libcurl4-openssl-dev libaio-dev libevent-dev lcov \
47-
&& pip3 install conan==2.25.1 \
44+
&& pip3 install conan==2.28.1 \
4845
&& conan profile detect --force \
4946
&& conan remote add default-conan-local2 https://milvus01.jfrog.io/artifactory/api/conan/default-conan-local2
5047
# clone knowhere repo and build to update .conan2

0 commit comments

Comments
 (0)