Return the SM version of the current GPU (e.g. 90, 100), or 0 if unavailable.
()
| 20 | |
| 21 | |
| 22 | def _gpu_sm_version() -> int: |
| 23 | """Return the SM version of the current GPU (e.g. 90, 100), or 0 if unavailable.""" |
| 24 | try: |
| 25 | import torch |
| 26 | |
| 27 | if not torch.cuda.is_available(): |
| 28 | return 0 |
| 29 | major, minor = torch.cuda.get_device_capability() |
| 30 | return major * 10 + minor |
| 31 | except ImportError: |
| 32 | return 0 |
| 33 | |
| 34 | |
| 35 | requires_sm100 = pytest.mark.skipif( |
no outgoing calls
no test coverage detected