debug: py3.13 GHA build-with-clang segfault #204
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
| name: Build project with IntelLLVM clang compiler | |
| on: | |
| pull_request: | |
| push: | |
| branches: [master] | |
| permissions: read-all | |
| jobs: | |
| build-with-clang: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python: ["3.10", "3.11", "3.12", "3.13"] | |
| numpy_version: ["numpy'>=2'"] | |
| env: | |
| ONEAPI_ROOT: /opt/intel/oneapi | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| steps: | |
| - name: Cancel Previous Runs | |
| uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1 | |
| with: | |
| access_token: ${{ github.token }} | |
| - name: Add Intel repository | |
| run: | | |
| wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB | |
| sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB | |
| rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB | |
| sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main" | |
| sudo apt-get update | |
| - name: Install Intel OneAPI | |
| run: | | |
| sudo apt-get install intel-oneapi-compiler-dpcpp-cpp | |
| sudo apt-get install intel-oneapi-tbb | |
| sudo apt-get install intel-oneapi-mkl-devel | |
| - name: Setup Python | |
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| architecture: x64 | |
| - name: Checkout repo | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install mkl_umath dependencies | |
| run: | | |
| pip install scikit-build cmake ninja cython setuptools">=77" | |
| pip install ${{ matrix.numpy_version }} | |
| - name: List oneAPI folder content | |
| run: ls ${{ env.ONEAPI_ROOT }}/compiler | |
| # - name: Install gdb | |
| # run: | | |
| # sudo apt-get update --fix-missing | |
| # sudo apt-get install -y gdb | |
| - name: Build mkl_umath | |
| run: | | |
| source ${{ env.ONEAPI_ROOT }}/setvars.sh | |
| export CC=$CMPLR_ROOT/bin/icx | |
| export CFLAGS="-O0 -g -fno-fast-math -fno-strict-aliasing" | |
| export CXXFLAGS="$CFLAGS" | |
| pip install . --no-build-isolation --no-deps --verbose | |
| - name: Enable local core dumps (only Python 3.13) | |
| if: matrix.python == '3.13' | |
| run: | | |
| sudo sysctl -w kernel.core_uses_pid=1 || true | |
| sudo bash -c 'echo core > /proc/sys/kernel/core_pattern' || true | |
| ulimit -c unlimited | |
| echo "core_pattern=$(cat /proc/sys/kernel/core_pattern)" | |
| - name: Core sanity check (only Python 3.13) | |
| if: matrix.python == '3.13' | |
| run: | | |
| ulimit -c unlimited | |
| python - <<'EOF' | |
| import ctypes | |
| print("Triggering intentional segfault for core sanity...") | |
| ctypes.string_at(0) | |
| EOF | |
| ls -l core* || echo "No core from sanity segfault" | |
| # Clean up test core so real test core is distinct | |
| rm -f core* | |
| - name: Run mkl_umath tests (expect possible segfault) | |
| run: | | |
| source ${{ env.ONEAPI_ROOT }}/setvars.sh | |
| pip install pytest | |
| cd .. | |
| ulimit -c unlimited | |
| python -X faulthandler -m pytest -q --pyargs mkl_umath/mkl_umath/tests || echo "pytest exit code=$?" | |
| ls -l core* || echo "No test core produced" | |
| - name: Post-mortem gdb (only if core, Python 3.13) | |
| if: matrix.python == '3.13' | |
| run: | | |
| COREFILE=$(ls core* 2>/dev/null | head -1 || true) | |
| if [ -f "$COREFILE" ]; then | |
| echo "Analyzing $COREFILE" | |
| sudo apt-get update && sudo apt-get install -y gdb | |
| gdb -batch -ex "set print address off" -ex "bt full" -ex "info threads" python "$COREFILE" | |
| rm -f "$COREFILE" | |
| else | |
| echo "No core to analyze" | |
| fi |