You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test failures in parallel thin_plate_spline tests #8212
This appears to be due to variability in the output from Scipy, when running in parallel threads.
Below is Cursor's analysis:
What the failure actually shows
• Only fails on Python 3.14 free-threaded with pytest-run-parallel --parallel-threads=4
• Passes on local 3.12
• In the failing test, from_estimate + warp succeeds, then estimate + warp fails
• Both paths call the same _estimate implementation:
# from_estimate
tf = cls()
tf._estimate(src, dst)
# estimate (deprecated)
return self._estimate(src, dst) is None
Locally, those produce identical _spline_mappings and identical warp output.
So this doesn't look like a logic bug in “estimation vs from_estimate.” It looks like
environment- or timing-sensitive behavior on 3.14t under parallel test execution.
We should double check which code path is followed: if this uses our internal warping code, the fault is in skimage, otherwise in scipy.ndimage's map_coordinates. It would make slightly more sense for the error to be in the latter, but I'd have to check.
Asked Claude to investigate, and it seems to say that even np.dot is not thread-safe. Is that possible?!
So the actual root cause is OpenBLAS's internal thread pool not being safe when the same shared
ThinPlateSplineTransform instance's np.dot(coords, a[1:]) / np.dot(radial_dist, w) are issued
concurrently from multiple application threads (this numpy build uses scipy-openblas64 0.3.31 with
pthreads threading, DYNAMIC_ARCH). This reproduces even on a normal GIL-enabled CPython — it's not
specific to free-threaded 3.14, it's a long-standing OpenBLAS multi-threading hazard that
pytest-run-parallel's concurrent test execution happens to trigger.
Activity
stefanv commentedon Jun 12, 2026
Looks like SciPy's pre-filtering is not thread-safe. For now, I disabled in the test suite to run in parallel.
stefanv commentedon Jun 12, 2026
We should double check which code path is followed: if this uses our internal warping code, the fault is in skimage, otherwise in
scipy.ndimage'smap_coordinates. It would make slightly more sense for the error to be in the latter, but I'd have to check.stefanv commentedon Jun 12, 2026
Looks like we do go via the ndimage path.
Asked Claude to investigate, and it seems to say that even
np.dotis not thread-safe. Is that possible?!@ngoldbaum would probably know this off-hand.
ngoldbaum commentedon Jun 13, 2026
This is an OpenBLAS bug I think, see numpy/numpy#31618 and OpenMathLib/OpenBLAS#5836
kumaraditya303 commentedon Jul 24, 2026
I think this is fixed now with OpenMathLib/OpenBLAS#5876
Pin BLAS threads in the free-threaded parallel test run