File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
cuda_core/cuda/core/experimental Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -1029,13 +1029,11 @@ def properties(self) -> DeviceProperties:
10291029 @property
10301030 def compute_capability (self ) -> ComputeCapability :
10311031 """Return a named tuple with 2 fields: major and minor."""
1032- major = handle_return (
1033- runtime .cudaDeviceGetAttribute (runtime .cudaDeviceAttr .cudaDevAttrComputeCapabilityMajor , self ._id )
1034- )
1035- minor = handle_return (
1036- runtime .cudaDeviceGetAttribute (runtime .cudaDeviceAttr .cudaDevAttrComputeCapabilityMinor , self ._id )
1037- )
1038- return ComputeCapability (major , minor )
1032+ if "compute_capability" in self .properties ._cache :
1033+ return self .properties ._cache ["compute_capability" ]
1034+ cc = ComputeCapability (self .properties .compute_capability_major , self .properties .compute_capability_minor )
1035+ self .properties ._cache ["compute_capability" ] = cc
1036+ return cc
10391037
10401038 @property
10411039 @precondition (_check_context_initialized )
You can’t perform that action at this time.
0 commit comments