Skip to content

debug: py3.13 GHA build-with-clang segfault #215

debug: py3.13 GHA build-with-clang segfault

debug: py3.13 GHA build-with-clang segfault #215

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.3.5'"]
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"<3.1.7" 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: Run mkl_umath tests (expect possible segfault)
run: |
source ${{ env.ONEAPI_ROOT }}/setvars.sh
pip install pytest"<8.4.3"
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"
core_path=$(find . -maxdepth 1 -type f -name core* -print0 | xargs -0 -r readlink -f)
if [ -z "$core_path" ]; then
echo "No test core produced"
else
echo "Found core file: $core_path"
fi
- 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 "thread apply all bt full" -ex "info threads" python "$COREFILE"
rm -f "$COREFILE"
else
echo "No core to analyze"
fi