Pytorch-Memory-Utils
Pytorch-Memory-Utils copied to clipboard
Is the value different from the nvidia-smi?
Hi , I use the following to track my gpu utility
from gpu_mem_track import MemTracker
gpu_tracker = MemTracker() gpu_tracker.track() model = Model() model.to("cuda:0") gpu_tracker.track()
the tracker tell me the total use gpu is 109Mb
But I use nvidia-smi, I found that this process use 499MB.
Will there be different?
I found that Nvidia-smi use MiB,and your tool use Mb, maybe there is some different? I go to check
@SCAUapc We use pytorch API to obtain the memory use. You can see the explanation of torch.cuda.memory_allocated
here
This is likely less than the amount shown in nvidia-smi since some unused memory can be held by the caching allocator and some context needs to be created on GPU. See Memory management for more details about GPU memory management.
Thanks!