Monitoring nVidia GPU when intel iGPU as primary display

Hi, I’ve been able to set iGPU as the primary display and using CUDA with Blender:
[url]https://devtalk.nvidia.com/default/topic/580537/linux/intel-nvida-simultaneously-is-it-possible-for-linux-desktop-/post/4562082/#4562082[/url]

The thing is that I need to monitoring nVidia GPU resources and temperature, and I need to manage the fan speed of nVidia card with “Coolbits” enabled (the same way as when nvidia is the primary display).

I have not found how to do it. nvidia-settings does not show information and “nvidia-smi” seems not to work from the terminal.

Desktop PC, Kubuntu 15.04 64bits, GTX 960, 355.11 driver. i7 3770 HD 4000

So, Is not possible to monitor nVidia GPU when iGPU is the primary display?
Is this because it is not yet implemented? Or is there any limitation by which it can not be implemented?

Please, please … Could any developer to take this as a feature request?
If you have the iGPU as the primary display and you are working with heavy CUDA GPU Compute, you NEED to be able to monitor the temperature and control the fan speed with “Coolbits”.

Looks like I’ve reported a related issue:

https://devtalk.nvidia.com/default/topic/970144/linux/intel-for-display-nvidia-for-cuda-optimus-bug-/

What exactly happens when you run nvidia-smi?

Kubuntu 16.04 and 15.04, GTX 960, i7 3770 (HD 4000)

Hi aplattner.
First of all you note that I am trying to make this work many years ago (as you can see the link in the first post). Even this thread is a year old. So long ago I did tests and I’m trying again.

A note for Ubuntu/Kubuntu users: Drivers from PPA seem do not working with Prime/Optimus. I tried 367.44 and 370.28 from PPA and I do not have available CUDA on Blender if Intel is selected in Prime profiles in nvidia-settings GUI.
I do not know if it is because some change in those versions of drivers, or because PPA packages are built differently from official Ubuntu package from repositories.
So I installed 361.42 driver from Ubuntu repos in Kubuntu 16.04. Driver 352.63 also are working well in Kubuntu 15.04 (the part related to Blender and CUDA, not the part related to be able to monitor the temperature).
In Kubuntu 16.04 with 361.42 drivers when I switch to Intel in nvidia-settings it creates this bad xorg.conf.10072016 that make compositing effects not work in KWin:

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "intel"
EndSection

Section "Device"
    Identifier "intel"
    Driver "modesetting"
    BusID "PCI:0@0:2:0"
    Option "AccelMethod" "None"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1@0:0:0"
    Option "ConstrainCursor" "off"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration" "on"
    Option "IgnoreDisplayDevices" "CRT"
EndSection

If I replace this xorg.conf for this other I get in Kubuntu 15.04 with 352.63 driver, then compositing is back:

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "intel"
EndSection

Section "Device"
    Identifier "intel"
    Driver "intel"
    BusID "PCI:0@0:2:0"
    Option "AccelMethod" "SNA"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1@0:0:0"
    Option "ConstrainCursor" "off"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration" "on"
    Option "IgnoreDisplayDevices" "CRT"
EndSection

Anyway you will get CUDA available on Blender in both cases.

So now with intel selected for handling the display (selected from Prime Profiles in Nvidia Settings) and with CUDA abailable and working in Blender, this is what I get with nvidia-smi:

$ watch -n 1 nvidia-smi

Every 1,0s: nvidia-smi                                                                                                                                                       Fri Oct  7 12:30:21 2016

NVIDIA-SMI couldn't find libnvidia-ml.so library in your system. Please make sure that the NVIDIA Display Driver is properly installed and present in your system.
Please also try adding directory that contains libnvidia-ml.so to your system PATH.

Of course, nvidia-smi are working properly if GTX 960 is selected to handle the display.

It looks like your nvidia libs are not properly link to the system.

Did you install the nvidia drivers from Ubuntu or from nvidia servers?

Nvidia insall by default the drivers in classic directories and Ubuntu/debian in a custom directory, so…

Hi. From official Ubuntu repos. I think most of the time things in Ubuntu are installed in “/usr” folder. If you say this for that “libnvidia-ml.so” file, you can search it in Ubuntu packages website:
http://packages.ubuntu.com/search?searchon=contents&keywords=libnvidia-ml.so&mode=filename&suite=xenial&arch=any

Anyway as I said, nvidia-smi is working well when Nvidia is selected from PRIME profiles in nvidia settings. The problem is when you select Intel.

Ok, I didn’t understood you using Prime.

Ubuntu use is own modified nvidia-setting including a Prime switcher.
It store nvidia libs in /usr/lib//x86_64-linux-gnu, xorg module are managed by /etc/alternative, I think.

There could be some issues in Prime with the way ubuntu nvidia package is installed because libs are installed directly in the default libs directory like for a single card use.
I think it’s better to have a dedicate directory for nvidia libs to avoid system confusions when using Prime or Bumblebee.

Whith my nvidia-prime-select fork (very simple way for switching), I’ve no issue with nvidia-setting.
I don’t think this is a nvidia driver issue, but a nvidia-prime one.

If you really want to monitor your temp, it would be probably better to look for an other way to install your nvidia drivers.

@WildTux, hi.
All the times I had tried to install the very unfriendly nvidia .run file, I ended up ruining the graphical server. I do not feel confident in trying other methods of installation. That’s why I think nvidia people should be in touch with the driver package maintainers of the biggest mothers distributions (after all these distributions are 5 at most).
So I prefer that nvidia people study the problem. If they think it is not a problem with the driver, then they recommend me or give me some clue about what may be happening so I open a report in Launchpad to comment with Ubuntu people.

@Yafu, I was in the same dilemn as you are. that why I build a bash tool to manage and install nvidia drivers with many work arround to avoid .run package issues. That took a long time, but it’s more or less stable (i’ve no user reports). Normaly it’s fine for Ubuntu.
You can try it if you will. It will install Prime from my fork of fedora-prime and you could start the desktop with Nvidia only. The only issue is that my Prime fork works only with GDM for now, I didn’t have kdm to test.

I always thought to include CUDA thing in it. Maybe I could make this with you’re help.

I have still some thing to change and fix in it, but it should install and configure driver and Prime without real problems. Just report me in PM if it"s not.

I can now monitor the temperature with ‘unfa’ workaround here:
https://devtalk.nvidia.com/default/topic/970144/linux/intel-for-display-nvidia-for-cuda-optimus-bug-/

But still I do not find how to set the fan speed.

Ok, more or less like I said about /etc/alternative.

hi to all,
I found this old post because i am thinking to realize the same setup to be able to make useful my pc while mining (i’m using a 6700k with a gtx1060).
someone has tested the above workaround on ubuntu 16.04 with kernel 4.4 and nvidia driver 375? there are any issue? thanks in advice