Use cuda.bindings and cuda.core for Linker#133
Conversation
|
Thanks, @brandon-b-miller. Remember our goal is to drop every Linker subclasses inside Numba, in favor of |
cuda.bindings and cuda.core for nvjitlinkcuda.bindings and cuda.core for Linker
|
/ok to test |
|
@gmarkall @leofang numba-cuda contains nvjitlink tests, should we maintain support for these as part of this PR or drop them in favor of testing in upstream |
I think we need to maintain the tests that test Numba-CUDA's interaction with the linker, like the |
|
Also, I think we can probably delete the I'm comfortable with:
which is what this PR seems to offer. (correct me if I've read it wrong 🙂) |
Correct, this is the outcome I am aiming for. |
|
@gmarkall on second thought, we might need to leave the MVCLinker in in some capacity as long as we're supporting cuda 11. I don't think that |
|
@brandon-b-miller Sorry, yes - I had that in mind but didn't write it down. |
Ok, just to have it written down somewhere, after this PR we will: For cuda 11, maintain the current way of configuring which bindings to use:
for cuda 12, we will have:
This will leave us with 3 linkers:
|
|
Thanks for the summary! To look a little further ahead, we want to end up with only one linker, which is the new linker. This would be achieved by deprecating / removing the other linkers as soon as appropriate:
Are you in alignment with the above plan @brandon-b-miller ? |
Yup this sounds good to me. |
|
/ok to test 85f8710 |
|
/ok to test 547dab5 |
|
/ok to test 3bd469d |
|
/ok to test ba5c20a |
|
/ok to test 134f6ee |
|
I thought the code changes looked good but I'm hitting an error disabling the NVIDIA binding locally now with this PR. For example: Just looking into why this is and why it doesn't seem to occur on the ctypes binding test in CI. |
| "in place of pynvjitlink." | ||
| ) | ||
| else: | ||
| raise RuntimeError("nvJitLink requires the NVIDIA CUDA bindings. ") |
There was a problem hiding this comment.
Because config.CUDA_ENABLE_PYNVJITLINK is enabled automatically if it's found in the environment, disabling the NVIDIA bindings if pynvjitlink is installed now leads to this exception being hit.
gmarkall
left a comment
There was a problem hiding this comment.
I think we can solve the issue of it not being possible to disable the NVIDIA bindings if pynvjitlink is installed by keeping track of whether it was enabled automatically, and just ignoring it if it was, like:
diff --git a/numba_cuda/numba/cuda/__init__.py b/numba_cuda/numba/cuda/__init__.py
index 430b3b7..e944fe0 100644
--- a/numba_cuda/numba/cuda/__init__.py
+++ b/numba_cuda/numba/cuda/__init__.py
@@ -9,6 +9,9 @@ import warnings
# 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(
@@ -17,9 +20,10 @@ if getattr(config, "CUDA_ENABLE_PYNVJITLINK", None) is None:
) is not None:
config.CUDA_ENABLE_PYNVJITLINK = _pynvjitlink_enabled_in_env
else:
- config.CUDA_ENABLE_PYNVJITLINK = (
+ 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.
@@ -53,6 +57,11 @@ if config.CUDA_ENABLE_PYNVJITLINK:
"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. ")
Does this seem like a workable solution? (It allows me to disable the NVIDIA binding for testing locally)
|
I need to catch with the progress here, but are we still keeping both cuda.core.Linker and pynvjiink? |
No, |
|
/ok to test 99c87f3 |
- Updates for recent API changes (NVIDIA#313) - Fix lineinfo generation when compile_internal used (NVIDIA#271) (NVIDIA#287) - Build docs with NVIDIA Sphinx theme (NVIDIA#312) - Don't skip debug tests when LTO enabled by default (NVIDIA#311) - Use `cuda.bindings` and `cuda.core` for `Linker` (NVIDIA#133) - Enable LTO by default when pynvjitlink is available (NVIDIA#310)
- Updates for recent API changes (#313) - Fix lineinfo generation when compile_internal used (#271) (#287) - Build docs with NVIDIA Sphinx theme (#312) - Don't skip debug tests when LTO enabled by default (#311) - Use `cuda.bindings` and `cuda.core` for `Linker` (#133) - Enable LTO by default when pynvjitlink is available (#310)
WIP
xref #129