Skip to content

Commit 99c87f3

Browse files
track pynvjitlink env discovery
1 parent 134f6ee commit 99c87f3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

numba_cuda/numba/cuda/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
# 1. Config setting "CUDA_ENABLE_PYNVJITLINK" (highest priority)
1010
# 2. Environment variable "NUMBA_CUDA_ENABLE_PYNVJITLINK"
1111
# 3. Auto-detection of pynvjitlink module (lowest priority)
12+
13+
pynvjitlink_auto_enabled = False
14+
1215
if getattr(config, "CUDA_ENABLE_PYNVJITLINK", None) is None:
1316
if (
1417
_pynvjitlink_enabled_in_env := _readenv(
@@ -17,9 +20,10 @@
1720
) is not None:
1821
config.CUDA_ENABLE_PYNVJITLINK = _pynvjitlink_enabled_in_env
1922
else:
20-
config.CUDA_ENABLE_PYNVJITLINK = (
23+
pynvjitlink_auto_enabled = (
2124
importlib.util.find_spec("pynvjitlink") is not None
2225
)
26+
config.CUDA_ENABLE_PYNVJITLINK = pynvjitlink_auto_enabled
2327

2428
# Upstream numba sets CUDA_USE_NVIDIA_BINDING to 0 by default, so it always
2529
# exists. Override, but not if explicitly set to 0 in the envioronment.
@@ -53,6 +57,11 @@
5357
"NVIDIA bindings are enabled. cuda.core will be used "
5458
"in place of pynvjitlink."
5559
)
60+
elif pynvjitlink_auto_enabled:
61+
# Ignore the fact that pynvjitlink is enabled, because that was an
62+
# automatic decision based on discovering pynvjitlink was present; the
63+
# user didn't ask for it
64+
pass
5665
else:
5766
raise RuntimeError("nvJitLink requires the NVIDIA CUDA bindings. ")
5867

0 commit comments

Comments
 (0)