Skip to content
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

Surveying explicit uses of nopython=False #9247

Closed
sklam opened this issue Oct 17, 2023 · 6 comments
Closed

Surveying explicit uses of nopython=False #9247

sklam opened this issue Oct 17, 2023 · 6 comments
Labels
discussion An issue requiring discussion
Milestone

Comments

@sklam
Copy link
Member

sklam commented Oct 17, 2023

Numba plans to remove objectmode fallback in the 0.59 release. With the change, nopython=False will have no effect. We are surveying user code that uses nopython=False instead of using forceobj=True. Perhaps it is due to bugs in Numba that prevent users from using nopython=True or a miscommunication from our deprecation notices. Either way, we need to understand why.

Related issues:

@sklam sklam added this to the 0.59.0-rc1 milestone Oct 17, 2023
@sklam sklam added the discussion An issue requiring discussion label Oct 17, 2023
sklam referenced this issue in lmcinnes/umap Oct 17, 2023
sklam referenced this issue in BiomedicalMachineLearning/stLearn Oct 17, 2023
sklam referenced this issue in sparks-baird/dist-matrix Oct 17, 2023
e.g.,

```
../../../../../opt/hostedtoolcache/Python/3.8.17/x64/lib/python3.8/site-packages/dist_matrix/utils/cpu_helper.py:99
  /opt/hostedtoolcache/Python/3.8.17/x64/lib/python3.8/site-packages/dist_matrix/utils/cpu_helper.py:99: 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.
```
@crhea93
Copy link

crhea93 commented Oct 17, 2023

Thank you for doing this! I opted to use the nopython=False argument because it seemed like this was the best (if not only) option from the documentation.

@sklam
Copy link
Member Author

sklam commented Oct 18, 2023

@crhea93
Ok, so our documentation has made this confusing. The choices should be:

  • use nopython=True for maximum performance. If that causes any error, let us know.
  • use forceobj=True if the function contains non-support feature, but has loops that are can potentially benefit from Numba.

@lmcinnes
Copy link

My use acse was old code that should probably be refactored to use the python object mode contexts, or simply forceobj=True. Is there any reason to have preferences either way?

@sklam
Copy link
Member Author

sklam commented Oct 23, 2023

@lmcinnes,

forceobj=True means object-mode by default but try to lift loops for nopython compilation.

objectmode context will mean nopython by default but manually opt into object mode in particular area (only inside the with-context)

@sgbaird
Copy link
Contributor

sgbaird commented Nov 10, 2023

I think my use of nopython=False was to try to shore against backwards incompatibility. Unfortunately, I'm not much help because it's been long enough I don't remember why I chose to use it 😅 I don't think it will be problematic for me either way. The main reason for using that repository is to speed up distance calculations, including enabling distance matrix calculations on a GPU; otherwise someone should probably just use scipy or similar for computing distances.

@sklam
Copy link
Member Author

sklam commented Dec 13, 2023

#9352 has removed object mode fallback

@sklam sklam closed this as completed Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion An issue requiring discussion
Projects
None yet
Development

No branches or pull requests

4 participants