Skip to content

Conversation

@mdboom
Copy link
Contributor

@mdboom mdboom commented Sep 15, 2025

Description

closes #962

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Sep 15, 2025

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@mdboom
Copy link
Contributor Author

mdboom commented Sep 15, 2025

/ok to test

cdef void* handle = NULL

with gil, __symbol_lock:
driver_ver = get_cuda_version()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is being used below and causing at least some of the compilation failures. Does loading the library actually require computing the version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it doesn't actually require it. Just need to change what's generated...

@mdboom
Copy link
Contributor Author

mdboom commented Sep 15, 2025

/ok to test

@leofang leofang added bug Something isn't working cuda.bindings Everything related to the cuda.bindings module P1 Medium priority - Should do labels Sep 15, 2025
@leofang leofang added this to the cuda-python 13-next, 12-next milestone Sep 15, 2025
@github-actions

This comment has been minimized.

@mdboom
Copy link
Contributor Author

mdboom commented Sep 15, 2025

/ok to test

Copy link
Collaborator

@rwgk rwgk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup!

Is there an easy/obvious way to specify libcuda_so = 'libcuda.so.1' in one central place? cuda/bindings/_internal/utils.pyx maybe? Maybe even better, move the entire get_cuda_version() function there? — We could also do that later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ralf's comment made me realize... we should also remove get_cuda_version in this file, because it is no longer needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah... I see now why this is challenging: get_cuda_version is a copy-pasta from the extern pxd. It does not seem that we can remove this locally (i.e. without affecting other teams). I'll let Mike make the final call, I run out of good ideas tonight 🙁

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(One silly idea is to split the extern pxd into two, one is always copied/pasted, the other is pasted after the first one only when need_driver is true.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, get_cuda_version is inserted by the binding generator into every set of bindings. I don't see much need to deal with that, though. It's a static function that the compiler removes if not needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@mdboom
Copy link
Contributor Author

mdboom commented Sep 16, 2025

Nice cleanup!

Is there an easy/obvious way to specify libcuda_so = 'libcuda.so.1' in one central place? cuda/bindings/_internal/utils.pyx maybe? Maybe even better, move the entire get_cuda_version() function there? — We could also do that later.

get_cuda_version is needed by other cybind-generated projects, that may not rely on cuda_bindings.

@mdboom mdboom merged commit 9922034 into NVIDIA:main Sep 16, 2025
49 checks passed
@github-actions
Copy link

Doc Preview CI
Preview removed because the pull request was closed or merged.

mdboom added a commit to mdboom/cuda-python that referenced this pull request Sep 19, 2025
leofang pushed a commit that referenced this pull request Sep 19, 2025
@cpcloud cpcloud mentioned this pull request Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cuda.bindings Everything related to the cuda.bindings module P1 Medium priority - Should do

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid unnecessarily loading and checking driver version

4 participants