From abd1641180d7cf4dc97a236a88bf665932fb45f5 Mon Sep 17 00:00:00 2001 From: shaia Date: Tue, 6 Jan 2026 07:18:30 +0200 Subject: [PATCH 1/5] fix: Build Linux CUDA wheels in NVIDIA manylinux container Use nvidia/cuda:12.4.0-devel-rockylinux8 container which is manylinux_2_28 compatible. This produces wheels with proper manylinux tags that PyPI accepts. - Build both CFD C library and Python wheel inside container - Use auditwheel to repair and tag as manylinux_2_28_x86_64 - Support CUDA architectures: Turing, Ampere, Ada, Hopper (75-90) --- .github/workflows/build-wheels.yml | 70 +++++++++++++++--------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index d1e54f0..b017ba7 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -98,36 +98,13 @@ jobs: dir cfd\build\lib\Release # ============ CUDA builds ============ - # Using CUDA 12.4 for compatibility with latest compilers: - # - Windows: MSVC 14.44 requires CUDA 12.4+ - # - Linux: GCC 13 requires CUDA 12.4+ (or use GCC 12 with older CUDA) - - name: Install CUDA Toolkit (Linux) - if: runner.os == 'Linux' && matrix.variant == 'cuda' - run: | - # Install minimal CUDA 12.4 packages (avoid nsight tools with broken dependencies) - wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb - sudo dpkg -i cuda-keyring_1.1-1_all.deb - sudo apt-get update - # Install only compiler and runtime libraries (no profiling tools) - sudo apt-get install -y cuda-nvcc-12-4 cuda-cudart-dev-12-4 cuda-nvrtc-dev-12-4 libcublas-dev-12-4 libcusparse-dev-12-4 - echo "/usr/local/cuda-12.4/bin" >> $GITHUB_PATH - echo "CUDA_PATH=/usr/local/cuda-12.4" >> $GITHUB_ENV - echo "LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH" >> $GITHUB_ENV + # Note: Linux CUDA build is done inside NVIDIA manylinux container (see Build wheel step) - name: Build CFD library (Linux with CUDA) if: runner.os == 'Linux' && matrix.variant == 'cuda' run: | - # Build with CUDA for Turing+ architectures (RTX 20 series onwards) - # 75=Turing, 80=Ampere, 86=Ampere, 89=Ada, 90=Hopper - cmake -S cfd -B cfd/build \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_SHARED_LIBS=OFF \ - -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ - -DCFD_ENABLE_CUDA=ON \ - -DCFD_CUDA_ARCHITECTURES="75;80;86;89;90" - cmake --build cfd/build --config Release - echo "=== CFD library built with CUDA ===" - ls -la cfd/build/lib/ + echo "Linux CUDA build will be done inside NVIDIA manylinux container" + echo "Skipping host build to ensure manylinux compatibility" - name: Install CUDA Toolkit (Windows) if: runner.os == 'Windows' && matrix.variant == 'cuda' @@ -187,15 +164,40 @@ jobs: - 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: | - # 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) ===" + # Build inside NVIDIA's manylinux-compatible CUDA container + # Rocky Linux 8 is manylinux_2_28 compatible + docker run --rm \ + -v "${{ github.workspace }}:/workspace" \ + -w /workspace \ + -e CFD_STATIC_LINK=ON \ + -e CFD_USE_STABLE_ABI=ON \ + nvidia/cuda:12.4.0-devel-rockylinux8 \ + bash -c " + set -e + # Install build tools + dnf install -y cmake python3.11 python3.11-pip python3.11-devel + + # Build CFD C library with CUDA + # 75=Turing, 80=Ampere, 86=Ampere, 89=Ada, 90=Hopper + cmake -S cfd -B cfd/build \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DCFD_ENABLE_CUDA=ON \ + -DCFD_CUDA_ARCHITECTURES='75;80;86;89;90' + cmake --build cfd/build --config Release + + # Build Python wheel + export CFD_ROOT=/workspace/cfd + python3.11 -m pip install scikit-build-core setuptools-scm + python3.11 -m pip wheel . --no-deps --wheel-dir dist_raw/ + + # Repair wheel for manylinux compatibility + python3.11 -m pip install auditwheel + auditwheel repair dist_raw/*.whl --plat manylinux_2_28_x86_64 -w dist/ + " + echo "=== Wheel built (CUDA manylinux) ===" ls -la dist/ - name: Build wheel (macOS) From 2e66f5a7a6d3a3be4f75fd4c938ca3b21a3980bb Mon Sep 17 00:00:00 2001 From: shaia Date: Tue, 6 Jan 2026 07:25:49 +0200 Subject: [PATCH 2/5] fix: Add git to CUDA container for CMake FetchContent CMake needs git to fetch external dependencies (Unity test framework). --- .github/workflows/build-wheels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index b017ba7..075d0e1 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -175,8 +175,8 @@ jobs: nvidia/cuda:12.4.0-devel-rockylinux8 \ bash -c " set -e - # Install build tools - dnf install -y cmake python3.11 python3.11-pip python3.11-devel + # Install build tools (git required for CMake FetchContent) + dnf install -y cmake git python3.11 python3.11-pip python3.11-devel # Build CFD C library with CUDA # 75=Turing, 80=Ampere, 86=Ampere, 89=Ada, 90=Hopper From a654bebcd3bd3a8bf09753d9f735cc9ec194cb05 Mon Sep 17 00:00:00 2001 From: shaia Date: Tue, 6 Jan 2026 07:31:17 +0200 Subject: [PATCH 3/5] fix: Add patchelf to CUDA container for auditwheel auditwheel requires patchelf to repair and retag wheels. --- .github/workflows/build-wheels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 075d0e1..f19ce21 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -175,8 +175,8 @@ jobs: nvidia/cuda:12.4.0-devel-rockylinux8 \ bash -c " set -e - # Install build tools (git required for CMake FetchContent) - dnf install -y cmake git python3.11 python3.11-pip python3.11-devel + # Install build tools (git for CMake FetchContent, patchelf for auditwheel) + dnf install -y cmake git patchelf python3.11 python3.11-pip python3.11-devel # Build CFD C library with CUDA # 75=Turing, 80=Ampere, 86=Ampere, 89=Ada, 90=Hopper From 3bbfbd2ee93a7312ff1ec6ca72832efec3eef834 Mon Sep 17 00:00:00 2001 From: shaia Date: Tue, 6 Jan 2026 07:55:20 +0200 Subject: [PATCH 4/5] fix: Install EPEL for patchelf on Rocky Linux 8 patchelf is in EPEL repository, not base repos. --- .github/workflows/build-wheels.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index f19ce21..cea36da 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -176,6 +176,7 @@ jobs: bash -c " set -e # Install build tools (git for CMake FetchContent, patchelf for auditwheel) + dnf install -y epel-release dnf install -y cmake git patchelf python3.11 python3.11-pip python3.11-devel # Build CFD C library with CUDA From 0b6ed106ea560e6f812d99ab416375c0d317e092 Mon Sep 17 00:00:00 2001 From: shaia Date: Tue, 6 Jan 2026 08:03:21 +0200 Subject: [PATCH 5/5] fix: Install patchelf via pip instead of EPEL EPEL patchelf 0.12 is too old, auditwheel requires >= 0.14. pip provides patchelf 0.17+. --- .github/workflows/build-wheels.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index cea36da..bfda47e 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -175,9 +175,10 @@ jobs: nvidia/cuda:12.4.0-devel-rockylinux8 \ bash -c " set -e - # Install build tools (git for CMake FetchContent, patchelf for auditwheel) - dnf install -y epel-release - dnf install -y cmake git patchelf python3.11 python3.11-pip python3.11-devel + # Install build tools (git for CMake FetchContent) + dnf install -y cmake git python3.11 python3.11-pip python3.11-devel + # Install patchelf via pip (EPEL version is too old for auditwheel) + python3.11 -m pip install patchelf # Build CFD C library with CUDA # 75=Turing, 80=Ampere, 86=Ampere, 89=Ada, 90=Hopper