Pytorch-Memory-Utils icon indicating copy to clipboard operation
Pytorch-Memory-Utils copied to clipboard

Is the value different from the nvidia-smi?

Open SCAUapc opened this issue 2 years ago • 3 comments

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?

SCAUapc avatar Aug 10 '22 03:08 SCAUapc

I found that Nvidia-smi use MiB,and your tool use Mb, maybe there is some different? I go to check

SCAUapc avatar Aug 10 '22 03:08 SCAUapc

@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.

hzhwcmhf avatar Aug 10 '22 04:08 hzhwcmhf

Thanks!

SCAUapc avatar Aug 10 '22 05:08 SCAUapc