MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / _guess_devices

Method _guess_devices

tensorpack/callbacks/prof.py:46–58  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

44 self._enabled = True
45
46 def _guess_devices(self):
47 env = os.environ.get('CUDA_VISIBLE_DEVICES')
48 if env is None:
49 devices = list(range(get_num_gpu()))
50 if len(devices) > 1:
51 logger.warn("[GPUUtilizationTracker] Both devices and CUDA_VISIBLE_DEVICES are None! "
52 "Will monitor all {} visible GPUs!".format(len(devices)))
53 else:
54 if len(env):
55 devices = list(map(int, env.split(',')))
56 else:
57 devices = []
58 return devices
59
60 def _setup_graph(self):
61 # special heuristics for Horovod

Callers 1

_setup_graphMethod · 0.95

Calls 3

get_num_gpuFunction · 0.85
formatMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected