Linux gpu memory usage

Top 7 Linux GPU Monitoring and Diagnostic Commands Line Tools

A video card is a special circuit board that controls what is displayed on a computer monitor. It is also called a graphics processing unit (GPU), which calculates 3D images and graphics for Linux gaming and other usages. Let us see the top 7 Linux GPU monitoring and diagnostic command-line tools to solve issues.

The following tools work on Linux for GPU monitoring and diagnostic purposes and other operating systems such as FreeBSD. The majority of Linux and FreeBSD users these days use Nvidia, Intel, and AMD GPUs.

Linux GPU Monitoring and Diagnostic Commands Line Tools

We can use the following tools to monitor, diagnostic, and inspect our Linux or *BSD based systems.

Finding information about GPU on Linux

To get the GPU info simply run:
sudo lshw -C display -short
lspci -v | more
Which is output something as follows:

Want to find out video card GPU memory RAM size on Linux? Try:
sudo lspci
sudo lshw -C display
glxinfo | egrep -i ‘device|memory’
grep -i —color memory /var/log/Xorg.0.log

1. glmark2 – Stress-testing GPU performance on Linux

glmark2 is an OpenGL 2.0 and ES 2.0 benchmark command-line utility. We can install it as follows:
$ sudo apt install glmark2
Now run it as follows:
$ glmark2
Then it will begin the test as follows and would stress test your GPU on Linux:

Linux glmark2 test screen

2. glxgears – Simple Linux GPU performance testing tool

It will displays a set of rotating gears and prints out the frame rate at regular intervals. It has become quite popular as basic benchmarking tool for Linux and Unix-like system such as FreeBSD. Install and run it as follows:
$ apt install mesa-utils
$ glxgears

The GPU frame rate is measured and published out on the screen every five seconds. The final result will look as follows:

3. gpustat – A simple tool to get Nvidia GPU stats on Linux and FreeBSD Unix

It is written in Python and the perfect tool for CLI users, especially ML/AI developers. One can install it as follows using PIP
$ pip install gpustat
$ pip3 install gpustat
Run it as follows:
$ gpustat
$ gpustat -cp
Here we see name of running process and their PIDs running on Nvidia GPU:

See help:
$ gpustat -h

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

4. intel_gpu_top – Displying a top-like summary of Intel GPU usage on Linux

First install the tool, run:
$ sudo apt install intel-gpu-tools
## CentOS/RHEL/Fedora Linux user try the dnf command ##
$ sudo dnf install intel-gpu-tools
Fedora, RHEL and CentOS Linux user can use the podman command as follows to install the same:
$ podman run —rm —priviledged registry.freedesktop.org/drm/igt-gpu-tools/igt:master
The tool gathers data using perf performance counters (PMU) exposed by i915 and other platform drivers like RAPL (power) and Uncore IMC (memory bandwidth). Run it as follows on Linux system:
$ sudo intel_gpu_top

Читайте также:  Beef kali linux что это

5. nvidia-smi – NVIDIA System Management Interface program

The nvidia-smi provides monitoring and management capabilities for each of NVIDIA’s Tesla, Quadro, GRID and GeForce devices from Fermi and higher architecture families. GeForce Titan series devices are supported for most functions with very limited information provided for the remainder of the Geforce brand. NVSMI is a cross platform tool that supports all standard NVIDIA driver-supported Linux and FreeBSD. Install it as follows once Nvidia driver installed on Ubuntu Linux:
$ apt install nvidia-smi
Open the terminal and then run:
$ nvidia-smi -q -g 0 -d UTILIZATION -l 1
$ sudo nvidia-smi
$ nvidia-smi —help
Here is what we see:

6. nvtop – NVIDIA GPU top

Another fancy but very useful tool for NVIDIA GPU. It is a ncurses-based GPU status viewer for NVIDIA GPUs similarly to the htop command or top command. We can install it as follows using the apt command/apt-get command on a Debian or Ubuntu Linux:
$ apt install nvtop
## RUN the tool ##
$ nvtop

The following commands are available while in nvtop is on screen:

  • Up – Select (highlight) the previous process.
  • Down – Select (highlight) the next process.
  • Left / Right – Scroll in the process row.
  • + – Sort increasingly.
  • — – Sort decreasingly.
  • F1 – Select a signal to send to the highlighted process.
  • F2 – Select the field for sorting. The current sort field is highlighted inside the header bar.
  • F3 , q , Esc – Exit nvtop and return to your shell

