How many GPUs in my machine?

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


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


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.