Skip to content

Commit 3cd61f3

Browse files
committed
debug
1 parent bd2c5b9 commit 3cd61f3

2 files changed

Lines changed: 38 additions & 30 deletions

File tree

‎.github/workflows/build-with-clang.yml‎

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -70,36 +70,51 @@ jobs:
7070
- name: Build mkl_umath
7171
run: |
7272
source ${{ env.ONEAPI_ROOT }}/setvars.sh
73-
echo $CMPLR_ROOT
7473
export CC=$CMPLR_ROOT/bin/icx
75-
export CFLAGS="-O1 -g -fno-fast-math -fno-omit-frame-pointer -fsanitize=address"
74+
export CFLAGS="-O0 -g -fno-fast-math -fno-strict-aliasing"
7675
export CXXFLAGS="$CFLAGS"
77-
export LDFLAGS="-fsanitize=address -shared-libsan"
7876
pip install . --no-build-isolation --no-deps --verbose
7977
80-
# - name: Run tests under gdb
81-
# run: |
82-
# source ${{ env.ONEAPI_ROOT }}/setvars.sh
83-
# pip install pytest
84-
# setarch $(uname -m) -R gdb --batch -ex r -ex 'info sharedlibrary' -ex 'set print elements 1000' -ex bt --args python -m pytest -s -v --pyargs mkl_umath/mkl_umath/tests || true
85-
86-
# - name: run tests under valgrind
87-
# run: |
88-
# sudo apt-get install -y valgrind
89-
# source ${{ env.ONEAPI_ROOT }}/setvars.sh
90-
# pip install pytest
91-
# valgrind --error-exitcode=99 python -m pytest -s -v --pyargs mkl_umath/mkl_umath/tests || true
9278
93-
# - name: Enable local core dumps (Python 3.13 only)
94-
# run: |
95-
# sudo sysctl -w kernel.core_uses_pid=1
96-
# sudo bash -c 'echo core > /proc/sys/kernel/core_pattern'
97-
# ulimit -c unlimited
98-
# cat /proc/sys/kernel/core_pattern
79+
- name: Enable local core dumps (only Python 3.13)
80+
if: matrix.python == '3.13'
81+
run: |
82+
sudo sysctl -w kernel.core_uses_pid=1 || true
83+
sudo bash -c 'echo core > /proc/sys/kernel/core_pattern' || true
84+
ulimit -c unlimited
85+
echo "core_pattern=$(cat /proc/sys/kernel/core_pattern)"
9986
100-
- name: Run mkl_umath tests
87+
- name: Core sanity check (only Python 3.13)
88+
if: matrix.python == '3.13'
89+
run: |
90+
ulimit -c unlimited
91+
python - <<'EOF'
92+
import ctypes
93+
print("Triggering intentional segfault for core sanity...")
94+
ctypes.string_at(0)
95+
EOF
96+
ls -l core* || echo "No core from sanity segfault"
97+
# Clean up test core so real test core is distinct
98+
rm -f core*
99+
100+
- name: Run mkl_umath tests (expect possible segfault)
101101
run: |
102102
source ${{ env.ONEAPI_ROOT }}/setvars.sh
103103
pip install pytest
104104
cd ..
105-
python -m pytest -s -v --pyargs mkl_umath/mkl_umath/tests
105+
ulimit -c unlimited
106+
python -X faulthandler -m pytest -q --pyargs mkl_umath/mkl_umath/tests || echo "pytest exit code=$?"
107+
ls -l core* || echo "No test core produced"
108+
109+
- name: Post-mortem gdb (only if core, Python 3.13)
110+
if: matrix.python == '3.13'
111+
run: |
112+
COREFILE=$(ls core* 2>/dev/null | head -1 || true)
113+
if [ -f "$COREFILE" ]; then
114+
echo "Analyzing $COREFILE"
115+
sudo apt-get update && sudo apt-get install -y gdb
116+
gdb -batch -ex "set print address off" -ex "bt full" -ex "info threads" python "$COREFILE"
117+
rm -f "$COREFILE"
118+
else
119+
echo "No core to analyze"
120+
fi

‎CMakeLists.txt‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,4 @@ set_target_properties(_patch PROPERTIES C_STANDARD 99)
144144
if (UNIX)
145145
set_target_properties(_patch PROPERTIES INSTALL_RPATH "$ORIGIN/../..;$ORIGIN/../../..;$ORIGIN")
146146
endif()
147-
148147
install(TARGETS _patch LIBRARY DESTINATION mkl_umath)
149-
foreach(tgt mkl_umath_loops _ufuncs _patch)
150-
if (TARGET ${tgt})
151-
target_compile_options(${tgt} PRIVATE -fsanitize=address -fno-omit-frame-pointer)
152-
target_link_options(${tgt} PRIVATE -fsanitize=address)
153-
endif()
154-
endforeach()

0 commit comments

Comments
 (0)