I have 2 GPU's in my netbook. How do I know which one I'm actually using at any given moment?
10 Answers
I've just gone through a hell of a time
trying to get my discrete graphics to work in Ubuntu,
and answering this question was constantly a challenge,
since the lspci method mentioned earlier
can sometimes say that both are [VGA controller]
.
I think the following command should give you an indication of your active chip:
$ glxinfo | grep -E "OpenGL vendor|OpenGL renderer"
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Sandybridge Mobile
For me, this is telling me that my Intel graphics are running the show.
glxinfo
is available from the mesa-utils
package,
so you will need to install it if you haven't already.
On Ubuntu 22.04, for example, run:
sudo apt-get install mesa-utils
If you're using an NVIDIA chip, and you're using the bumblebee
package,
you can put optirun
in front of that line,
and it should tell you that you're running the NVIDIA chip
(optirun
is basically telling the computer
to use the discrete chip to run whatever command follows,
but everything else is still using the integrated chip).
$ optirun glxinfo | grep -E "OpenGL vendor|OpenGL renderer"
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GT 555M/PCIe/SSE2
glxheads
is another helpful command from mesa-utils
that tells you
some useful information about which graphics card is in use
(mostly repeats glxinfo
in a more compact and easy-to-read form, though),
and it gives you a nice rendering of a rotating triangle.

- 961
To check which GPU is currently in command (that means which is an active VGA controller) type in
lspci -vnnn | perl -lne 'print if /^\d+\:.+(\[\S+\:\S+\])/' | grep VGA
Any controller with [VGA controller]
at the end is your currently active GPU. The others are switched off. In the following example the Intel card is active while the nVidia one is not in use:
00:02.0 VGA compatible controller [0300]: Intel Corporation Core Processor
Integrated Graphics Controller [8086:0046] (rev 02) (prog-if 00 [VGA
controller])
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF108 [GeForce
GT 540M] [10de:0df4] (rev ff) (prog-if ff)

- 427
nvidia-settings
GUI
On Ubuntu 15.10, after I installed nvidia-352
and the GPU seems to work:
nvidia-settings
shows something like:
Note how it shows:
GPU 0 - (NVS 5400M)
where NVS 5400M
is my GPU model.
Then if I fire glxgears
, the "GPU Utilization" goes to > 90%.
So I expect that if you had multiple GPUs, you could see how much each one was being used at a time.

- 18,092
- 4
- 117
- 102
-
What is nvidia-352 exactly? Is is a bunch of drivers or just a driver for a specific GPU? – cosbor11 May 10 '18 at 05:27
-
@cosbor11
nvidia-352
is the version of the driver / Ubuntu package n, each version supports many GPUs as listed on the official website: http://www.nvidia.com/Download/driverResults.aspx/90279/en-uames NVS 5400M is the GPU model: https://en.wikipedia.org/wiki/List_of_Nvidia_graphics_processing_units – Ciro Santilli OurBigBook.com May 11 '18 at 07:16 -
2This answer is Nvidia-specific, but the OP didn't specify a vendor. What about AMD? I have an AMD laptop with integrated and dedicated GPUs. – unfa May 05 '21 at 14:54
-
@unfa sorry, I don't know how to do it there, let me know if you find a more general method, I don't like lock-in either. Also, I like your YouTube channel :-) – Ciro Santilli OurBigBook.com May 05 '21 at 15:05
nvidia-smi -L
This gave me what I wanted. This command shows the list of GPUs present on your machine. This might help you figure which are active ones.
got the command from thread here: Ubuntu Box with multiple NVIDIA GPU Cards | devtalk.nvidia.com

- 219
-
1anybody figured out how to find the free GPUs out of the ones returned by this command? – pcko1 Jan 21 '20 at 16:02
-
Just curious, will this command list an Intel integrated GPU if you decided to disable your Nvidia GPU? – kas Nov 14 '20 at 18:11
-
1This only lists Nvidia GPUS and gives no indication if active for desktop or not.. – RichieHH Apr 12 '21 at 22:57
-
This answer is Nvidia-specific, but the OP didn't specify a vendor. What about AMD? I have an AMD laptop with integrated and dedicated GPUs. – unfa May 05 '21 at 14:54
-
Just type nvidia-smi
in the terminal. Then check for the percentage of usage. That will indicate which GPU is in use.

- 22,803

- 51
Which OS are you using? If you use lspci on most linux machines you get a list of your pci devices, just grep for graphics devices and it should pop up both of them. After that just check out the config on each of them, you should see details of up/on/active or something to that nature.

- 354
nvidia-smi
is very useful, but at times I've found that it doesn't always include everything. It seems when processes crash they aren't always listed.
sudo lsof /dev/nvidia*
has always worked for me. It will also work without sudo
, but will only show processes owned by you. If you are working on a multiuser machine or are using docker, you will probably get better results with sudo
.
If you see a discrepancy between the 2 commands, you may want to consider kill
ing the extra processes found with lsof
.

- 153
- 1
- 6
I found another method, just in case anyone needs to detect the model of your NVIDIA graphics card and the recommended driver.
ubuntu-drivers devices
I got this from here: https://linuxconfig.org/how-to-install-the-nvidia-drivers-on-ubuntu-20-04-focal-fossa-linux

- 121
VGA controller
at the end? – naught101 Nov 11 '14 at 05:38