-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support nogil=True for ufuncs and gufuncs #1317
Comments
I'm able to use all 4 cores with the following example. Numba is using numpy ufunc machinery, which is releasing the GIL. Note that it may need to warm up because the function is compiled on the first call. from numba import vectorize
import numpy as np
@vectorize
def f(a, b):
return np.sqrt(a) + np.cos(b) * np.sin(b) - a
nelem = 10**8
a = np.arange(nelem)
z = f(a, a)
print(z)
from concurrent.futures import ThreadPoolExecutor, as_completed
numthreads = 4
pool= ThreadPoolExecutor(numthreads)
futures = [pool.submit(f, a, a) for i in range(numthreads)]
for z in as_completed(futures):
print(z) |
In this case, should we make |
I'm pleased to see this already exists! I agree, a warning if |
Adding a warning for |
The enhancement task is: #1317 (comment) |
is this task still available? I am a newcomer here and I would love to get my feet wet(with some guidance). Thanks. |
In |
Yes! Thanks for taking it on. |
That looks like a good place as it'll also catch the use in |
Lovely. Another question: After printing the warning, do you think |
This would be extremely useful for integrating numba ufuncs with dask.array.
The text was updated successfully, but these errors were encountered: