-
Notifications
You must be signed in to change notification settings - Fork 240
cuda.core.system: add conveniences to convert between device types #1508
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?
Conversation
|
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. |
922270e to
23aefa3
Compare
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.
Pull request overview
This PR adds convenience methods to convert between cuda.core.Device (CUDA API) and cuda.core.system.Device (NVML API), enabling easier interoperability between the two device types.
Changes:
- Added
to_system_device()method tocuda.core.Devicefor converting to NVML device representation - Added
to_cuda_device()method tocuda.core.system.Devicefor converting to CUDA device representation - Added comprehensive tests for both conversion methods
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cuda_core/cuda/core/_device.pyx | Implements to_system_device() method for converting CUDA Device to system Device using UUID mapping |
| cuda_core/cuda/core/system/_device.pyx | Implements to_cuda_device() method for converting system Device to CUDA Device by searching all devices for matching UUID |
| cuda_core/tests/test_device.py | Adds test for to_system_device() conversion, verifying UUID and PCI bus ID mapping |
| cuda_core/tests/system/test_system_device.py | Adds test for to_cuda_device() conversion across all devices, verifying UUID and PCI bus ID mapping |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
/ok to test |
|
|
/ok to test |
This adds two convenience methods to convert between
cuda.core.Deviceandcuda.core.system.Device.I have a few design questions for this one:
Device.to_system_deviceandDevice.to_cuda_deviceok?cuda.core.Device(nvml_device), but that requires importing the other module from the constructor which could be a performance / cyclical import nightmare.