-
Notifications
You must be signed in to change notification settings - Fork 42
[MNT] Drop NUMBA_CUDA_USE_NVIDIA_BINDING; always use cuda.core and cuda.bindings as fallback #479
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
Changes from 44 commits
dd8b461
137edeb
5388c11
76e85d1
025005a
0d53835
b4edda0
474a1a2
c1e11ce
3f0ceb3
f8076f5
6782a6f
dedfc5b
84ee39b
eae0303
adf5fc1
c2b20c6
62b8543
cd8a058
028ec59
8dc1292
d88aaa6
80ae4b2
871763e
90a1601
c736ba8
a4e77fd
babca28
cf97828
83f2807
c845b58
27a3110
1d56c03
2d7d302
0613c32
d690461
d93321e
49a7911
dbcbbaa
2b102ed
f8b4d8c
7f98a05
006f7c5
ee2c048
6d886d6
92b9be2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,65 +8,15 @@ | |
| import sys | ||
|
|
||
|
|
||
| # Enable pynvjitlink based on the following precedence: | ||
| # 1. Config setting "CUDA_ENABLE_PYNVJITLINK" (highest priority) | ||
| # 2. Environment variable "NUMBA_CUDA_ENABLE_PYNVJITLINK" | ||
| # 3. Auto-detection of pynvjitlink module (lowest priority) | ||
|
|
||
| pynvjitlink_auto_enabled = False | ||
|
|
||
| if getattr(config, "CUDA_ENABLE_PYNVJITLINK", None) is None: | ||
| if ( | ||
| _pynvjitlink_enabled_in_env := _readenv( | ||
| "NUMBA_CUDA_ENABLE_PYNVJITLINK", bool, None | ||
| ) | ||
| ) is not None: | ||
| config.CUDA_ENABLE_PYNVJITLINK = _pynvjitlink_enabled_in_env | ||
| else: | ||
| pynvjitlink_auto_enabled = ( | ||
| importlib.util.find_spec("pynvjitlink") is not None | ||
| ) | ||
| config.CUDA_ENABLE_PYNVJITLINK = pynvjitlink_auto_enabled | ||
|
|
||
| # Upstream numba sets CUDA_USE_NVIDIA_BINDING to 0 by default, so it always | ||
| # exists. Override, but not if explicitly set to 0 in the envioronment. | ||
| _nvidia_binding_enabled_in_env = _readenv( | ||
| "NUMBA_CUDA_USE_NVIDIA_BINDING", bool, None | ||
| ) | ||
| if _nvidia_binding_enabled_in_env is False: | ||
| USE_NV_BINDING = False | ||
| else: | ||
| USE_NV_BINDING = True | ||
| config.CUDA_USE_NVIDIA_BINDING = USE_NV_BINDING | ||
| if config.CUDA_USE_NVIDIA_BINDING: | ||
| if not ( | ||
| importlib.util.find_spec("cuda") | ||
| and importlib.util.find_spec("cuda.bindings") | ||
| ): | ||
| raise ImportError( | ||
| "CUDA bindings not found. Please pip install the " | ||
| "cuda-bindings package. Alternatively, install " | ||
| "numba-cuda[cuXY], where XY is the required CUDA " | ||
| "version, to install the binding automatically. " | ||
| "If no CUDA bindings are desired, set the env var " | ||
| "NUMBA_CUDA_USE_NVIDIA_BINDING=0 to enable ctypes " | ||
| "bindings." | ||
| ) | ||
|
|
||
| if config.CUDA_ENABLE_PYNVJITLINK: | ||
| if USE_NV_BINDING and not pynvjitlink_auto_enabled: | ||
| warnings.warn( | ||
| "Explicitly enabling pynvjitlink is no longer necessary. " | ||
| "NVIDIA bindings are enabled. cuda.core will be used " | ||
| "in place of pynvjitlink." | ||
| ) | ||
| elif pynvjitlink_auto_enabled: | ||
| # Ignore the fact that pynvjitlink is enabled, because that was an | ||
| # automatic decision based on discovering pynvjitlink was present; the | ||
| # user didn't ask for it | ||
| pass | ||
| else: | ||
| raise RuntimeError("nvJitLink requires the NVIDIA CUDA bindings. ") | ||
| # Require NVIDIA CUDA bindings at import time | ||
| if not ( | ||
| importlib.util.find_spec("cuda") | ||
| and importlib.util.find_spec("cuda.bindings") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be an impossible code path without actively trying to create a broken installation, so we can remove these checks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will change this in a follow-up. |
||
| ): | ||
| raise ImportError( | ||
| "NVIDIA CUDA Python bindings not found. Install the 'cuda' package " | ||
| "(e.g. pip install nvidia-cuda-python or numba-cuda[cuXY])." | ||
| ) | ||
|
|
||
| if config.ENABLE_CUDASIM: | ||
| from .simulator_init import * | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.