From fa58f3d1e3a8696096a3f0b5b87202a26fb25096 Mon Sep 17 00:00:00 2001 From: Xiangyu Wang Date: Fri, 29 May 2026 11:31:31 +0800 Subject: [PATCH] ci: reuse system OpenBLAS on fast-path jobs and route to split images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Repoint every x86 CI job at the BLAS-variant image introduced in the previous PR and pass `-DUSE_SYSTEM_OPENBLAS=ON` (via the existing `EXTRA_DEFINED` Makefile knob) to the OpenBLAS-backed jobs so they reuse the pre-installed `libopenblas-dev` instead of rebuilding OpenBLAS from source on every run. Routing: * `pr-ci`, `coverage`, `lint`, `check_compatibility`, `performance`, `generate_old_version_index` → `ci-x86-openblas`. All except `generate_old_version_index` also set `USE_SYSTEM_OPENBLAS=ON`; the latter builds historical release tags whose CMake does not understand the flag, so the source-build path is kept there. * `asan_build_and_test`, `tsan_build_and_test`, `asan_with_simd_option`, daily SIMD / TSAN → `ci-x86-mkl` (these jobs already build with `VSAG_ENABLE_INTEL_MKL=ON`). * Daily x86 ASan → `ci-x86-openblas` but deliberately leaves `USE_SYSTEM_OPENBLAS` unset, so `ExternalProject_Add(openblas)` keeps getting exercised end-to-end as the dedicated guard for the from-source build path. CircleCI's `prepare_env_and_create_swap_file` step also installs `liblapacke-dev` so CMake's `find_path(LAPACKE_INCLUDE NAMES lapacke.h)` probe succeeds against the system OpenBLAS. Forwarding `USE_SYSTEM_OPENBLAS` via `EXTRA_DEFINED` keeps `Makefile` untouched and avoids colliding with the in-flight `VSAG_USE_SYSTEM_OPENBLAS` CMake option in #2117. Release artifacts (`scripts/release/dist.sh`, `docker/Dockerfile.dist_*x86`) and `make pyvsag` are unchanged and still build OpenBLAS from source. Refs: #2118 Signed-off-by: Xiangyu Wang Assisted-by: OpenCode:claude-opus-4.7 --- .circleci/continue_config.yml | 8 +++---- .github/workflows/asan_build_and_test.yml | 6 ++--- .github/workflows/asan_with_simd_option.yml | 4 ++-- .github/workflows/check_compatibility.yml | 4 ++-- .github/workflows/coverage.yml | 7 ++++-- .github/workflows/daily_test.yml | 24 +++++++++++++------ .../workflows/generate_old_version_index.yml | 2 +- .github/workflows/lint.yml | 7 ++++-- .github/workflows/performance.yml | 7 ++++-- .github/workflows/pr-ci.yml | 18 ++++++++------ .github/workflows/tsan_build_and_test.yml | 4 ++-- 11 files changed, 57 insertions(+), 34 deletions(-) diff --git a/.circleci/continue_config.yml b/.circleci/continue_config.yml index 58e5db4b43..3560510725 100644 --- a/.circleci/continue_config.yml +++ b/.circleci/continue_config.yml @@ -46,13 +46,13 @@ jobs: command: | sudo apt update sudo apt install -y gfortran python3-dev libomp-15-dev gcc make cmake g++ lcov libaio-dev libcurl4-openssl-dev ninja-build - sudo apt-get install -y libopenblas-dev + sudo apt-get install -y libopenblas-dev liblapacke-dev sudo dd if=/dev/zero of=.swapfile bs=2M count=2048 sudo chmod 600 .swapfile sudo mkswap .swapfile sudo swapon .swapfile - run: - command: export CMAKE_GENERATOR="Ninja" && export VSAG_ENABLE_INTEL_MKL=OFF && export COMPILE_JOBS=4 && make test_parallel + command: export CMAKE_GENERATOR="Ninja" && export VSAG_ENABLE_INTEL_MKL=OFF && export EXTRA_DEFINED="-DUSE_SYSTEM_OPENBLAS=ON" && export COMPILE_JOBS=4 && make test_parallel no_output_timeout: 50m - run: name: remove_swap_file @@ -78,13 +78,13 @@ jobs: command: | sudo apt update sudo apt install -y gfortran python3-dev libomp-15-dev gcc make cmake g++ lcov libaio-dev libcurl4-openssl-dev ninja-build - sudo apt-get install -y libopenblas-dev + sudo apt-get install -y libopenblas-dev liblapacke-dev sudo dd if=/dev/zero of=.swapfile bs=2M count=2048 sudo chmod 600 .swapfile sudo mkswap .swapfile sudo swapon .swapfile - run: - command: export CMAKE_GENERATOR="Ninja" && export VSAG_ENABLE_INTEL_MKL=OFF && export COMPILE_JOBS=4 && make test_parallel + command: export CMAKE_GENERATOR="Ninja" && export VSAG_ENABLE_INTEL_MKL=OFF && export EXTRA_DEFINED="-DUSE_SYSTEM_OPENBLAS=ON" && export COMPILE_JOBS=4 && make test_parallel no_output_timeout: 50m - run: name: remove_swap_file diff --git a/.github/workflows/asan_build_and_test.yml b/.github/workflows/asan_build_and_test.yml index 4072d49d05..201cdcd756 100644 --- a/.github/workflows/asan_build_and_test.yml +++ b/.github/workflows/asan_build_and_test.yml @@ -11,7 +11,7 @@ jobs: name: Asan Build X86 runs-on: ubuntu-22.04 container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-mkl volumes: - /opt:/useless concurrency: @@ -88,7 +88,7 @@ jobs: matrix: test_type: [ unittests, functests ] container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-mkl volumes: - /opt:/useless steps: @@ -162,7 +162,7 @@ jobs: needs: build_asan_x86 runs-on: ubuntu-22.04 container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-mkl volumes: - /opt:/useless concurrency: diff --git a/.github/workflows/asan_with_simd_option.yml b/.github/workflows/asan_with_simd_option.yml index fc21feb38c..a3a5297266 100644 --- a/.github/workflows/asan_with_simd_option.yml +++ b/.github/workflows/asan_with_simd_option.yml @@ -12,7 +12,7 @@ jobs: name: Asan Build Simd runs-on: ubuntu-22.04 container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-mkl volumes: - /opt:/useless strategy: @@ -72,7 +72,7 @@ jobs: group: test-${{ matrix.simd_key }}-${{ matrix.test_type }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-mkl volumes: - /opt:/useless steps: diff --git a/.github/workflows/check_compatibility.yml b/.github/workflows/check_compatibility.yml index fbeeab5723..ec17d43eb3 100644 --- a/.github/workflows/check_compatibility.yml +++ b/.github/workflows/check_compatibility.yml @@ -15,7 +15,7 @@ jobs: group: compatibility-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == "pull_request" }} container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-openblas steps: - name: Install GitHub CLI run: | @@ -38,6 +38,6 @@ jobs: || echo "Warning: Failed to download compatibility indexes" - uses: actions/checkout@v4 - name: Compile Check Compatibility Tools - run: export CMAKE_GENERATOR="Ninja"; make release VSAG_ENABLE_TOOLS=ON + run: export CMAKE_GENERATOR="Ninja" EXTRA_DEFINED="-DUSE_SYSTEM_OPENBLAS=ON"; make release VSAG_ENABLE_TOOLS=ON - name: Run Check Compatibility run: bash ./scripts/check_compatibility.sh diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 84c218f671..3bc865c89d 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -35,7 +35,7 @@ jobs: group: coverage-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-openblas steps: - uses: actions/checkout@v4 with: @@ -54,7 +54,10 @@ jobs: save: ${{ github.event_name != 'pull_request' }} key: build-cov-${{ hashFiles('./CMakeLists.txt') }}-${{ hashFiles('./.circleci/fresh_ci_cache.commit') }} - name: Compile with Coverage Flags - run: export CMAKE_GENERATOR="Ninja"; make cov + # `make cov` defaults to the OpenBLAS backend. Use the system-installed + # OpenBLAS in the ci-x86-openblas image instead of building OpenBLAS + # from source every run. + run: export CMAKE_GENERATOR="Ninja" EXTRA_DEFINED="-DUSE_SYSTEM_OPENBLAS=ON"; make cov - name: Run Test run: | ./scripts/testing/test_parallel_bg.sh diff --git a/.github/workflows/daily_test.yml b/.github/workflows/daily_test.yml index 22f7fe97ef..3560dae68c 100644 --- a/.github/workflows/daily_test.yml +++ b/.github/workflows/daily_test.yml @@ -10,7 +10,7 @@ jobs: name: Asan Build X86 runs-on: ubuntu-22.04 container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-openblas volumes: - /opt:/useless concurrency: @@ -29,7 +29,14 @@ jobs: save: false key: build-${{ hashFiles('./CMakeLists.txt') }}-${{ hashFiles('./.circleci/fresh_ci_cache.commit') }} - name: Make Asan - run: export VSAG_ENABLE_INTEL_MKL=ON CMAKE_GENERATOR="Ninja"; make asan COMPILE_JOBS=4 VSAG_ENABLE_EXAMPLES=ON + # Daily guard for the from-source OpenBLAS build path. We intentionally + # do NOT pass -DUSE_SYSTEM_OPENBLAS=ON here: even though the image + # ships libopenblas-dev, leaving the flag at its default (OFF) means + # CMake downloads and compiles OpenBLAS via ExternalProject_Add, which + # is what release artifacts depend on. PR CI / coverage / lint use the + # system OpenBLAS for speed; this job is the one that keeps the + # source-build path covered. + run: export CMAKE_GENERATOR="Ninja"; make asan COMPILE_JOBS=4 VSAG_ENABLE_EXAMPLES=ON - name: Clean run: find ./build -type f -name "*.o" -exec rm -f {} + - name: Save Test @@ -85,7 +92,10 @@ jobs: matrix: test_type: [ unittests, functests ] container: - image: vsaglib/vsag:ci-x86 + # Matches daily_build_asan_x86: the test binaries were built against the + # from-source OpenBLAS (statically linked), so any image with the rest + # of the runtime would do. We pick ci-x86-openblas for consistency. + image: vsaglib/vsag:ci-x86-openblas volumes: - /opt:/useless steps: @@ -184,7 +194,7 @@ jobs: name: Asan Build Simd runs-on: ubuntu-22.04 container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-mkl volumes: - /opt:/useless strategy: @@ -240,7 +250,7 @@ jobs: group: daily_test_simd-${{ matrix.simd_key }}-${{ matrix.test_type }} cancel-in-progress: true container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-mkl volumes: - /opt:/useless steps: @@ -294,7 +304,7 @@ jobs: group: daily_build_tsan_x86 cancel-in-progress: true container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-mkl steps: - uses: actions/checkout@v4 with: @@ -327,7 +337,7 @@ jobs: group: daily_test_tsan_x86 cancel-in-progress: true container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-mkl steps: - uses: actions/checkout@v4 - name: Clean Env diff --git a/.github/workflows/generate_old_version_index.yml b/.github/workflows/generate_old_version_index.yml index 24f58d9c8c..202a1eaf55 100644 --- a/.github/workflows/generate_old_version_index.yml +++ b/.github/workflows/generate_old_version_index.yml @@ -18,7 +18,7 @@ jobs: permissions: contents: write container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-openblas steps: - name: Get Repo uses: actions/checkout@v4 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3303e6e297..c021bd3b90 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest # runs-on: self-hosted container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-openblas concurrency: group: lint-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} @@ -29,4 +29,7 @@ jobs: save: ${{ github.event_name != 'pull_request' }} key: build-lint-${{ hashFiles('./CMakeLists.txt') }}-${{ hashFiles('./.circleci/fresh_ci_cache.commit') }} - name: Run lint - run: export CMAKE_GENERATOR="Ninja" && make release && make lint + # `make release` defaults to the OpenBLAS backend. Reuse the system + # OpenBLAS shipped in the ci-x86-openblas image so lint doesn't have + # to rebuild OpenBLAS from source on every run. + run: export CMAKE_GENERATOR="Ninja" EXTRA_DEFINED="-DUSE_SYSTEM_OPENBLAS=ON" && make release && make lint diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 4a115799ee..10e3184f44 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -13,7 +13,7 @@ jobs: group: performance-${{ github.event.pull_request.number }} cancel-in-progress: true container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-openblas env: PERF_DINGDING_ACCESS_TOKEN: ${{ secrets.PERF_DINGDING_ACCESS_TOKEN }} PERF_DINGDING_SERCRET: ${{ secrets.PERF_DINGDING_SERCRET }} @@ -25,7 +25,10 @@ jobs: - name: Download Datasets run: bash ./scripts/download_annbench_datasets.sh - name: Build Release - run: make release + # Performance benchmarks already run against OpenBLAS (the default + # backend). Use the pre-installed system OpenBLAS so the BLAS build + # itself doesn't eat into the daily perf window. + run: EXTRA_DEFINED="-DUSE_SYSTEM_OPENBLAS=ON" make release - name: Run Perf - Recall 90%, 95%, 99% run: | ./build-release/tools/eval/eval_performance .github/perf-mini.yml diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index d526f3ae5b..6f49c5a350 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -70,7 +70,7 @@ jobs: if: needs.changes.outputs.cpp == 'true' runs-on: ubuntu-22.04 container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-openblas volumes: - /opt:/useless steps: @@ -84,7 +84,11 @@ jobs: save: ${{ github.event_name != 'pull_request' }} key: build-${{ hashFiles('./CMakeLists.txt') }}-${{ hashFiles('./.circleci/fresh_ci_cache.commit') }} - name: Make Asan - run: export VSAG_ENABLE_INTEL_MKL=ON CMAKE_GENERATOR="Ninja" CMAKE_EXPORT_COMPILE_COMMANDS=ON; make asan VSAG_ENABLE_EXAMPLES=ON + # PR CI runs against the pre-installed system OpenBLAS shipped in the + # ci-x86-openblas image to keep iteration latency low. The + # build-from-source OpenBLAS path is exercised by the daily x86 ASan + # job in daily_test.yml. + run: export CMAKE_GENERATOR="Ninja" CMAKE_EXPORT_COMPILE_COMMANDS=ON EXTRA_DEFINED="-DUSE_SYSTEM_OPENBLAS=ON"; make asan VSAG_ENABLE_EXAMPLES=ON - name: Install clang-tidy 15 run: sudo apt install clang-tidy-15 -y - name: Run Lint @@ -144,7 +148,7 @@ jobs: if: needs.changes.outputs.cpp == 'true' runs-on: ubuntu-22.04 container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-openblas volumes: - /opt:/useless steps: @@ -180,7 +184,7 @@ jobs: if: needs.changes.outputs.cpp == 'true' runs-on: ubuntu-22.04 container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-openblas volumes: - /opt:/useless steps: @@ -216,7 +220,7 @@ jobs: if: needs.changes.outputs.cpp == 'true' runs-on: ubuntu-22.04 container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-openblas volumes: - /opt:/useless steps: @@ -248,7 +252,7 @@ jobs: if: needs.changes.outputs.cpp == 'true' runs-on: ubuntu-latest container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-openblas steps: - name: Install GitHub CLI run: | @@ -271,7 +275,7 @@ jobs: || echo "Warning: Failed to download compatibility indexes" - uses: actions/checkout@v4 - name: Compile Check Compatibility Tools - run: export CMAKE_GENERATOR="Ninja"; make release VSAG_ENABLE_TOOLS=ON + run: export CMAKE_GENERATOR="Ninja" EXTRA_DEFINED="-DUSE_SYSTEM_OPENBLAS=ON"; make release VSAG_ENABLE_TOOLS=ON - name: Run Check Compatibility run: bash ./scripts/check_compatibility.sh diff --git a/.github/workflows/tsan_build_and_test.yml b/.github/workflows/tsan_build_and_test.yml index 0f3e9b8887..d2a3e16c03 100644 --- a/.github/workflows/tsan_build_and_test.yml +++ b/.github/workflows/tsan_build_and_test.yml @@ -39,7 +39,7 @@ jobs: group: test_tsan_x86-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-mkl volumes: - /opt:/useless steps: @@ -76,7 +76,7 @@ jobs: group: test_tsan_x86-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} container: - image: vsaglib/vsag:ci-x86 + image: vsaglib/vsag:ci-x86-mkl steps: - uses: actions/checkout@v4 - name: Clean Env