-
Notifications
You must be signed in to change notification settings - Fork 212
Add _get_cuda_version_from_cuda_h()
in cuda_core/build_hooks.py
#1085
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
base: main
Are you sure you want to change the base?
Add _get_cuda_version_from_cuda_h()
in cuda_core/build_hooks.py
#1085
Conversation
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
/ok to test |
Local testing with a venv that does not have cuda-bindings:
|
|
…, _get_cuda_driver_version_linux()
Calling nvidia-smi is better because it does exactly the same thing under the hood (opening up libcuda/nvcuda and getting the driver version), but it is cross-platform and so takes much less lines of code, and it is a good habit to keep the code surface in |
The main reason I was leaning into it is that I think it'd be a useful addition to pathfinder. It's more lines of code only because Assume that the code I added lives in pathfinder, you'd just reuse that and have a more secure, more robust, and faster (which doesn't matter here, but is useful in general) solution with even less lines of code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main reason I was leaning into it is that I think it'd be a useful addition to pathfinder.
Why would the pathfinder need to expose the driver version check as a public API? Or you only had the driver loading part in mind?
try: | ||
# WinDLL => stdcall (CUDAAPI on Windows), matches CUDA Driver API. | ||
lib = ctypes.WinDLL("nvcuda.dll") | ||
except OSError: | ||
return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This snippet is all we need for Windows and the rest can go. This way we just need one function to encapsulate driver version fetching in a cross-platform fashion. The platform check can happen inside the callee, not the caller.
It'd be useful in general, not just here. It's just a few lines of Python code that is very similar to other functionality in pathfinder, and does not introduce any new dependencies. Having the function there, would make what's needed here a no-brainer. |
WIP — Will work on it more asap.