Hello to all my dear friends.

Recently, I got a new laptop to test out. This is the Lenovo LOQ series. Lenovo LOQ is a low end gaming laptop series as against Lenovo Legion. This is the one.

I wanted to mainly see the experience of Nvidia graphics card on a Linux system.

How to Identify Graphics Cards on Linux?

lspci | grep VGA

00:02.0 VGA compatible controller: Intel Corporation Device a78b (rev 04)
01:00.0 VGA compatible controller: NVIDIA Corporation Device 28e1 (rev a1)

The above command lists all the PCI devices. And then we filter the VGA controller. It shows two graphics cards on the system. One is the integrated Intel graphics card and another is the Nvidia graphics card.

How to Identify Which Graphics Card is in Use on Linux?

After it is identified that there is a Nvidia GPU on the system. Then it is required to see if Nvidia is in use or it is still the default Intel graphics in use.

glxinfo | grep "OpenGL vendor\|OpenGL renderer"

OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) Graphics (RPL-S)

The above command shows that Intel is in use for rendering the screen. glxinfo command is part of mesa-utils package on Ubuntu.

I use KDE desktop and the Graphics processor can be seen from About the system as well. This is also shown in Gnome or other desktop environment.

prime-select query

on-demand

The prime-select is another command that shows which GPU is in use. This shows on-demand. It means that the X screen is being rendered by Intel GPU but certain applications that are really GPU intensive can be offloaded to Nvidia GPU. But by default Intel is used to render X screen and the applications.

But I want to use Nvidia GPU to render X screen and all the applications. For that, I will run the following command.

sudo prime-select nvidia

Info: selecting the nvidia profile
Deleting /lib/modprobe.d/nvidia-runtimepm.conf
Updating the initramfs. Please wait for the operation to complete:
Done
prime-select query
nvidia

And after that I rebooted the system and now Nvidia takes control of the entire rendering on itself. The same can be seen from glxinfo and graphics information in About the system.

glxinfo | grep "OpenGL vendor\|OpenGL renderer"

OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce RTX 4050 Laptop GPU/PCIe/SSE2

Now the X screen and all the applications are being rendered by Nvidia graphics and Intel is no longer in picture.

There is also a package nvidia-settings which is UI to manage GPU setting.

In addition to this, another command nvidia-smi is used to monitor Nvidia GPU usage and manage GPU settings. Nvidia-SMI is system management interface.

nvidia-smi 

Wed Sep 18 09:35:00 2024       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.107.02             Driver Version: 550.107.02     CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 4050 ...    Off |   00000000:01:00.0 Off |                  N/A |
| N/A   48C    P8              1W /   55W |     304MiB /   6141MiB |     26%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A      1733      G   /usr/lib/xorg/Xorg                            179MiB |
|    0   N/A  N/A      2291      G   /usr/bin/kwin_x11                              53MiB |
|    0   N/A  N/A      2360      G   /usr/bin/plasmashell                           39MiB |
|    0   N/A  N/A      2636      G   /usr/bin/akonadi_archivemail_agent              2MiB |
|    0   N/A  N/A      2644      G   /usr/bin/akonadi_mailfilter_agent               2MiB |
|    0   N/A  N/A      2657      G   /usr/bin/akonadi_sendlater_agent                2MiB |
|    0   N/A  N/A      2658      G   /usr/bin/akonadi_unifiedmailbox_agent           2MiB |
+-----------------------------------------------------------------------------------------+

If Nvidia is not enabled or in use, then nvidia-smi throws the following error.

nvidia-smi 

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

Similar Posts

Error: GraphComment couldn't be load because your settings are invalid. Please visit your admin panel and go to the GraphComment section and enter a valid website URL/ID.