MCPcopy Create free account
hub / github.com/pytorch/examples / verify_min_gpu_count

Function verify_min_gpu_count

distributed/tensor_parallelism/log_utils.py:18–22  ·  view source on GitHub ↗

verification that we have at least 2 gpus to run dist examples

(min_gpus: int = 2)

Source from the content-addressed store, hash-verified

16
17
18def verify_min_gpu_count(min_gpus: int = 2) -> bool:
19 """ verification that we have at least 2 gpus to run dist examples """
20 has_gpu = torch.accelerator.is_available()
21 gpu_count = torch.accelerator.device_count()
22 return has_gpu and gpu_count >= min_gpus

Calls

no outgoing calls

Tested by

no test coverage detected