Get Memory Usage of Nvidia GPU using nvidia-smi

Get Memory Usage of Nvidia GPU using nvidia-smi

Understanding the memory usage of the graphics card is crucial. Monitoring GPU memory usage helps to ensure that applications and processes are running efficiently and can prevent potential crashes due to memory exhaustion. Thankfully, Nvidia provides a handy command line tool called nvidia-smi, which allows accessing information about the GPU. This command available on Windows and Linux systems when Nvidia drivers are installed. This tutorial explains how to get the memory usage of Nvidia GPU using nvidia-smi.

Run the following command to get the memory usage of Nvidia GPU:

nvidia-smi --query-gpu=gpu_name,memory.used,memory.free,memory.total --format=csv

After executing the command, you will see a detailed output that includes the GPU name, used memory, free memory, and total memory for all Nvidia GPUs installed on the system. The memory values are displayed in megabytes.

The output will look something like this:

name, memory.used [MiB], memory.free [MiB], memory.total [MiB]
NVIDIA GeForce RTX 3070 Laptop GPU, 127 MiB, 7846 MiB, 8192 MiB

Leave a Comment

Cancel reply

Your email address will not be published.