Horje
Check and Monitor Active GPU in Linux

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.

Check and Monitor Active GPU – FAQs

What tools can I use to monitor GPU usage on Linux?

For Nvidia GPUs, You can use ‘nvidia-smi’ and ‘gpustat. For AMD GPUs radeontop is the preferred tool in linux for monitoring the GPUs usage

How do I install and use ‘nvidida-smi’ ?

The nvidia-smi comes pre-installed with the NVIDIA drive package. You can run it by typing ‘nvidia-smi’ in the terminal for a snapshot of GPU metrics or use ‘watch -n 1 nvidia-smi ‘ for continuous monitoring GPU usage.

Can I monitor CPU and GPU usage simultaneously?

Yes, You can use terminal multiplexers like ‘tmux’ or ‘screen’ to split your terminal into multiple panes. This allows you to run ‘htop’ for CPU monitoring in one pane and ‘nvidia-smi’ , ‘gpustat’ or ‘radeontop’ for GPU monitoring in another.

Are there graphical tools available for monitoring GPU usage?

In linux , we can also use graphical tool like ‘nvtop’ for NVIDIA GPUs and various system monitors like ‘Gnome System Monitor’ or ‘KSysGuard’ that may include GPU metrics if properly configured.




Reffered: https://www.geeksforgeeks.org


Linux Unix

Related
Privileged access management (PAM) for linux and unix Privileged access management (PAM) for linux and unix
How to Set up a Wireless Network in Linux How to Set up a Wireless Network in Linux
What is GitLeaks and How to Use It? What is GitLeaks and How to Use It?
How to Install Ubuntu Server Edition with LXD Containers? How to Install Ubuntu Server Edition with LXD Containers?
How to Install Kali Linux with Persistence on USB Drive? How to Install Kali Linux with Persistence on USB Drive?

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
22