Open In App

Check and Monitor Active GPU in Linux

Last Updated : 31 Jul, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Monitoring the GPU(Graphics Processing Unit) on a Linux operating system is essential for performance testing, debugging, and ensuring usage. There are many tools for checking and monitoring the GPU activity of various GPUs like Nvidia, AMD, or Intel GPU. This article will teach us about multiple methods to check GPU monitors in the Linux Operating System.

What is GPU(Graphical Processing Unit)

In Computer systems, a graphical Processing Unit (GPU) is an electronic circuit designed to accelerate the processing of images and video. The main purpose of GPU is to render graphics in computer games and other visual applications. GPUs have evolved to handle a wide range of computational tasks.

Using 'lspci' command

The 'lspci' command is used in Linux to display information about all PCI (Peripheral Component Interconnect) buses in the system and the devices connected to them. It means this command shows all the PCI devices along with the GPUs

lspci | grep -i 'vga\|3d\|2d'

Output

Using 'lspci' command

Using nvidia-smi for(NVIDIA GPUs)

If you are are using the nvidia GPU and the NVIDIA drives installed, you can use 'nvidia-smi' to get detailed information about your GPU.

nvidia-smi

Using 'glxinfo' (For OpenGL information)

We can also used glxinfo command for getting information about the OpenGL implementation including the active GPU in the Linux operating system.

glxinfo | grep "OpenGL renderer"

Output

Using 'glxinfo'


Using 'watch' with 'lspci'

There is one more command which is watch command with lspci. This commands allows you to continuously monitor the output of the lspci cmmand at regular intervals. This can be useful for observing changes in PCI devices in real-time , such as when you're adding or removing hardware components.

To watch the output of lscpi and update it every 2 seconds, You can use this command in linux operating system.

watch lspci

Output

Using 'watch' with 'lspci'

Using htop with GPU Metrics

There is htop command in linux operating system that using to monitor GPU metrics can be very helpful for tracking GPU usage, memory, temperature, and other important parameters. In some distore does not include htop command. In this case you have to installed the htop command using the package manger.

htop

Output

htop

Conclusion

In this article, we have learned to check and monitor active GPU usage in Linux Operating System. You can use several tools depending on your GPU type. For NVIDIA GPUs, the 'nvidia-smi' tool, which comes with the NVIDIA driver package, provides detailed information about GPU usage, including utilization, memory usage, temperature, and running processes You can watch GPU usage in tmux with running multiple commands. This allows you to run 'htop' in one pane for CPU monitoring and 'nvidia-smi' or 'radeontop' in another pane for GPU monitoring. It gives your a comprehensive view of system performance.


Next Article
Article Tags :

Similar Reads