I am using distributed, a framework to allow parallel computation. In this, my primary use case is with NumPy. When I include NumPy code that relies on np.linalg
, I get an error with OMP_NUM_THREADS
, which is related to the OpenMP library.
An minimal example:
from distributed import Executor
import numpy as np
e = Executor('144.92.142.192:8786')
def f(x, m=200, n=1000):
A = np.random.randn(m, n)
x = np.random.randn(n)
# return np.fft.fft(x) # tested; no errors
# return np.random.randn(n) # tested; no errors
return A.dot(y).sum() # tested; throws error below
s = [e.submit(f, x) for x in [1, 2, 3, 4]]
s = e.gather(s)
When I test with the linalg test, e.gather
fails as each job throws the following error:
OMP: Error #34: System unable to allocate necessary resources for OMP thread:
OMP: System error #11: Resource temporarily unavailable
OMP: Hint: Try decreasing the value of OMP_NUM_THREADS.
What should I set OMP_NUM_THREADS
to?