From 7ad060c2baad6262b0a72d3a52dd9091c4dbf876 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 10 Sep 2026 14:42:52 +0200 Subject: [PATCH 1/4] vtk: add build-vtk.yml for riscv64 wheels Mirrors VTK's own .gitlab/ci/configure_wheel.cmake CMake flags and the setup.py bdist_wheel + auditwheel repair recipe from .cmake_build_wheel_linux, driving the manylinux_riscv64 image directly since VTK's wheel build is plain CMake, not cibuildwheel/scikit-build. --- .github/workflows/build-vtk.yml | 200 ++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 .github/workflows/build-vtk.yml diff --git a/.github/workflows/build-vtk.yml b/.github/workflows/build-vtk.yml new file mode 100644 index 000000000..555aeb9bd --- /dev/null +++ b/.github/workflows/build-vtk.yml @@ -0,0 +1,200 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow mirrors the CMake flags VTK's own wheel CI passes in +# https://gitlab.kitware.com/vtk/vtk/-/blob/v9.7.0/.gitlab/ci/configure_wheel.cmake +# and the build recipe in .gitlab/os-linux.yml's .cmake_build_wheel_linux / +# .cmake_test_wheel_linux job templates (CMake + setup.py bdist_wheel, not +# cibuildwheel or scikit-build). +name: Build vtk wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'vtk version to build (git tag without leading v, e.g. 9.7.0)' + required: true + default: '9.7.0' + pull_request: + paths: + - '.github/workflows/build-vtk.yml' + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || '9.7.0' }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + VTK_VERSION: ${{ inputs.version || '9.7.0' }} + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + + build_wheels: + needs: [setup] + name: Build vtk ${{ inputs.version || '9.7.0' }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 1440 # 24h: full VTK rebuild per interpreter, same as upstream's own per-Python wheel jobs + strategy: + fail-fast: false + matrix: + # VTK is not abi3 (VTK_WRAP_PYTHON links directly against Python.h): upstream + # publishes one wheel per interpreter, rebuilding the whole tree each time. + python: ["cp312", "cp313", "cp314", "cp314t"] + + steps: + - name: Checkout VTK v${{ env.VTK_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: Kitware/VTK + ref: v${{ env.VTK_VERSION }} + submodules: false + persist-credentials: false + + - name: Write container script + run: | + mkdir -p build + cat > riscv64-build-and-test.sh <<'EOF' + #!/bin/bash + set -e -x + + case "${PYTHON_TAG}" in + *t) python_dir="/opt/python/${PYTHON_TAG%t}-${PYTHON_TAG}/bin" ;; + *) python_dir="/opt/python/${PYTHON_TAG}-${PYTHON_TAG}/bin" ;; + esac + python_exe="${python_dir}/python" + + case "$1" in + build) + dnf install -y --setopt=install_weak_deps=False ninja-build libX11-devel libXcursor-devel + + # Mirrors .gitlab/ci/configure_wheel.cmake's own -D flags directly rather than + # including its configure_common.cmake tail: that file is upstream's *stock CI* + # config (VTK_BUILD_TESTING, VTK_LINKER_FATAL_WARNINGS ON, ...) meant to catch + # regressions on platforms Kitware already supports, not something that should + # decide whether a first-ever riscv64 build succeeds. VTK_BUILD_ALL_MODULES=ON + # is kept: it's what makes the built tree match the real, full "vtk" wheel. + cmake_args=( + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_INSTALL_PREFIX=/build/install + -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON + -DVTK_BUILD_ALL_MODULES=ON + -DVTK_BUILD_TESTING=OFF + -DVTK_BUILD_EXAMPLES=OFF + -DVTK_WHEEL_BUILD=ON + -DVTK_INSTALL_SDK=ON + -DVTK_ENABLE_REMOTE_MODULES=OFF + -DVTK_DEBUG_LEAKS=OFF + -DVTK_BUILD_PYI_FILES=ON + -DVTK_USE_PCH=OFF + -DVTK_GROUP_ENABLE_Qt=NO + -DVTK_MODULE_ENABLE_VTK_CommonArchive=NO + -DVTK_MODULE_ENABLE_VTK_DomainsMicroscopy=NO + -DVTK_MODULE_ENABLE_VTK_FiltersONNX=NO + -DVTK_MODULE_ENABLE_VTK_FiltersOpenTURNS=NO + -DVTK_MODULE_ENABLE_VTK_FiltersReebGraph=NO + -DVTK_MODULE_ENABLE_VTK_IOADIOS2=NO + -DVTK_MODULE_ENABLE_VTK_IOAlembic=NO + -DVTK_MODULE_ENABLE_VTK_IOFFMPEG=NO + -DVTK_MODULE_ENABLE_VTK_IOGDAL=NO + -DVTK_MODULE_ENABLE_VTK_IOLAS=NO + -DVTK_MODULE_ENABLE_VTK_IOMySQL=NO + -DVTK_MODULE_ENABLE_VTK_IONanoVDB=NO + -DVTK_MODULE_ENABLE_VTK_IOODBC=NO + -DVTK_MODULE_ENABLE_VTK_IOOpenVDB=NO + -DVTK_MODULE_ENABLE_VTK_IOPDAL=NO + -DVTK_MODULE_ENABLE_VTK_IOPostgreSQL=NO + -DVTK_MODULE_ENABLE_VTK_InfovisBoost=NO + -DVTK_MODULE_ENABLE_VTK_InfovisBoostGraphAlgorithms=NO + -DVTK_MODULE_ENABLE_VTK_RenderingFreeTypeFontConfig=NO + -DVTK_MODULE_ENABLE_VTK_RenderingOpenVR=NO + -DVTK_MODULE_ENABLE_VTK_RenderingOpenXR=NO + -DVTK_MODULE_ENABLE_VTK_RenderingZSpace=NO + -DVTK_MODULE_ENABLE_VTK_conduit=NO + -DVTK_MODULE_ENABLE_VTK_fides=NO + -DVTK_MODULE_ENABLE_VTK_xdmf3=NO + -DVTK_MODULE_ENABLE_VTK_IOOCCT=NO + -DVTK_MODULE_ENABLE_VTK_IOIFC=NO + -DVTK_MODULE_ENABLE_VTK_IOUSD=NO + -DVTK_ENABLE_CATALYST=OFF + # riscv64 has no SIMD kernel in vendored libjpeg-turbo (ThirdParty/jpeg); + # upstream's default ON hard-fails configure when SIMD compilation + # isn't available for CMAKE_SYSTEM_PROCESSOR. + -DVTK_JPEG_ENABLE_SIMD=OFF + -DPython3_EXECUTABLE="${python_exe}" + -DPython3_FIND_STRATEGY=LOCATION + ) + + case "${PYTHON_TAG}" in + *t) cmake_args+=(-DVTK_MODULE_ENABLE_VTK_IONetCDF=NO) ;; + esac + + cmake -S /vtk -B /build -GNinja "${cmake_args[@]}" + cmake --build /build --target install --parallel "$(nproc)" + + cd /build + "${python_exe}" -m pip install -U setuptools wheel + "${python_exe}" setup.py bdist_wheel + auditwheel show dist/*.whl + auditwheel repair -w /build/wheelhouse dist/*.whl + ;; + test) + "${python_exe}" -m venv /tmp/venv + . /tmp/venv/bin/activate + pip install -U pip + pip install /build/wheelhouse/*.whl + python -c "import vtk" + python -m vtkmodules.generate_pyi --test -p vtkmodules + ;; + *) + echo "usage: $0 " >&2 + exit 1 + ;; + esac + EOF + + - name: Build wheel + run: | + podman run -t \ + --log-driver=none \ + --network=host \ + -v "${PWD}":/vtk \ + -v "${PWD}/build":/build \ + --workdir /vtk \ + -e PYTHON_TAG="${{ matrix.python }}" \ + --pull=newer \ + "${MANYLINUX_RISCV64_IMAGE}" \ + bash /vtk/riscv64-build-and-test.sh build + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: vtk-${{ env.VTK_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: build/wheelhouse/*.whl + if-no-files-found: error + + - name: Test wheel + run: | + podman run -t \ + --log-driver=none \ + --network=host \ + -v "${PWD}":/vtk \ + -v "${PWD}/build":/build \ + --workdir /vtk \ + -e PYTHON_TAG="${{ matrix.python }}" \ + -e PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ \ + "${MANYLINUX_RISCV64_IMAGE}" \ + bash /vtk/riscv64-build-and-test.sh test + + publish: + name: Publish vtk ${{ inputs.version || '9.7.0' }} + needs: [setup, build_wheels] + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + with: + artifact-pattern: vtk-${{ inputs.version || '9.7.0' }}-*-manylinux_riscv64 From 8a2583c6d21d91759e009a62fc8460a93f43cae1 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 10 Sep 2026 15:03:20 +0200 Subject: [PATCH 2/4] vtk: disable RenderingAnari/RenderingRayTracing (missing anari/ospray) CMake configure hard-fails under VTK_BUILD_ALL_MODULES=ON when the optional anari/ospray external packages aren't present, mirroring .gitlab/ci/configure_options.cmake's own NO default for these modules outside its helide/ospray CI configurations. --- .github/workflows/build-vtk.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build-vtk.yml b/.github/workflows/build-vtk.yml index 555aeb9bd..7ba2f7198 100644 --- a/.github/workflows/build-vtk.yml +++ b/.github/workflows/build-vtk.yml @@ -114,6 +114,13 @@ jobs: -DVTK_MODULE_ENABLE_VTK_RenderingOpenVR=NO -DVTK_MODULE_ENABLE_VTK_RenderingOpenXR=NO -DVTK_MODULE_ENABLE_VTK_RenderingZSpace=NO + # configure_options.cmake (pulled in by the configure_common.cmake tail we + # skip) resolves both of these to NO unless CMAKE_CONFIGURATION contains + # "ospray"/"helide" - true for upstream's real wheel jobs too, but ENABLE + # defaults to YES under VTK_BUILD_ALL_MODULES and hard-fails configure + # when the external anari/ospray package isn't found. + -DVTK_MODULE_ENABLE_VTK_RenderingAnari=NO + -DVTK_MODULE_ENABLE_VTK_RenderingRayTracing=NO -DVTK_MODULE_ENABLE_VTK_conduit=NO -DVTK_MODULE_ENABLE_VTK_fides=NO -DVTK_MODULE_ENABLE_VTK_xdmf3=NO From d707eae95f1c81453ca984472d62268e7f8f888a Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 10 Sep 2026 16:28:59 +0200 Subject: [PATCH 3/4] vtk: build target 'all' before 'install' cmake --build --target install alone left libvtkWrappingTools.so uncompiled: ninja's install edge doesn't transitively pull in every module's compile edge, so install ran against a partially-built tree. Matches ctest_build.cmake's own two-step build-then-install sequence. --- .github/workflows/build-vtk.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build-vtk.yml b/.github/workflows/build-vtk.yml index 7ba2f7198..f90638645 100644 --- a/.github/workflows/build-vtk.yml +++ b/.github/workflows/build-vtk.yml @@ -141,6 +141,11 @@ jobs: esac cmake -S /vtk -B /build -GNinja "${cmake_args[@]}" + # Mirrors ctest_build.cmake: a plain build (default target "all") first, + # then install as its own build invocation - ninja's install edge here + # doesn't transitively pull in every module's compile edge (e.g. + # libvtkWrappingTools.so) when targeted directly. + cmake --build /build --parallel "$(nproc)" cmake --build /build --target install --parallel "$(nproc)" cd /build From 991926f1fdfb4016b1ade76b7ae03b3ca4d846ce Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Fri, 11 Sep 2026 00:03:38 +0200 Subject: [PATCH 4/4] vtk: raise timeout to 48h, add swap space for the 4-core riscv64 runners The previous run wasn't hung: cp312 was still making steady ninja progress (5095/12192 steps) when cancelled at 7.5h, just slow given these runners' 4 cores and VTK's size. cp314t separately hit a Fatal glibc pthread_mutex assertion (job log expired, only a check-run annotation survived); add the same 10GB swap build-deltalake.yml and build-polars-runtime.yml use on this runner class as a defensive measure against memory pressure while re-testing. --- .github/workflows/build-vtk.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-vtk.yml b/.github/workflows/build-vtk.yml index f90638645..1c7d7484c 100644 --- a/.github/workflows/build-vtk.yml +++ b/.github/workflows/build-vtk.yml @@ -38,7 +38,10 @@ jobs: needs: [setup] name: Build vtk ${{ inputs.version || '9.7.0' }} ${{ matrix.python }}-manylinux_riscv64 runs-on: ubuntu-24.04-riscv - timeout-minutes: 1440 # 24h: full VTK rebuild per interpreter, same as upstream's own per-Python wheel jobs + timeout-minutes: 2880 # 48h: these runners have 4 cores, and a prior attempt was only + # ~42% through the ninja build (5095/12192 steps) after 7.5h - + # not hung, just a very large tree at this core count (same + # reasoning as build-nodejs-wheel-binaries.yml's 48h). strategy: fail-fast: false matrix: @@ -55,6 +58,13 @@ jobs: submodules: false persist-credentials: false + # Same OOM guard build-deltalake.yml/build-polars-runtime.yml need on these + # 4-core runners for other comparably large builds. + - name: Set swap space + uses: pierotofy/set-swap-space@fc79b3f67fa8a838184ce84a674ca12238d2c761 # master + with: + swap-size-gb: 10 + - name: Write container script run: | mkdir -p build