fix(reduce): align mean_axis/norm_axis accumulation with numpy (issue… #89
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # CI: build and test both backends on every push/PR. | |
| # | |
| # Two test jobs run in parallel: | |
| # test-bitexact — NUMPYCPP_STD_ONLY=OFF → must be GREEN (900/900 bit-exact) | |
| # test-std — NUMPYCPP_STD_ONLY=ON → informational only (continue-on-error) | |
| # std::exp/log/pow/atan2 and C++ loops are intentionally NOT bit-exact vs numpy. | |
| # Failures here document the precision gap — they do NOT block the build or DEB. | |
| # | |
| # DEB packaging: single DEB (header-only — backend is consumer's compile choice) | |
| # cmake .. → numpycpp-dev-<ver>-Linux.deb | |
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| # ── Job 1: bit-exact backend ───────────────────────────────────────────────── | |
| test-bitexact: | |
| name: bitexact / Python ${{ matrix.python }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Install Python dependencies | |
| run: pip install "numpy>=1.23,<2.0" pybind11 pytest cmake | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y libeigen3-dev | |
| - name: Show numpy version | |
| run: python -c "import numpy; print('numpy', numpy.__version__)" | |
| - name: Diagnose numpy symbols | |
| run: | | |
| python diagnose_numpy.py | |
| grep -q avx512f /proc/cpuinfo && echo "AVX-512: present in cpuinfo" || echo "AVX-512: NOT in cpuinfo" | |
| working-directory: tests | |
| - name: Configure (bitexact) | |
| run: cmake -S tests -B tests/build -DCMAKE_BUILD_TYPE=Release -DNUMPYCPP_STD_ONLY=OFF | |
| - name: Build | |
| run: cmake --build tests/build -j$(nproc) | |
| - name: Run 900 bit-exact tests | |
| run: | | |
| cd tests | |
| NUMPY_VER=$(python -c "import numpy; print(numpy.__version__)") | |
| echo "numpy version: $NUMPY_VER" | |
| python -m pytest test_all.py -q --tb=short --no-header | |
| # ── Job 2: std / performance-first backend (informational) ─────────────────── | |
| test-std: | |
| name: std / Python ${{ matrix.python }} | |
| runs-on: ubuntu-latest | |
| # std backend is intentionally NOT bit-exact vs numpy. | |
| # Failures are expected and informational — they do NOT block the DEB job. | |
| continue-on-error: true | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Install Python dependencies | |
| run: pip install "numpy>=1.23,<2.0" pybind11 pytest cmake | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y libeigen3-dev | |
| - name: Configure (std) | |
| run: cmake -S tests -B tests/build_std -DCMAKE_BUILD_TYPE=Release -DNUMPYCPP_STD_ONLY=ON | |
| - name: Build | |
| run: cmake --build tests/build_std -j$(nproc) | |
| - name: Show numpy version | |
| run: python -c "import numpy; print('numpy', numpy.__version__)" | |
| - name: Run all 900 tests (std mode — failures expected for transcendental/linalg) | |
| # Run the full suite so the CI log honestly shows which tests align and | |
| # which do not. std::exp/log/pow/atan2 and C++ loops differ from numpy's | |
| # SVML/OpenBLAS paths by 0-2 ULP — those failures are expected and documented. | |
| run: | | |
| cd tests | |
| NUMPY_VER=$(python -c "import numpy; print(numpy.__version__)") | |
| echo "numpy version: $NUMPY_VER" | |
| python -m pytest test_all.py -q --tb=no --no-header | |
| # ── Job 3: package DEB ─────────────────────────────────────────────────────── | |
| package: | |
| name: Package DEB | |
| runs-on: ubuntu-latest | |
| needs: [test-bitexact] # std failures are informational; only bitexact must pass | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build DEB | |
| # Header-only: both backends ship in one DEB. | |
| # Backend is selected by the consumer at cmake configure time | |
| # via -DNUMPYCPP_STD_ONLY=ON/OFF. | |
| run: | | |
| cmake -S . -B build_deb | |
| cmake --build build_deb --target deb | |
| ls build_deb/numpycpp-dev-*.deb | |
| - name: Upload DEB as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: numpycpp-dev-deb | |
| path: build_deb/numpycpp-dev-*.deb |