MCPcopy Create free account
hub / github.com/NVIDIA/DALI / num_available_gpus

Function num_available_gpus

dali/test/python/test_utils_tensorflow.py:40–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38
39
40def num_available_gpus():
41 local_devices = device_lib.list_local_devices()
42 num_gpus = sum(1 for device in local_devices if device.device_type == "GPU")
43 if not math.log2(num_gpus).is_integer():
44 raise RuntimeError("Unsupported number of GPUs. This test can run on: 2^n GPUs.")
45 return num_gpus
46
47
48def available_gpus():

Calls 2

sumClass · 0.85
log2Method · 0.80

Tested by

no test coverage detected