On-demand mode doesn't use integrated gpu and is same as nvidia

My browsing experience is choppy when using Nvidia as my main GPU (940m) and my cpu overheats to 70°c - 80°c. (I don’t understand why? Is it because GPU is creating more heat which then gets dispersed over motherboard? Or is some work being overflowed to CPU? Or is GPU redirecting all the work to CPU?)

I can use on-board GPU (HD Graphics 520), and get a much smoother & quieter experience without overheating. Only issue is I lose access to Nvidia for computing purposes.

I installed nvidia-prime and now I have a 3rd mode called “on-demand”, but when I activate it & reset, it goes back to rendering everything on Nvidia, which is not what I wanted - I wanted everything to render on Intel and having the option to run computation-heavy stuff on Nvidia.

I followed this and managed to render my main stuff on Intel and still have Nvidia running (e.g. I can now run nvidia-smi) but I can’t run programs on Nvidia:

$ env __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxgears
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  155 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  25
  Current serial number in output stream:  26

However with this setup torch and tensorflow do recognize the GPU, but I still can’t run programs on GPU.

Ubuntu 18.04
Nvidia 410.79

Help appreciated!

Driver 410 is outdated and doesn’t support render offload. Please install a current 510 driver.

Good sir, updating to 510 has broken my system. I can’t boot into desktop environment anymore, stuck at starting UID 124 and stopping it and on…

I can’t revert back to 410 either , apt can’t find the package.

Please help

Please boot to recovery mode and create a new nvidia-bug-report.log