-
Notifications
You must be signed in to change notification settings - Fork 15
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
Replacing vectorize brakes code #56
Comments
Hi @bencebecsy, this looks like a bug, I am investigating. |
I will try to restore that functionality, but using numba_stats in this way is not going to give you good performance. numba_stats is optimised for vectorised operation on arrays. Internally, it is now using arrays everywhere. So if you feed it a single number, it is converted into an array and then the implementation operates on that array. It is possible that the numba optimizer recognizes this special case and reduces the code again to a calculation on numbers, but I am not sure. In any case, to reap the performance benefits of numba_stats, you should process chunks of number at once and write your code in this way. |
Hi @HDembinski, thanks for looking into this. Thanks for the info on the best way to use numba_stats. To be honest, I got decent performance this way, and the main reason I used
Do you know if there's any way around this other than using numba_stats? |
No there is no other way, that's the raison d'etre for numba_stats. I will try to restore this functionality, but if you care about performance, you should organise your code to use arrays of values as the smallest unit instead of individual values. Otherwise you cannot use the powerful SIMD instructions of modern CPUs. |
I used
uniform
from a previous release, and it worked fine. Since the latest update that replacedvectorize
withjit
my code stopped working. Here is a minimal working example:This now gives the following error:
This seems to only happen if it's within a jitted function. If I remove
@njit()
from above, it works fine. I'm atnumba 0.53.0
.Any idea why this might be happening?
The text was updated successfully, but these errors were encountered: