6

I wonder how I can know how many GPUs on my machine with and without using terminal?

8

Terminal way

Type this:

lspci|grep 'VGA\|Display'

and you'll see something similar like this:

00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Carrizo (rev c9)

You can ignore grep 'VGA\|Display' to list all PCIe and figure out how many GPUs you have by yourself if somehow the data is inaccurate.

GUI way

Install hardinfo and run it on terminal/search in Dash for "System Profiler and Benchmark". Look at the PCI devices section. It should looks like this:

GUI

  • 3
    grep VGA is a bad idea: on my system I have two GPUs: discrete nVidia and built-in Intel, and only one shows up as VGA compatible controller. It's better to use lspci|grep 'VGA\|Display', so that the following line could be found: 00:02.0 Display controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06). – Ruslan Jan 12 '18 at 22:29
8

Terminal

Using lspci

Most desktop computing GPUs (i. e. the target group of Ubuntu) are available and enumerated through the PCI bus.

A quick and easy to remember command is

$ lspci | grep VGA
01:00.0 VGA compatible controller: NVIDIA Corporation GF104 [GeForce GTX 460] (rev a1)

In the odd case that some other device has VGA in its name or vendor string you can scan specifically for the VGA adapter device class code:

$ lspci -nn | grep -Fe '[0300]:'
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF104 [GeForce GTX 460] [10de:0e22] (rev a1)

Using lshw

The advantage of lshw is that it enumerates devices on all known interfaces incl. USB, FireWire, Thunderbolt, I2C and other decreasingly common buses for GPUs on desktop computers (as opposed to embedded systems).

The disadvantage is that it requires super-user privileges to scan these buses.

$ sudo lshw -C display
  *-display               
       description: VGA compatible controller
       product: GF104 [GeForce GTX 460]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:32 memory: ...

-C display restricts the device list to graphics adapters, not displays or screens as the device class name suggests.

  • In some cases this will not show GPUs that are not in use (e.g. on certain nvidia cards with multiple GPUs but no support from the driver). – PlasmaHH Jan 12 '18 at 16:15
  • 1
    grep VGA is a bad idea: on my system I have two GPUs: discrete nVidia and built-in Intel, and only one shows up as VGA compatible controller. It's better to use lspci|grep 'VGA\|Display', so that the following line could be found: 00:02.0 Display controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06). – Ruslan Jan 12 '18 at 22:37
0

Terminal

Using lspci

You can use lspci to find GPUs, but the commands currently provided by other answers lose some of the results and show only one GPU — the primary one, VGA-compatible, used by BIOS/EFI to display its diagnostics.

To find both the default video card and secondary ones, you can use the following command:

$ lspci|grep 'VGA\|Display'
00:02.0 Display controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06)
01:00.0 VGA compatible controller: NVIDIA Corporation GM107 [GeForce GTX 750 Ti] (rev a2)


Even more general way is to use PCI device class code instead of its textual representation:

$ lspci -nn|grep ' \[03..\]: '
00:02.0 Display controller [0380]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller [8086:0412] (rev 06)
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM107 [GeForce GTX 750 Ti] [10de:1380] (rev a2)
|improve this answer|||||
0

lspci

I use lspci witk -k option for see kernel driver and kernel modules too, both.

After for grep I set -A 2 parameter for two lines in a row after the info for keyword "VGA":

lspci -k|grep -iA2 "VGA"

Note: option -i in grep is for ignore case, e. g. "vGA" or "vga".

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.