In a project of mine I’ve been investigating numba to speedup some scientific calculations. I was using @jit with parallel=True in nopython mode. The test suite for my package was working fine on my local computer (macOS) and in CI on mac and win, but was hanging in CI on Linux.
When I tried running the test suite locally in a docker container I found that the hang was coming from a test that investigates the use of the jitted function in a multiprocessing.Pool
context. In the main thread there is no problems with calculation, but in a Pool
the jitted function hangs. I managed to fix the hang by changing the numba.config.THREADING_LAYER = 'forksafe'
, previously numba was trying to use omp
.
The numba documentation states:
Due to compatibility issues with manylinux1 and other portability concerns, the OpenMP threading layer is disabled in the Numba binary wheels on PyPI.
I was installing numba via pip from PyPI, so why was the omp threading layer being used?