7. radeontop – Tool to show AMD GPU utilization on Linux

View your AMD GPU utilization, both for the total activity percent and individual blocks on Linux. Install it as follows:
$ sudo apt install radeontop
$ sudo radeontop
It works with R600 and up GPUs, even Southern Islands should work fine. Works with both the open source AMD drivers and AMD Catalyst cloused-source drivers:

Conclusion

You learned about the various Linux GPU commands and tools for monitoring and diagnostic purposes on Linux and BSD-based systems. Let me know if I missed your favorite tool in the comment section below.

Источник

Linux Find Out Video Card GPU Memory RAM Size Using Command Line

  1. lspci command – It is a utility for displaying information about all PCI buses in the system and all devices connected to them.
  2. /var/log/Xorg.0.log – Xorg log file.
  3. lshw command – List CPU, CPU and other hardware on Linux.
  4. glxinfo command – See information about the GLX implementation on Linux on a given X display.
  5. nvidia-smi command – Display NVIDIA GPU info including installed RAM.
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements Linux
Est. reading time 5 minutes

lspci command example to find out video card (GPU) memory ram size on Linux

You need to use string called devices in the specified domain – 00:02.0 VGA (highlighted in red color to display memory info):
$ lspci -v -s 00:02.0
Sample outputs:

This listing shows an Intel video card with 128 MB of video RAM. If you cannot find devices in the specified domain use following command and look for your display card name and memory field:
$ lspci -v | less

Identify onboard Intel/AMD or Nvidia dedicated GPU on Linux

Simply run the following lshw command. It is a small tool to extract detailed information on the hardware configuration of the Linux machine:
$ sudo lshw -C display

Linux Find Out Video Card GPU Memory RAM Size Using Command Line

Another option is to run the following command:
$ glxinfo | more
One can use the egrep command as follows to filter out info:
$ glxinfo | egrep -i ‘device|memory’

Finding out video card GPU memory RAM size on Linux for NVIDIA card

Here is another output displaying Nvidia GPU memory on Arch Linux:
$ glxinfo | egrep -i ‘device|memory|video’
The following indicate that I have dedicated GPU video memory 4096 MB (4GB):

To get summary i.e. brief info run:
$ glxinfo -B
Sample outputs:

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

Xorg log file to get the GPU info on Linux

Open a command-line terminal (select Applications > Accessories > Terminal), and then type:
$ grep -i —color memory /var/log/Xorg.0.log
Sample outputs:

The above output indicate that my Nvidia card has 1024MB ram. The following is taken from my Macbook, which has Intel GM965 Video card. It shares memory from main RAM:
$ grep -i memory /var/log/Xorg.0.log
Sample outputs:

Using nvidia-smi for monitoring and management capabilities

The nvidia-smi command also display used and total GPU memory:
$ nvidia-smi

How to find out AMD video card GPU memory RAM size on Linux

Open the Terminal app and then execute the following lspci command $ lspci | grep -i VGA
Note down AMD PCI GPU ID such as 00:01.0 and then run:
$ lspci -vs 00:01.0
$ lspci -vs 00:01.0 | grep -i -E ‘size|ram|memory|prefetchable’
# Another option #
$ grep -i memory /var/log/Xorg.0.log
$ glxinfo | egrep -i ‘device|memory’
Outputs for my AMD/ATI] Kabini [Radeon HD 8330] card obtianed using the lspci command and grep command/egrep command:

Conclusion

You must use combination of various Linux commands to find out video card (GPU) memory (RAM) size and make of card. I strongly suggest that you read the following man pages:
$ man glxinfo
$ man lspci
$ man lshw

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Category List of Unix and Linux commands
Documentation help • mandb • man • pinfo
Disk space analyzers df • duf • ncdu • pydf
File Management cat • cp • less • mkdir • more • tree
Firewall Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04
Linux Desktop Apps Skype • Spotify • VLC 3
Modern utilities bat • exa
Network Utilities NetHogs • dig • host • ip • nmap
OpenVPN CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04
Package Manager apk • apt
Processes Management bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop
Searching ag • grep • whereis • which
Shell builtins compgen • echo • printf
Text processing cut • rev
User Information groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w
WireGuard VPN Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04

Comments on this entry are closed.

How do I check the amount of video card memory being used?

