MCPcopy Index your code
hub / github.com/pytorch/examples / verify_min_gpu_count

Function verify_min_gpu_count

distributed/FSDP2/example.py:10–14  ·  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

8from utils import inspect_mixed_precision, inspect_model
9
10def verify_min_gpu_count(min_gpus: int = 2) -> bool:
11 """ verification that we have at least 2 gpus to run dist examples """
12 has_gpu = torch.accelerator.is_available()
13 gpu_count = torch.accelerator.device_count()
14 return has_gpu and gpu_count >= min_gpus
15
16def set_modules_to_forward_prefetch(model, num_to_forward_prefetch):
17 for i, layer in enumerate(model.layers):

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected