From cecb16e6686c5e7e61e9b8daee99ea977f0f82ae Mon Sep 17 00:00:00 2001 From: shaia Date: Sat, 3 Jan 2026 23:09:14 +0200 Subject: [PATCH 1/4] fix: Use auditwheel to create manylinux wheels for PyPI PyPI rejects wheels with linux_x86_64 platform tag. Use auditwheel to repair the wheel and apply manylinux_2_17_x86_64 tag. --- .github/workflows/build-wheels.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 119320d..b9bfb93 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -146,8 +146,25 @@ jobs: dir cfd\build\lib\Release # ============ Build wheels ============ - - name: Build wheel (Unix) - if: runner.os != 'Windows' + - name: Build wheel (Linux) + if: runner.os == 'Linux' + env: + CFD_ROOT: ${{ github.workspace }}/cfd + CFD_STATIC_LINK: "ON" + CFD_USE_STABLE_ABI: "ON" + run: | + pip wheel . --no-deps --wheel-dir dist_raw/ + echo "=== Wheel built (raw) ===" + ls -la dist_raw/ + # Repair wheel to add manylinux tag (required for PyPI) + pip install auditwheel patchelf + mkdir -p dist + auditwheel repair dist_raw/*.whl --plat manylinux_2_17_x86_64 -w dist/ + echo "=== Wheel repaired (manylinux) ===" + ls -la dist/ + + - name: Build wheel (macOS) + if: runner.os == 'macOS' env: CFD_ROOT: ${{ github.workspace }}/cfd CFD_STATIC_LINK: "ON" From 93e4b8e1077367e98d16f88418232efa17296e08 Mon Sep 17 00:00:00 2001 From: shaia Date: Sun, 4 Jan 2026 06:53:52 +0200 Subject: [PATCH 2/4] fix: Build Linux wheels inside manylinux container for PyPI compatibility PyPI rejects wheels with linux_x86_64 platform tag. Build the CFD C library and Python wheel inside manylinux_2_28 container to ensure glibc compatibility and proper manylinux tags. - CPU wheels: Built entirely inside manylinux_2_28_x86_64 container - CUDA wheels: Built on host (CUDA not available in manylinux container) --- .github/workflows/build-wheels.yml | 63 ++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index b9bfb93..e6230c9 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -53,20 +53,13 @@ jobs: run: uv pip install --system build scikit-build-core setuptools-scm # ============ CPU-only builds ============ + # Note: Linux CPU build is done inside manylinux container (see Build wheel step) + - name: Build CFD library (Linux - CPU only) if: runner.os == 'Linux' && matrix.variant == 'cpu' run: | - # Build CPU-only for maximum compatibility - # Includes: Scalar, SIMD (AVX2), OpenMP backends - # Excludes: CUDA (avoid runtime dependency issues) - cmake -S cfd -B cfd/build \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_SHARED_LIBS=OFF \ - -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ - -DCFD_ENABLE_CUDA=OFF - cmake --build cfd/build --config Release - echo "=== CFD library built (CPU-only) ===" - ls -la cfd/build/lib/ + echo "Linux CPU build will be done inside manylinux container" + echo "Skipping host build to ensure glibc compatibility" - name: Build CFD library (macOS - CPU only) if: runner.os == 'macOS' @@ -146,21 +139,49 @@ jobs: dir cfd\build\lib\Release # ============ Build wheels ============ - - name: Build wheel (Linux) - if: runner.os == 'Linux' + # Linux wheels must be built inside manylinux container for glibc compatibility + - name: Build wheel (Linux - CPU) + if: runner.os == 'Linux' && matrix.variant == 'cpu' + run: | + docker run --rm \ + -v "${{ github.workspace }}:/workspace" \ + -w /workspace \ + -e CFD_STATIC_LINK=ON \ + -e CFD_USE_STABLE_ABI=ON \ + quay.io/pypa/manylinux_2_28_x86_64 \ + bash -c " + set -e + # Build CFD C library inside container + cmake -S cfd -B cfd/build \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DCFD_ENABLE_CUDA=OFF + cmake --build cfd/build --config Release + + # Build Python wheel + export CFD_ROOT=/workspace/cfd + /opt/python/cp39-cp39/bin/pip install scikit-build-core setuptools-scm + /opt/python/cp39-cp39/bin/pip wheel . --no-deps --wheel-dir dist_raw/ + + # Repair wheel for manylinux compatibility + /opt/python/cp39-cp39/bin/pip install auditwheel + auditwheel repair dist_raw/*.whl --plat manylinux_2_28_x86_64 -w dist/ + " + echo "=== Wheel built (manylinux) ===" + ls -la dist/ + + - name: Build wheel (Linux - CUDA) + if: runner.os == 'Linux' && matrix.variant == 'cuda' env: CFD_ROOT: ${{ github.workspace }}/cfd CFD_STATIC_LINK: "ON" CFD_USE_STABLE_ABI: "ON" run: | - pip wheel . --no-deps --wheel-dir dist_raw/ - echo "=== Wheel built (raw) ===" - ls -la dist_raw/ - # Repair wheel to add manylinux tag (required for PyPI) - pip install auditwheel patchelf - mkdir -p dist - auditwheel repair dist_raw/*.whl --plat manylinux_2_17_x86_64 -w dist/ - echo "=== Wheel repaired (manylinux) ===" + # CUDA wheels use host build (CUDA not available in manylinux container) + # These wheels require matching CUDA runtime on user system + pip wheel . --no-deps --wheel-dir dist/ + echo "=== Wheel built (CUDA - linux native) ===" ls -la dist/ - name: Build wheel (macOS) From 0297fa30b39ed19fd448160293d002dda67cb0d4 Mon Sep 17 00:00:00 2001 From: shaia Date: Sun, 4 Jan 2026 07:41:29 +0200 Subject: [PATCH 3/4] perf: Speed up Windows CUDA toolkit installation Use network method with minimal sub-packages instead of full local install. Only install nvcc, cudart, nvrtc, cublas, and cusparse. --- .github/workflows/build-wheels.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index e6230c9..a07c766 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -123,6 +123,8 @@ jobs: uses: Jimver/cuda-toolkit@v0.2.18 with: cuda: '12.4.0' + method: 'network' + sub-packages: '["nvcc", "cudart", "nvrtc_dev", "cublas_dev", "cusparse_dev"]' - name: Build CFD library (Windows with CUDA) if: runner.os == 'Windows' && matrix.variant == 'cuda' From 2f066eb64fa57c31f695858c52a456cc0e46b089 Mon Sep 17 00:00:00 2001 From: shaia Date: Sun, 4 Jan 2026 07:51:29 +0200 Subject: [PATCH 4/4] fix: Add visual_studio_integration to CUDA sub-packages CMake requires the Visual Studio integration component to find the CUDA toolset when building with MSVC. --- .github/workflows/build-wheels.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index a07c766..5e09176 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -124,7 +124,8 @@ jobs: with: cuda: '12.4.0' method: 'network' - sub-packages: '["nvcc", "cudart", "nvrtc_dev", "cublas_dev", "cusparse_dev"]' + # visual_studio_integration required for CMake to find CUDA toolset + sub-packages: '["nvcc", "cudart", "nvrtc_dev", "cublas_dev", "cusparse_dev", "visual_studio_integration"]' - name: Build CFD library (Windows with CUDA) if: runner.os == 'Windows' && matrix.variant == 'cuda'