-
Notifications
You must be signed in to change notification settings - Fork 216
Add Device.arch property for convenient compute capability string access #877
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
Conversation
Co-authored-by: leofang <[email protected]>
Device.arch
that returns the CC value as a stringThere 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.
@copilot looking good! One nit: in all samples, could you just merge the dev.arch
access to the f-strings where arch is needed, instead of having a separate call?
Co-authored-by: leofang <[email protected]>
Done! I've updated all the example files to inline the |
@copilot looking good, please add a release note |
Co-authored-by: leofang <[email protected]>
/ok to test 7fc9d1b |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: kkraus14 <[email protected]>
/ok to test |
@kkraus14, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/1/ |
/ok to test 491fb89 |
|
…ess (#877) * Initial plan * Add Device.arch property and update examples to use it Co-authored-by: leofang <[email protected]> * Inline dev.arch calls in f-strings per PR feedback Co-authored-by: leofang <[email protected]> * Add release note for Device.arch property Co-authored-by: leofang <[email protected]> * Use f-string instead of "".join for Device.arch property Co-authored-by: kkraus14 <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: leofang <[email protected]> Co-authored-by: kkraus14 <[email protected]>
This PR adds a convenient
Device.arch
property that returns the compute capability as a concatenated string, eliminating the need for repetitive string concatenation code throughout the codebase.Problem
Previously, getting the compute capability as a string required this verbose pattern everywhere:
This pattern appeared in 8 locations across 7 example files and was identified as annoying repetitive code.
Solution
Added a new
arch
property to theDevice
class:Now the usage is much cleaner:
Changes
Device.arch
property incuda_core/cuda/core/experimental/_device.py
cuda_core/examples/vector_add.py
cuda_core/examples/simple_multi_gpu_example.py
(2 occurrences)cuda_core/examples/pytorch_example.py
cuda_core/examples/strided_memory_view_gpu.py
cuda_core/examples/saxpy.py
cuda_core/examples/cuda_graphs.py
cuda_core/examples/memory_ops.py
test_device.py
Benefits
Fixes #729.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.