verification that we have at least 2 gpus to run dist examples
(min_gpus: int = 2)
| 12 | from torch.nn.parallel import DistributedDataParallel as DDP |
| 13 | |
| 14 | def verify_min_gpu_count(min_gpus: int = 2) -> bool: |
| 15 | """ verification that we have at least 2 gpus to run dist examples """ |
| 16 | has_gpu = torch.accelerator.is_available() |
| 17 | gpu_count = torch.accelerator.device_count() |
| 18 | return has_gpu and gpu_count >= min_gpus |
| 19 | |
| 20 | class ToyModel(nn.Module): |
| 21 | def __init__(self): |