diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 2dd40ce3..2e930544 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -20,7 +20,7 @@ jobs: submodules: recursive - name: Install compiler and CMake - run: sudo apt-get install -y cmake clang + run: sudo apt-get install -y cmake gcc-14 g++-14 - name: Install torch (CPU) and the build backend run: | @@ -37,6 +37,6 @@ jobs: - name: Build and install bartorch env: - CC: clang - CXX: clang++ + CC: gcc-14 + CXX: g++-14 run: pip install -e . --no-build-isolation diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 9c5b1197..89d987ca 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -107,9 +107,10 @@ jobs: python-version: "3.12" cache: pip - # libbartorch is a clang build: BART's nested functions become Blocks. - - name: Install the compiler, OpenMP and CMake - run: sudo apt-get install -y cmake clang libomp-dev + # GCC 14, as upstream BART builds on Linux: its heap trampolines are + # what BART's nested functions need. + - name: Install the compiler and CMake + run: sudo apt-get install -y cmake gcc-14 g++-14 - name: Install torch (CPU) and the build backend run: | @@ -119,8 +120,8 @@ jobs: - name: Build and install bartorch env: - CC: clang - CXX: clang++ + CC: gcc-14 + CXX: g++-14 run: pip install -e . --no-build-isolation - name: Install the documentation and example requirements diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ce1edfa7..a5f358ad 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -208,19 +208,25 @@ jobs: -w wheelhouse/ --plat manylinux_2_28_x86_64 \ --exclude libcudart.so.12 --exclude libcufft.so.11 \ --exclude libcublas.so.12 --exclude libcublasLt.so.12 - - name: Check that it loads without a card + # The wheel carries no interpreter, so it is loaded from each Python the + # package supports. + - name: Check that it loads without a card, on every Python run: | - /opt/python/cp312-cp312/bin/python -m pip install wheelhouse/*.whl \ - torch --index-url https://download.pytorch.org/whl/cpu \ - --extra-index-url https://pypi.org/simple - /opt/python/cp312-cp312/bin/python -c " + for py in cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313 cp314-cp314; do + python=/opt/python/$py/bin/python + $python -m pip install wheelhouse/*.whl \ + torch --index-url https://download.pytorch.org/whl/cpu \ + --extra-index-url https://pypi.org/simple + $python -c " + import sys import bartorch from bartorch import _cuda info = bartorch.build_info() - print(info) + print(sys.version.split()[0], info) assert 'cuda=ON' in info, info print('devices:', _cuda.device_count()) " + done - uses: actions/upload-artifact@v4 with: name: cuda-wheel diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e93bff54..e647c517 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,8 +10,9 @@ env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" jobs: - # BART's nested functions become Blocks under clang and heap trampolines - # under GCC 14. Each platform runs the oldest and the newest Python the + # The toolchains are upstream BART's: GCC 14 on Linux, whose heap + # trampolines carry BART's nested functions, and clang on macOS, where they + # become Blocks. Each platform runs the oldest and the newest Python the # package supports; the wheel workflow tests the wheel on both as well. # Windows is clang from MSYS2's CLANG64 environment, linked against the # Universal C Runtime that official CPython uses. @@ -26,7 +27,7 @@ jobs: extras: "[mkl]" - os: ubuntu-latest python-version: "3.14" - cc: clang + cc: gcc-14 # One job measures coverage for Codecov; the rest only test. coverage: true - os: macos-latest @@ -210,8 +211,8 @@ jobs: python-version: "3.12" cache: pip - - name: Install the CUDA toolkit, clang and OpenMP - run: sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends cmake clang libomp-dev nvidia-cuda-toolkit + - name: Install the CUDA toolkit and GCC + run: sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends cmake gcc-14 g++-14 g++-12 nvidia-cuda-toolkit - name: Install torch (CPU) and the build backend run: | @@ -226,10 +227,13 @@ jobs: - name: Install torchvision from the same index as torch run: pip install torchvision --index-url https://download.pytorch.org/whl/cpu + # BART is GCC 14's, for its heap trampolines; the host side of the + # kernels is GCC 12's, the newest this distribution's nvcc accepts. - name: Build with BART's CUDA kernels env: - CC: clang - CXX: clang++ + CC: gcc-14 + CXX: g++-14 + CUDAHOSTCXX: g++-12 run: pip install -e . --no-build-isolation --config-settings=cmake.define.BARTORCH_CUDA=ON - name: The CUDA build must report its device code and run on the host diff --git a/AGENTS.md b/AGENTS.md index a36cf3d0..3a9a5621 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -624,7 +624,9 @@ the stack needs an executable stack, which glibc 2.41 refuses to `dlopen`; so GCC 14's `-ftrampoline-impl=heap` is required and older GCC is rejected at configure time. BART's own `NOEXEC_STACK` workaround does not help here: it parses a trampoline layout GCC emits only for non-PIC executables, not for a -shared library. Both compilers are built and tested in CI. +shared library. CI builds and tests with upstream BART's toolchains, GCC 14 on +Linux and clang on macOS, and with clang on Windows, whose Blocks come from the +vendored runtime. **Windows** is LLP64: `long` is 32 bits, so BART keeps every extent, stride and flag set in the fixed-width types of `misc/dimtypes.h` (`bart_dim_t`, diff --git a/docs/guides/developer/pull-requests.md b/docs/guides/developer/pull-requests.md index 88ed04b4..a8ffc08b 100644 --- a/docs/guides/developer/pull-requests.md +++ b/docs/guides/developer/pull-requests.md @@ -11,8 +11,7 @@ template: | Validation | The commands run and their results; for a numerical change, the reference and the tolerance; hardware or optional dependencies that were not available | | Public API and documentation | Changes to public behaviour and the documentation updated for them | -CI runs the test matrix (Linux with GCC 14 and clang, macOS and Windows with -clang, each on Python 3.10 and 3.14, and a CUDA build without a device), the lint and spelling checks, and two documentation builds: +CI runs the test matrix (Linux with GCC 14, macOS and Windows with clang, each on Python 3.10 and 3.14, and a CUDA build without a device), the lint and spelling checks, and two documentation builds: the reference without the compiled library, and the executed gallery, which is published from `main` and from release tags. A pull request is merged when CI passes and a maintainer has approved it.