I wonder how I can know how many GPUs on my machine with and without using terminal?
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.
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:
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 ':' 01:00.0 VGA compatible controller : NVIDIA Corporation GF104 [GeForce GTX 460] [10de:0e22] (rev a1)
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.
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 : Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller [8086:0412] (rev 06) 01:00.0 VGA compatible controller : NVIDIA Corporation GM107 [GeForce GTX 750 Ti] [10de:1380] (rev a2)