isce3 icon indicating copy to clipboard operation
isce3 copied to clipboard

interp1d pybind11 test crashes on macOS M1 (Abort trap: 6)

Open DennyChee opened this issue 9 months ago • 2 comments

I'm running into a consistent crash when running the interp1d Python bindings on macOS M1, even after a clean rebuild with proper libomp support.

System Info

OS: macOS 14.5 (Apple Silicon M1)

Python: 3.11 (via conda miniforge)

ISCE3 commit: 4.0.6

Compiler: LLVM Clang via Homebrew

OpenMP: libomp installed (brew install libomp)

Build Configuration

export CC=/opt/homebrew/opt/llvm/bin/clang
export CXX=/opt/homebrew/opt/llvm/bin/clang++
cmake ../src \
  -DCMAKE_INSTALL_PREFIX=../install \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
  -DCMAKE_C_COMPILER=$CC \
  -DCMAKE_CXX_COMPILER=$CXX \
  -DPython_EXECUTABLE=$CONDA_PREFIX/bin/python3 \
  -DCMAKE_CXX_FLAGS="-fopenmp=libomp -I/opt/homebrew/opt/libomp/include -I/opt/homebrew/opt/llvm/include" \
  -DCMAKE_EXE_LINKER_FLAGS="-L/opt/homebrew/opt/libomp/lib -lomp"

What I Tried

Rebuilt ISCE3 from scratch with the flags above

Verified libomp is correctly linked

Confirmed import isce3.ext.isce3.core works from Python

But running either of the following tests causes a crash:
def test_bindings():
    import isce3.ext.isce3.core as m
    x = [0.0, 1.0, 2.0]
    y = [0.0, 1.0, 4.0]
    interp = m.interp1d(x, y)
    assert interp(1.5) == pytest.approx(2.25)

def test_big_kernel():
    kernel = m.KnabKernel(40, 0.83)
    z = np.random.randn(1024) + 1j * np.random.randn(1024)
    t = np.random.rand(1024) * 1024
    zt = m.interp1d(kernel, z, t)

Error
Fatal Python error: Aborted
Abort trap: 6

This occurs during test execution via pytest as well, and the traceback always points to the interp1d binding call.

Could this be an ABI or heap allocation issue specific to macOS ARM with pybind11? Would love your help verifying or suggesting a workaround — I’m happy to test any proposed patches.

DennyChee avatar Apr 22 '25 00:04 DennyChee