updates
This commit is contained in:
parent
ab51380448
commit
a773350224
|
@ -27,13 +27,12 @@ def select_device(force_cpu=False):
|
||||||
ng = torch.cuda.device_count()
|
ng = torch.cuda.device_count()
|
||||||
x = [torch.cuda.get_device_properties(i) for i in range(ng)]
|
x = [torch.cuda.get_device_properties(i) for i in range(ng)]
|
||||||
cuda_str = 'Using CUDA ' + apex_str
|
cuda_str = 'Using CUDA ' + apex_str
|
||||||
print("%sdevice0 _CudaDeviceProperties(name='%s', total_memory=%dMB)" %
|
for i in range(0, ng):
|
||||||
(cuda_str, x[0].name, x[0].total_memory / c))
|
if ng == 1:
|
||||||
if ng > 0:
|
|
||||||
# torch.cuda.set_device(0) # OPTIONAL: Set GPU ID
|
# torch.cuda.set_device(0) # OPTIONAL: Set GPU ID
|
||||||
for i in range(1, ng):
|
cuda_str = ' ' * len(cuda_str)
|
||||||
print("%sdevice%g _CudaDeviceProperties(name='%s', total_memory=%dMB)" %
|
print("%sdevice%g _CudaDeviceProperties(name='%s', total_memory=%dMB)" %
|
||||||
(' ' * len(cuda_str), i, x[i].name, x[i].total_memory / c))
|
(cuda_str, i, x[i].name, x[i].total_memory / c))
|
||||||
|
|
||||||
print('') # skip a line
|
print('') # skip a line
|
||||||
return device
|
return device
|
||||||
|
|
Loading…
Reference in New Issue