378.13/Kubuntu - I can not use CUDA if intel is selected in Prime from nvidia-settings

GTX 960, 378.13 driver.
HD4000 (i7 3770)
K Ubuntu 16.04

Well, this is a recurring problem. With different versions of Kubuntu/nvidia drivers, sometimes it has worked for me, and sometimes it does not work.

The thing is, I allways have CUDA available in Blender 3D if I have selected ‘nvidia’ in Prime from nvidia-settings GUI. So please bear this in mind: CUDA “works fine” with nvidia as the primary display.
But if I select ‘intel’, I stop having CUDA available in Blender 3D.

These are the packages installed from PPA:
https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa

$ sudo dpkg -l | grep -i nvidia
ii bbswitch-dkms 0.8-3ubuntu1 amd64 Interface for toggling the power on NVIDIA Optimus video cards
ii libcuda1-378 378.13-0ubuntu0~gpu16.04.3 amd64 NVIDIA CUDA runtime library
ii libcuinj64-7.5:amd64 7.5.18-0ubuntu1 amd64 NVIDIA CUINJ Library (64-bit)
ii nvidia-378 378.13-0ubuntu0~gpu16.04.3 amd64 NVIDIA binary driver - version 378.13
ii nvidia-modprobe 361.28-1 amd64 utility to load NVIDIA kernel modules and create device nodes
rc nvidia-opencl-icd-367 367.44-0ubuntu0~gpu16.04.1 amd64 NVIDIA OpenCL ICD
rc nvidia-opencl-icd-370 370.28-0ubuntu0~gpu16.04.1 amd64 NVIDIA OpenCL ICD
ii nvidia-opencl-icd-378 378.13-0ubuntu0~gpu16.04.3 amd64 NVIDIA OpenCL ICD
ii nvidia-prime 0.8.2 amd64 Tools to enable NVIDIA’s Prime
ii nvidia-profiler 7.5.18-0ubuntu1 amd64 NVIDIA Profiler for CUDA and OpenCL
ii nvidia-settings 378.13-0ubuntu0~gpu14.04.1 amd64 Tool for configuring the NVIDIA graphics driver

And please, do not ask me to install the very unfriendly .run file. Every time I tried to do it I ended up breaking my system.

So, any solution that works long term for this recurring problem?

Perhaps this is useful for developers:
The last drivers from Ubuntu 16.04 official repositories that I have been able to make this works, are the 361.42.
In 367.57 this does not work (this=have CUDA available when intel iGPU is primary display). This also does not work with any new PPA drivers.

Did you test with latest 375.39 and 378.13 driver from PPA or .run ?

Hi.
I had explained that you asked above, maybe my bad English.

Ubuntu 16.04 official repository have 361.42 and 367.57 drivers. Regarding having CUDA available in Blender 3D when “intel” is selected in Prime from nvidia-settings:

361.42 > it works
367.57 > this does not work

From PPA I have tried with any 37x.xx driver and it does not work.

Then 361.42 is the last known driver that worked. What changed from that version to newer drivers?

Regarding .run file, I wrote about it in the message above. I am not going to break my system one more time trying to install the very unfriendly .run file that you provide.

Did you also reported this issue to Ubuntu or Blender support/developer? Did they pointed to nvidia driver?