Kamis, 12 September 2024

How to Check GPU Usage on Linux Systems

How to Check GPU Usage on Linux Systems

When you have a GPU on board, integrated or dedicated, there are some programs that help you get the necessary stats to check its temperature, free memory, and more. You can use them on Ubuntu and other Linux distributions as well.

Unfortunately, default system monitoring tools and command-line utilities like htop or top do not display GPU usage data.

So, you need to use a couple of specific programs or terminal tools that would let you access the usage data for your graphics card or integrated GPU.

Here, I highlight the same after testing it on Ubuntu and Arch Linux.

How to Check GPU Usage on Linux Systems

If you do not mind installing a GUI program for the job, Mission Center should be your preferred tool.

It supports NVIDIA, AMD, and Intel GPUs. So, you do not have to think twice regarding the support for your hardware. However, with Intel GPUs, you may not get all the essential details compared to AMD and NVIDIA powered GPUs.

You can install it as a Flatpak from Flathub or download the AppImage from its GitLab releases section. It is also available in certain repositories like AUR for Arch Linux. Head to its GitLab page for more information.

The command for Flatpak installation is (any Linux distribution):

flatpak install flathub io.missioncenter.MissionCenter

For Arch Linux users, you can type in:

sudo pacman -S mission-center

Furthermore, refer to our AppImage guide if you are not familiar with the type of package.

Suggested Read 📖

9 System Monitoring Tools for Linux That are Better Than Top
Top command is good but there are better alternatives. Take a look at these system monitoring tools that are similar to top, but better than it.
How to Check GPU Usage on Linux Systems

Command-line tools to check GPU stats

If you do not like GUI programs, don't worry, I got you. You have different ways you can monitor GPU usage stats, depending on which GPU your Linux system has.

nvidia-smi

For NVIDIA, you can simply type:

nvidia-smi -l 2

You do not need to install this. If you have your NVIDIA drivers installed (which should be the case by default on Ubuntu), you should be able to use this. We have NVIDIA driver installation guides for Linux Mint and Fedora that you can follow as well.

How to Check GPU Usage on Linux Systems

In the command, 2 → denotes the second interval in which the terminal will be refreshed. You can change this or opt to get updates in milliseconds by following the instructions on its man page.

nvtop

If you have a different GPU or want something else, try nvtop, which is used under-the-hood by Mission Center GUI.

Just type in the following to get it installed and then launch it:

sudo apt install nvtop
nvtop
How to Check GPU Usage on Linux Systems

It supports both AMD and NVIDIA GPUs (with proprietary drivers only). You can also find it in for Arch and other distributions in the respective repositories.

gpustat

There's another tool: gpustat, a Python package that also gives you quick details regarding your GPU usage. You need pip installed on your Ubuntu or Linux system to get this installed.

It only works for NVIDIA proprietary drivers.

Once done, just type in the following:

pip install gpustat

If this fails for some reason, you can install python-pipx package, as an alternative, which I did on Arch Linux. Pipx manages a virtual environment for you to easily run the Python package. So, that is the only difference. The command would look like:

pipx install gpustat

Once done, launch it using the command:

gpustat
How to Check GPU Usage on Linux Systems

Wrapping Up

Whether you have an NVIDIA, AMD, or Intel GPU, monitoring your resources is helpful, especially, if you are system is not performing as intended. You also need to check if your GPU is being properly utilized for the programs you want it to offload tasks to instead of the CPU.

The terminal tool nvtop should be the best one in my option for stats on processing using the GPU, and the rest of the details. However, your preference can differ with just the default nvidia-smi or Mission Center GUI.

On a related note, you might want to keep a tab on the GPU temperature in Linux.

Monitoring CPU and GPU Temperatures in Linux Terminal
This article discusses two simple ways of monitoring CPU and GPU temperatures in the Linux command line.
How to Check GPU Usage on Linux Systems

💭 What do you think is the best way to check GPU usage on Linux? Let me know in the comments!



from It's FOSS https://ift.tt/RIxBCfZ
via IFTTT

Tidak ada komentar:

Posting Komentar