Thx, that helped me, but waht means “access denied” after the “capabilities”? That means my vga card is not in use? (I think)

heheh ur a furry jeff Apr 26, 2017 @ 17:34

Thank you but can you clarify; how do you view video memory in use additionally?

When I follow the above instructions, I get a much lower amount of memory than I know what is on this particular video card. The need for this is when I don’t know how much memory; on a laptop for instance.

@Fox
I don’t know why exactly the capabilities require root privs but that seems to be the case. Try:

sudo lspci -v -s 00:02.0

what means “access denied” after the “capabilities”?

Do use superuser. #sudo lspci -v -s 00:02.0

how do i find how much memory my video card has?

You could also do:

To focus the -v option right to the VGA adapter

for this example the output of your video card is the same as the one ‘m using, and I cannot find the correct intel video driver (the one currently install keeps crashing every so often) which video driver did you install –for Intel Corporation 82845G/GL?
I’m using arch linux

Saludos desde Argentina!

how to run .exe files in linux?

You cannot run .exe files under UNIX/Linux operating systems. These .exe files are solely created for Windows Operating Systems. You have something else instead of .exe files under Linux and they are called .rpm files which are the executable formats, do not be confused with the definition of executable and .exe file.

No. RPM files are just archives (packages) of software, and they are meant to be used on Red Hat-based distros (such as Fedora and CentOS). Linux executable files do not have a specific extension, but are usually in the ELF format. You can also “execute” interpreted scripts, such as shell and Python scripts.

Well, when first i landed to the Unix world, i would assume that everything will be the same as is in Windows Operating Systems. Reluctantly I would try to install some proprietary graphics software coded for Windows Platform and I would receive some obscure and absurd response from my Linux machine. This is the case that a newbie assumes that he/she is able to do the same in both platforms. Albeit, I have to mention that if someone really wants to know the intricacy of operating systems then the best book to start with is “Modern Operating Systems” by venerable Andrews S. Tanenbaum.

if you have binary .exe then use wine
or if .net .exe use mono to run exe that my personal experience

This is what I’m using in one of my scripts. And as the comments say, it doesn’t always return the correct value.

As a matter of fact, you *can* open .EXE files in all major distros. Just make sure you install Wine.
Ubuntu & Debian: sudo apt-get install wine

hey hi, i just wanna know how and where do i run the .SH file format, am using FEDORA 14.
thanx.

Hi,
using the commands mentioned in this article, I found that my notebook has 256MB video memory (32-bit, prefetchable), (Intel 945GM) on Linux Ubuntu 11.10.
However when I try to change/select the video memoy in BIOS it gives only two options : 64MB or 128 MB. I have set it to 128MB, but Ubuntu is showing 256MB … How is it possible ??

My Xorg.0.log has a line like this:
46 :[ 7.319] (–) PCI:*(0:0:2:0) 8086:2a02:17aa:20b5 rev 12, Mem @ 0xf8100000/1048576, 0xe0000000/268435456, I/O @ 0x00001800/8

0xe0000000/268435456 is how many bytes of memory my video card has.

Really helpful article.
Googled “how to check video memory on ubuntu server”, you guys were at second.

Very helpful. I was trying to find out how much memory my integrated card had for a windows game using the PlayOnLinux frontend for Wine.
Linked here from ubuntuforums post from 3 years ago…

Thanks. Just what I was looking for

just dropping a comment to say thanks for your help 🙂
Found a lot of useful info!

I’m trying to find out the memory of my Graphics Card, but these commands arent working for me, what ‘terminal’ am i supposed to be using.

never mind, i figured it out.

I googled “arch find out how much memory video card has” and this site popped up first. Very helpful and thank you.

thanks very much.

So I was gifted this computer from a friend and still learning my way around Linux and poweruser stuff in general. When I followed the lspci route, it gave me three outputs:

Memory at ee000000 (32-bit, non-prefetchable) [size=16M]
Memory at e0000000 (64-bit, prefetchable) [size=128M]
Memory at e8000000 (64-bit, prefetchable) [size=32M]

So I don’t know what the difference is between prefetchable or not, but the article seemed to imply the “prefetchable” one was how much memory the graphics card had, but this one lists two. Does that mean the graphics card uses both somehow? Is my memory 128, 32, or the total of both in this case?

Источник

Читайте также:  Windows 10 как удалить запущенный файл
Оцените статью