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

Function change_gpu

tensorpack/utils/gpu.py:15–26  ·  view source on GitHub ↗

Args: val: an integer, the index of the GPU or -1 to disable GPU. Returns: a context where ``CUDA_VISIBLE_DEVICES=val``.

(val)

Source from the content-addressed store, hash-verified

13
14
15def change_gpu(val):
16 """
17 Args:
18 val: an integer, the index of the GPU or -1 to disable GPU.
19
20 Returns:
21 a context where ``CUDA_VISIBLE_DEVICES=val``.
22 """
23 val = str(val)
24 if val == '-1':
25 val = ''
26 return change_env('CUDA_VISIBLE_DEVICES', val)
27
28
29def get_num_gpu():

Callers 3

steering-filter.pyFile · 0.90
__init__Method · 0.85

Calls 1

change_envFunction · 0.85

Tested by

no test coverage detected