MCPcopy Index your code
hub / github.com/tensorlayer/TensorLayer / _get_gpu_ids

Function _get_gpu_ids

tensorlayer/cli/train.py:83–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

81
82
83def _get_gpu_ids():
84 if 'CUDA_VISIBLE_DEVICES' in os.environ:
85 return [int(x) for x in os.environ.get('CUDA_VISIBLE_DEVICES', '').split(',')]
86 if platform.system() in ['Darwin', 'Linux']:
87 return [int(d.replace('nvidia', '')) for d in os.listdir('/dev') if re.match('^nvidia\d+$', d)]
88 else:
89 print('Please set CUDA_VISIBLE_DEVICES (see http://acceleware.com/blog/cudavisibledevices-masking-gpus)')
90 return []
91
92
93GPU_IDS = _get_gpu_ids()

Callers 1

train.pyFile · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…