I'm looking for a command that would give me the same info as:
cat /proc/cpuinfo
Except for the GPU (type of the chip and memory, frequency).
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityI do not know of a direct equivalent, but lshw should give you the info you want, try:
sudo lshw -C display
(it also works without sudo
but the info may be less complete/accurate)
You can also install the package lshw-gtk
to get a GUI.
product: 2nd Generation Core Processor Family Integrated Graphics Controller
Apr 17, 2018 at 2:13
integrated graphics
, which means that it's integrated into the CPU. Your CPU has it own component which functions as a graphics card and probably (to save on costs) uses the ordinary RAM to store its buffers. You do not have a separate independent removable graphics card.
That type of information is non-standard, and the tools you will use to gather it vary widely.
The command glxinfo
will give you all available OpenGL information for the graphics processor, including its vendor name, if the drivers are correctly installed.
To get clock speed information, there is no standard tool.
aticonfig --odgc
should fetch the clock rates, and aticonfig --odgt
should fetch the temperature data. I'm not familiar with AMDGPU-Pro, but a similar tool should exist.nvidia-smi
tool will show all of the information you could want, including clock speeds and usage statistics.I am not aware of an equivalent tool for the open source drivers or for Intel or other GPUs, but other information on the hardware can be fetched from the lspci
and lshw
tools.
mesa-utils
on Ubuntu.
aticonfig
doesn't appear to be available since the retirement of fglrx. nvclock
also appears to have been abandoned since the last version was for trusty. Do you have any updated solutions? Here's what I have so far..
Dec 14, 2017 at 23:16
glxinfo | grep "Device"
worked well enough for me on an Intel GPU
May 26, 2018 at 14:10
A blog post focusing on work done on the command-line is here:
http://www.cyberciti.biz/faq/howto-find-linux-vga-video-card-ram/
Find out the device ID:
lspci | grep ' VGA ' | cut -d" " -f 1
03:00.0
You can then use this output with lspci
again, forming two nested commands
lspci -v -s $(lspci | grep ' VGA ' | cut -d" " -f 1)
If you have more than 1 GPU card, try this equivalent command instead:
lspci | grep ' VGA ' | cut -d" " -f 1 | xargs -i lspci -v -s {}
Output from my system:
03:00.0 VGA compatible controller: NVIDIA Corporation G98 [Quadro NVS 295] (rev a1) (prog-if 00 [VGA controller])
Subsystem: NVIDIA Corporation Device 062e
Flags: bus master, fast devsel, latency 0, IRQ 24
Memory at f6000000 (32-bit, non-prefetchable) [size=16M]
Memory at ec000000 (64-bit, prefetchable) [size=64M]
Memory at f4000000 (64-bit, non-prefetchable) [size=32M]
I/O ports at dc80 [size=128]
[virtual] Expansion ROM at f7e00000 [disabled] [size=128K]
Capabilities: <access denied>
Kernel driver in use: nvidia
EDIT: You can avoid the <access denied>
by launching with sudo
So, (prefetchable) [size=64M)
indicates that I have a 64-MB NVIDIA card. However, I don't, it's rather 256 MB. Why? See below.
To see how to get the most info and performance out of it, read an extremely comprehensive article on the Arch-Linux Wiki
https://wiki.archlinux.org/index.php/NVIDIA
For nvidia users, start with
nvidia-smi
(This works with the Nvidia drivers installed,but not with systems running the open-source 'nouveau' driver).
Output
Thu Dec 19 10:54:18 2013
+------------------------------------------------------+
| NVIDIA-SMI 5.319.60 Driver Version: 319.60 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Quadro NVS 295 Off | 0000:03:00.0 N/A | N/A |
| N/A 73C N/A N/A / N/A | 252MB / 255MB | N/A Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Compute processes: GPU Memory |
| GPU PID Process name Usage |
|=============================================================================|
| 0 Not Supported |
+-----------------------------------------------------------------------------+
This indicates that I have a 256 MB GDDR3 Graphics card.
At this time, I don't know how to get this for Intel and AMD/ATI GPUs.
nvidia-smi
(that should be highlighted a bit in my opinion)
Sep 7, 2014 at 15:23
nvidia-smi -q
, as suggested by @Quanlong uses more sensible output format.
$ nvidia-smi --query-gpu=gpu_name --format=csv
to just get the GPU name
May 14, 2021 at 11:40
Run google-chrome
and navigate to the URL about:gpu
.
If chrome has figured out how to use OpenGL, you will get extremely detailing information about your GPU.
Because you specified a command like cat
for CPU's this is therefore the equivalent for GPU's. Specifically for Nvidia cards. It requires no software except the Nvidia device driver to be loaded.
The path here works for the cards I have. But yours may differ as others have pointed out in the comments.
1st GPU
> cat /proc/driver/nvidia/gpus/0/information
Model: GeForce GTX 680
IRQ: 24
GPU UUID: GPU-71541068-cded-8a1b-1d7e-a093a09e9842
Video BIOS: 80.04.09.00.01
Bus Type: PCIe
DMA Size: 40 bits
DMA Mask: 0xffffffffff
Bus Location: 0000:01.00.0
2nd GPU
> cat /proc/driver/nvidia/gpus/1/information
Model: GeForce GTX 580
IRQ: 33
GPU UUID: GPU-64b1235c-51fc-d6f1-0f0e-fa70320f7a47
Video BIOS: 70.10.20.00.01
Bus Type: PCIe
DMA Size: 40 bits
DMA Mask: 0xffffffffff
Bus Location: 0000:08.00.0
cat /proc/driver/nvidia/gpus/0000\:01\:00.0/information
for me)
Nov 24, 2015 at 3:54
0000:3b:00.0
or 0000:d8:00.0
for me, so we should type: cat /proc/driver/nvidia/gpus/0000:3b:00.0/information
. The lovely Tesla V100-PCIE-16GB
model shows that the qsub
job limit is satisfied as desired.
Oct 6, 2018 at 7:40
clinfo
sudo apt-get install clinfo
clinfo
is the analogue of glxinfo
but for OpenCL, my GPU setup is described at: https://stackoverflow.com/questions/7542808/how-to-compile-opencl-on-ubuntu/33483311#33483311 The output contains my GPU model among other things:
Number of devices 1
Device Name Quadro M1200
Ubuntu 20.04 Settings -> About
You can either open settings by clicking on top right menu, or you can just do:
So under "Graphics" I can see that my GPU model is
Quadro M1200/PCIe/SSE2
Some other things it can show:
nvidia-settings
Mixes runtime with some static info.
More details: How do I check if Ubuntu is using my NVIDIA graphics card?
I do believe the best option for this is neofetch.
# Get neofetch
sudo add-apt-repository ppa:dawidd0811/neofetch
sudo apt update
sudo apt install neofetch
# Run neofetch
neofetch
This gives an output like this:
screenfetch
program does the same thing and doesn't require a PPA to install.
Jan 30, 2018 at 19:31
This is really not that complex For model and memory, here's a 1 liner that works for every video card I've tested it on regardless of manufacturer (Intel, AMD, NVIDIA):
GPU=$(lspci | grep VGA | cut -d ":" -f3);RAM=$(cardid=$(lspci | grep VGA |cut -d " " -f1);lspci -v -s $cardid | grep " prefetchable"| cut -d "=" -f2);echo $GPU $RAM
GPU= All this bit does is grab the 3rd field from 'lspci' output filtered via 'grep' for VGA which corresponds to the video chip.
RAM= All this bit does is set variable cardid
equal to the first field of output from lspci
matching "VGA" and feeds that as a request for -v
verbose output from lspci
for that specific -s
device, further filtering the output by grep
for the string " prefetchable" as this contains the memory on the card itself (note the preceding space as we don't want to match "non-prefetchable" in our output.
For clock rate on Intel integrated graphics (Tested on I3 and I5)
execute the command sudo find /sys -type f -name gt_cur* -print0 | xargs -0 cat
This dives into the /sys tree to locate the gt_cur_freq_mhz
file which on my I3 is /sys/devices/pci0000:00/0000:00:02.0/drm/card0/gt_cur_freq_mhz
and prints the content. which in my case under extremely light load is 350
as in 350 MHz which corresponds to the minimum frequency found in /sys/devices/pci0000:00/0000:00:02.0/drm/card0/gt_min_freq_mhz
and when running glxgears
and glmark2
results in
1050
as in 1050 MHz which corresponds to the maximum frequency found in /sys/devices/pci0000:00/0000:00:02.0/drm/card0/gt_max_freq_mhz
For clock rates on nvidia cards:
nvidia-smi -stats -d procClk
corresponds to the GPU clock
nvidia-smi -stats -d memClk
corresponds to the memory clock.
Note: I am unable to test the above as my trusty GeForce 210 isn't supported and this works only on Kepler or newer GPUs as indicated by `nvidia-smi -stats --help'
I do not currently have any solutions for clock rate on AMD cards and do not have the hardware available for testing. I will however say that to the best of my knowledge the aticonfig
mentioned in the accepted answer no longer exists and it appears that nvclock
isn't available for anything since trusty.
If you're looking for only the names of the video cards on the machine, then simply use:
$ nvidia-smi --list-gpus
For some newer GPUs, this also lists the memory of each device.
I use two methods to automatically display nVidia GPU and Intel iGPU information:
~/.bashrc
displays GPU information each time the terminal is openedThis example uses Conky to display current GPU (nVidia or Intel) stats in real time. Conky is a light weight system monitor popular among many Linux enthusiasts.
The display changes depending on if you booted after prime-select intel
or prime-select nvidia
.
Skylake GT2 HD 530 iGPU
with current frequency350
MHz and the Maximum is 1050
MHzGeForce GTX970M
with current GPU frequency and temperatureHere is the relevant Conky script for Intel iGPU and nVidia GPU:
#------------+
# Intel iGPU |
#------------+
${color orange}${hr 1}${if_match "intel" == "${execpi 99999 prime-select query}"}
${color2}${voffset 5}Intel® Skylake GT2 HD 530 iGPU @${alignr}${color green}${execpi .001 (cat /sys/class/drm/card1/gt_cur_freq_mhz)} MHz
${color}${goto 13}Min. Freq:${goto 120}${color green}${execpi .001 (cat /sys/class/drm/card1/gt_min_freq_mhz)} MHz${color}${goto 210}Max. Freq:${alignr}${color green}${execpi .001 (cat /sys/class/drm/card1/gt_max_freq_mhz)} MHz
${color orange}${hr 1}${else}
#------------+
# Nvidia GPU |
#------------+
${color2}${voffset 5}${execpi .001 (nvidia-smi --query-gpu=gpu_name --format=csv,noheader)} ${color1}@ ${color green}${execpi .001 (nvidia-smi --query-gpu=clocks.sm --format=csv,noheader)} ${alignr}${color1}Temp: ${color green}${execpi .001 (nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader)}°C
${color1}${voffset 5}Ver: ${color green}${execpi .001 (nvidia-smi --query-gpu=driver_version --format=csv,noheader)} ${color1} P-State: ${color green}${execpi .001 (nvidia-smi --query-gpu=pstate --format=csv,noheader)} ${alignr}${color1}BIOS: ${color green}${execpi .001 (nvidia-smi --query-gpu=vbios_version --format=csv,noheader)}
${color1}${voffset 5}GPU:${color green}${execpi .001 (nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader)} ${color1}Ram:${color green}${execpi .001 (nvidia-smi --query-gpu=utilization.memory --format=csv,noheader)} ${color1}Pwr:${color green}${execpi .001 (nvidia-smi --query-gpu=power.draw --format=csv,noheader)} ${alignr}${color1}Freq: ${color green}${execpi .001 (nvidia-smi --query-gpu=clocks.mem --format=csv,noheader)}
${color orange}${hr 1}${endif}
~/.bashrc
Terminal splash screenThis example modifies ~/.bashrc
to display information on a splash screen each time the terminal is opened or whenever you type . .bashrc
at the shell prompt.
In addition to neofetch
answered previously, there is screenfetch
which looks a lot nicer (IMO). Plus another answer mentions he doesn't know how to get iGPU listed and this does it:
For details on setup see: Terminal splash screen with Weather, Calendar, Time & Sysinfo?
In summary just for the bottom section with Ubuntu display containing GPU information (second last line) use:
sudo apt install screenfetch
screenfetch
You'll want to put the screenfetch
command an the bottom of your ~/.bashrc
file to have it appear every time you open the terminal.
Just to find the basics, according to https://wiki.debian.org/NvidiaGraphicsDrivers#NVIDIA_Proprietary_Driver,
lspci | grep VGA
If you need more detail than that, see @knb's answer to this same question.
For nvidia GPUs, nvidia-smi
command is your friend.
See man nvidia-smi
if you like to.
For listing GPUs use nvidia-smi -L
(nvidia-smi --list-gpus
),
nvidia-smi -q
give information about the gpu and the running processes.
If you would like to have simple information, you could try gpustat. It is very good and simple.
The author gives the following installation instructions:
Install from PyPI:
pip install gpustat
To install the latest version (master branch) via pip:
pip install git+https://github.com/wookayin/gpustat.git@master
If you don't have root privilege, please try to install on user namespace:
pip install --user
. Note that from v0.4,gpustat.py
is no more a zero-dependency executable. However, in rare cases you'll need a single executable script (legacy), you can also try:wget https://raw.githubusercontent.com/wookayin/gpustat/v0.3.2/gpustat.py -O ~/.local/bin/gpustat chmod +x ~/.local/bin/gpustat # Assuming ~/.local/bin is in your $PATH
If you have a AMD Radeon Card, you may want to run the following commands
sudo update-pciids #optional command, requires internet
lspci -nn | grep -E 'VGA|Display'
It should report something like this
00:01.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Wani [Radeon R5/R6/R7 Graphics] [1002:9874] (rev c5)
03:00.0 Display controller [0380]: Advanced Micro Devices, Inc. [AMD/ATI] Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330 / M430 / R7 M520] [1002:6660] (rev ff)
Well, this answer assumes you have a server with NVIDIA-GPUs. You have three ways:
To get just a short gist: nvidia-smi
To get a detailed one : nvidia-smi -q
. You'll get multiple screens of detailed info if you more than 1 gpu.
Do a ls /proc/driver/nvidia/gpus/
. It'll display the GPU-bus location as folders.
Now, run the following command for each of the gpu bus locations. Fill <gpu-id>
with bus-location: cat /proc/driver/nvidia/gpus/<gpu_id>/information
If you're running Ubuntu on a Chromebook with crouton, the only one of the answers that will work is going to chrome://gpu
in the Chrome browser.
For AMD based graphics card(GPU), you can use radeon-profile
application to get detailed information about the cards. It provides temperature, clock, Vram usage etc. (Github repository link)
Step1: sudo add-apt-repository ppa:radeon-profile/stable
Step 2:
sudo apt update
sudo apt install radeon-profile
Step 3: run radeon-profile
Output screenshots (I have two GPU cards, card0(integrated) and card1(discrete)):
System specification:
For the Intel GMA950 (comes with EeePC in particular) you can run:
setpci -s 00:02.0 f0.b
which will return '00' for 200MHz, '01' for 250MHz or '03' for 400MHz. You may be able to apply the same principle to other Intel cards.
Use lspci
, lspci -v
to get basic info see here.
In my case for ex once I run lspci
and I have got :
dina@dina-X450LA:~$ lspci
00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 0b)
00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 0b)
00:14.0 USB controller: Intel Corporation 8 Series USB xHCI HC (rev 04)
00:16.0 Communication controller: Intel Corporation 8 Series HECI #0 (rev 04)
00:1b.0 Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 1 (rev e4)
00:1c.2 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 3 (rev e4)
00:1c.3 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 4 (rev e4)
00:1d.0 USB controller: Intel Corporation 8 Series USB EHCI #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation 8 Series LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 8 Series SATA Controller 1 [AHCI mode] (rev 04)
00:1f.3 SMBus: Intel Corporation 8 Series SMBus Controller (rev 04)
02:00.0 Ethernet controller: Qualcomm Atheros QCA8171 Gigabit Ethernet (rev 10)
03:00.0 Network controller: Ralink corp. RT3290 Wireless 802.11n 1T/1R PCIe
03:00.1 Bluetooth: Ralink corp. RT3290 Bluetooth
In order to get all the information about the graphics processor, you can use the following command as specified by @greyfade.
> glxinfo
However, if the program glxinfo
is currently not installed, you can install it by typing:
> sudo apt install mesa-utils
You will also have to enable the component called universe
. Once this is done, glxinfo
will list all the specifications related to the graphics processor in that environment.
Tested for GTX 1080Ti - For clock rates on nvidia card -
nvidia-smi stats -d procClk corresponds to the Core clock
nvidia-smi stats -d memClk corresponds to the Memory clock
For monitoring every second -
watch -n 1 nvidia-smi stats -d procClk -c 1
For monitoring a subset of the devices every second -
watch -n 1 nvidia-smi stats -d procClk -c 1 -i 0,1
Based off on Elder Geek's answer with modifications to print every second to check for thermal throttling. If your GPU is being throttled, the procClk will drop significantly.
For checking the utilization of Intel GPUs there is intel_gpu_top
available since xenial (https://packages.ubuntu.com/bionic/intel-gpu-tools).
apt-get install intel-gpu-tools
There are just a few options available - see man intel_gpu_top
.
For my setup this is the cleanest:
python -c "import torch; print(torch.cuda.get_device_name(0));"
or
python -c "import uutils; gpu_name_otherwise_cpu(print_to_stdout=True);"
code:
def gpu_name_otherwise_cpu(print_to_stdout: bool = False):
gpu_name_or_cpu = None
try:
gpu_name_or_cpu = torch.cuda.get_device_name(0)
except:
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
gpu_name_or_cpu = device
print(f'{gpu_name_or_cpu=}') if print_to_stdout else None
return gpu_name_or_cpu
cat /proc/cpuinfo
do? what info are you looking for?python -c "import torch; print(torch.cuda.get_device_name(0));"