()
| 225 | |
| 226 | |
| 227 | def get_platform_name(): |
| 228 | if OS_NAME == "Darwin": |
| 229 | return "metal" |
| 230 | |
| 231 | # use torchruntime to determine if nvidia gpu is present |
| 232 | from torchruntime.device_db import get_gpus |
| 233 | from torchruntime.platform_detection import get_torch_platform |
| 234 | |
| 235 | gpus = get_gpus() |
| 236 | torch_platform = get_torch_platform(gpus) |
| 237 | |
| 238 | if torch_platform == "cpu": |
| 239 | return "cpu" |
| 240 | |
| 241 | if torch_platform.startswith("cu"): |
| 242 | return "cuda" |
| 243 | |
| 244 | return "vulkan" |
| 245 | |
| 246 | |
| 247 | def get_variant_name(platform_name): |