I have 2 GPU's in my netbook. How do I know which one I'm actually using at any given moment?
I've just gone through a hell of a time trying to get my discrete graphics to work in Ubuntu and answering this questions was constantly a challenge, since the lspci method mentioned earlier can sometimes say that both are
I think the following command should give you an indication of your active chip:
$ glxinfo|egrep "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. 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|egrep "OpenGL vendor|OpenGL renderer" OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce GT 555M/PCIe/SSE2
glxheads also tells you some useful information about which graphics card is in use (mostly repeats glxinfo in a more compact and easy to read form tho), and it gives you a nice rendering of a rotating triangle.
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 : Intel Corporation Core Processor Integrated Graphics Controller [8086:0046] (rev 02) (prog-if 00 [VGA controller]) 01:00.0 VGA compatible controller : NVIDIA Corporation GF108 [GeForce GT 540M] [10de:0df4] (rev ff) (prog-if ff)
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
On Ubuntu 15.10, after I installed
nvidia-352 and the GPU seems to work:
shows something like:
Note how it shows:
GPU 0 - (NVS 5400M)
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.
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
If you see a discrepancy between the 2 commands, you may want to consider
killing the extra processes found with
I found another method, just in case anyone needs to detect the model of your NVIDIA graphics card and the recommended driver.