-
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
0.57.0rc1 NumbaDeprecationWarning: @guvectorize
even with nopython
keyword argument
#8903
Comments
Hi @oyamad, thanks for the report. I can confirm this "bug" in Numba. In the snippet of code below, the call to numba/numba/np/ufunc/ufuncbuilder.py Line 328 in be990a8
Numba doesn't report the warning on vectorize because of the numba/numba/np/ufunc/ufuncbuilder.py Lines 263 to 265 in be990a8
Let me know if you'd like to send a patch fixing this issue. |
Hi @oyamad, really appreciate you putting some effort towards fixing this issue. We discuss this topic at today's Numba meeting and we have decided that it would be best to suppress the |
@guilhermeleobas Sure, so, in the description in https://numba.readthedocs.io/en/stable/reference/jit-compilation.html#numba.guvectorize, the keyword arguments |
…ze`. This adds localised suppressions for `NumbaDeprecationWarning`s that would have been raised from the code path for `@{gu,}vectorize` due to Numba's internal use of `@jit()` with the `nopython` kwarg not present. This is considered acceptable due to the following: Deprecation warnings from Numba's internal use of its own API should not be visible to users. Unfortunately there's no trivial programmatic way to work around the internal use of `@jit`-with-no-kwargs in this case as numerous code paths go through the same operations and user code may well be relying on "object mode" fall-back. What this patch does it makes it so that users will not see `NumbaDeprecationWarning`s for this internal use. However, if a user defines a `@{gu,}vectorize` function that ends up using the fall-back to the object mode pipeline during compilation, Numba will continue to raise numerous loud warnings about this happening which should provide a hint as to the problem and how to fix it. Numerous tests have been added to check combinations of kwargs/use of default kwargs being passed through to `@{gu,}vectorize`. These tests make sure that there are no additional `NumbaDeprecationWarning`s raised to do with Numba's internal use of `@jit()` in `@{gu,}vectorize` where the `nopython` kwarg is not supplied. Closes numba#8903
Fix #8903. `NumbaDeprecationWarning`s raised from `@{gu,}vectorize`.
Fix numba#8903. `NumbaDeprecationWarning`s raised from `@{gu,}vectorize`.
The following code (note the
nopython=True
argument)raises
NumbaDeprecationWarning
:/Applications/anaconda3/envs/py311/lib/python3.11/site-packages/numba/np/ufunc/ufuncbuilder.py:328: NumbaDeprecationWarning: The 'nopython' keyword argument was not supplied to the 'numba.jit' decorator. The implicit default value for this argument is currently False, but it will be changed to True in Numba 0.59.0. See https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit for details. self.nb_func = jit(_target='npyufunc', cache=cache)(py_func)
This does not occur with
@vectorize
:The text was updated successfully, but these errors were encountered: