You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
💡 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.
CopilotAI
changed the title
[WIP] Add a convenient shortcut Device.arch that returns the CC value as a string
Add Device.arch property for convenient compute capability string access
Aug 21, 2025
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?
@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?
Done! I've updated all the example files to inline the dev.arch calls directly into the f-strings instead of having separate variable assignments. This makes the code more concise as requested. Changes made in commit c940eca.
Added release note for the new Device.arch property in the "New features" section. The note documents the property and its convenience benefit. (7fc9d1b)
Preview removed because the pull request was closed or merged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cuda.coreEverything related to the cuda.core modulefeatureNew feature or requestP1Medium priority - Should do
4 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a convenient
Device.archproperty 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
archproperty to theDeviceclass:Now the usage is much cleaner:
Changes
Device.archproperty incuda_core/cuda/core/experimental/_device.pycuda_core/examples/vector_add.pycuda_core/examples/simple_multi_gpu_example.py(2 occurrences)cuda_core/examples/pytorch_example.pycuda_core/examples/strided_memory_view_gpu.pycuda_core/examples/saxpy.pycuda_core/examples/cuda_graphs.pycuda_core/examples/memory_ops.pytest_device.pyBenefits
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.