MCPcopy
hub / github.com/lightningpixel/modly / _detect_gpu_sm

Function _detect_gpu_sm

api/routers/extensions.py:76–85  ·  view source on GitHub ↗

Returns GPU compute capability as integer (e.g. 86 for SM 8.6), or 0 if no GPU.

()

Source from the content-addressed store, hash-verified

74
75
76def _detect_gpu_sm() -> int:
77 """Returns GPU compute capability as integer (e.g. 86 for SM 8.6), or 0 if no GPU."""
78 try:
79 import torch
80 if torch.cuda.is_available():
81 major, minor = torch.cuda.get_device_capability(0)
82 return major * 10 + minor
83 except Exception:
84 pass
85 return 0

Callers 1

setup_extensionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected