2 Methods to Get Available GPU Devices on Linux

2 Methods to Get Available GPU Devices on Linux

Graphics Processing Units (GPUs) are no longer just for gaming or visual effects - they're now crucial for tasks like machine learning, scientific computing, and video editing. If you use Linux and want to take advantage of the GPU, the first step is to check which GPU devices are available on the system. This tutorial provides 2 methods how to get available GPU devices on Linux.

Method 1 - lspci

The lspci command lists all PCI devices, and you can filter the output to show only display-related hardware like GPUs:

lspci | grep -E 'VGA|3D|Display'

This command will show entries like:

00:02.0 Display controller: Intel Corporation Raptor Lake-S GT1 [UHD Graphics 770] (rev 04)
01:00.0 VGA compatible controller: NVIDIA Corporation AD102 [GeForce RTX 4090] (rev a1)

Method 2 - lshw

The lshw command provides a more detailed view of the hardware:

sudo lshw -class display

Example of a part of the output:

*-display                 
   description: VGA compatible controller
   product: AD102 [GeForce RTX 4090]
   vendor: NVIDIA Corporation
   ...
*-display
   description: Display controller
   product: Raptor Lake-S GT1 [UHD Graphics 770]
   vendor: Intel Corporation

Leave a Comment

Cancel reply

Your email address will not be published.