Skip to content

Commit aa393ec

Browse files
committed
add gpu_memory_usage
1 parent 7cf31b6 commit aa393ec

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

nvdocker/nvdocker.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,11 @@ def gpu_info():
176176

177177
@staticmethod
178178
def gpu_memory_usage(id):
179-
gpus = NVDockerClient.get_gpus()
179+
gpus = NVDockerClient.gpu_info()
180180
if id not in gpus.keys():
181181
return None
182-
return gpus[id]
182+
gpu_handle = gpus[id]["gpu_handle"]
183+
return nvmlDeviceGetMemoryInfo(gpu_handle)
183184

184185
@staticmethod
185186
def least_used_gpu():

0 commit comments

Comments
 (0)