nvtop icon indicating copy to clipboard operation
nvtop copied to clipboard

The memory usage displayed by `nvtop` is different from that of `nvidia-smi`

Open Kelvinlby opened this issue 1 year ago • 5 comments

I noticed that on my platform (Ubuntu 24.04, RTX3060), when it comes to VRAM utilization, nvtop gives a different number to nvidia-smi Screenshot from 2024-10-19 14-22-13 Screenshot from 2024-10-19 14-22-16

Kelvinlby avatar Oct 19 '24 06:10 Kelvinlby

I noticed this when I was writing a C program which needs to get VRAM usage of Nvidia GPUs. I used the following code and get the same result as what nvidia-smi shows. However, I'm not sure whether it takes all VRAM utilization into account and which program (nvtop/nvidia-smi) shows the real utilization.

By the way, in most cases nvtop shows larger VRAM utilization than nvidia-smi.

UINT32 nvidiaUsedVram(void) {
    size_t freeMemory, totalMemory;
    cudaMemGetInfo(&freeMemory, &totalMemory);
    return (totalMemory - freeMemory) / (1024 * 1024);
}

Kelvinlby avatar Oct 19 '24 06:10 Kelvinlby

I face the same problem. After my os upgraded to 24.04, the dispaly of nvtop is no longer correct even I update the nvtop to 3.0.2-1.

canytam-krystal avatar Oct 25 '24 09:10 canytam-krystal

Hard to say which one is closer to what we can expect as "allocated memory". Nvtop uses the result of nvmlDeviceGetMemoryInfo_v2 coming directly from the driver!

The value nvtop displays is the used memory: Allocated device memory (in bytes). Perhaps nvidia-smi subtracts the reserved memory? I'm not sure.

Syllo avatar Nov 03 '24 13:11 Syllo

Hard to say which one is closer to what we can expect as "allocated memory". Nvtop uses the result of nvmlDeviceGetMemoryInfo_v2 coming directly from the driver!

The value nvtop displays is the used memory: Allocated device memory (in bytes). Perhaps nvidia-smi subtracts the reserved memory? I'm not sure.

Not sure either, since both methods are offered by nvidia.

Kelvinlby avatar Nov 04 '24 04:11 Kelvinlby

I have been having the same issue recently on Arch, where nvidia-smi reports 0 but nvtop stubbornly says the machine's using "0.375Gi/7.996Gi" while idle.

nvtop: version 3.2.0 nvidia drivers: Driver Version: 580.76.05 & CUDA Version: 13.0 GPU: NVIDIA GeForce RTX 4060 Mobile GPU

matezoltanfarkas avatar Aug 26 '25 17:08 matezoltanfarkas