Cannot use HW acceleration on Optimus laptop (Xubuntu 18.04)

Hello,

I have an Asus laptop with a dual graphics card, the integrated graphics chip from Intel and a NVidia GeForce GT 720M. It has dual boot with Windows 8.1 and Xubuntu 18.04. I am trying to install CUDA on the Xubuntu partition so that I can use applications such as TensorFlow (though I’m not sure whether my card will support it).

A previous attempt with installing package cuda-10-0 from the additional CUDA repositories led to unsatisfying results, with screen freezing and keyboard unresponsive (even after uninstalling the packages) leading me to reinstall the OS from start.

I then wanted to properly install the proprietary NVidia drivers first. So I blacklisted the “nouveau” kernel, masked the gpu-manager service and installed nvidia-340 from the official Ubuntu repositories (as this was the one recommended by “ubuntu-drivers”)

The graphics initialize properly but so far I haven’t been able to make the hardware 3D acceleration work.

A call to “glxinfo” simply gives the following output:

Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Error: couldn't find RGB GLX visual or fbconfig
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".

Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".
Xlib:  extension "GLX" missing on display ":0.0".

“nvidia-settings” provides few settings, and I see this message on the terminal output:

** Message: 20:51:53.176: PRIME: No offloading required. Abort
** Message: 20:51:53.176: PRIME: is it supported? no

Even though “nvidia” is selected according to prime-select:

$ prime-select query
nvidia

Finally, in /var/log/Xorg.0.log I see these logs:

[    28.463] (II) UnloadModule: "nvidia"
[    28.463] (II) Unloading nvidia
[    28.463] (EE) Failed to load module "nvidia" (module doesn't support this OS, 0)

You can find the full bug report as an attachment:
nvidia-bug-report.log.gz (61.6 KB)

Please install the 390 driver from repo, this is the correct and maximum driver version for your hardware: sudo apt install nvidia-driver-390
Since you have an Optimus notebook, you need the gpumanager, so please remove the kernel parameter nogpumanager
Since 390 is the maximum driver, you can have max. cuda 9.1. Installation:

  • download the cuda .deb
  • add the repo to your system (first three steps from install instructions on download page)
  • don’t install cuda
  • instead, run sudo apt install cuda-toolkit-9-1

Thanks a lot, generix! The “nogpumanager” I got it from a tutorial but it made sense to me, so I didn’t think the problem would be from there.

Now “glxgears” launches properly, and it does seem that the NVidia card is used:

$ glxinfo | grep -i vendor
server glx vendor string: NVIDIA Corporation
client glx vendor string: NVIDIA Corporation
OpenGL vendor string: NVIDIA Corporation

I only have a few issues, like screen tearing and the touchpad having random hiccups from time to time, but these are minor issues to me (I suspect the touchpad problem is caused by the update to Hardware Enablement)

As for CUDA 9.1 however, it seems it is only available for Ubuntu 16.04 and 17.04. Is it still compatible?

To get rid of tearing, you have to enable prime sync using the kernel parameter
nvidia-drm.modeset=1
If you install just cuda-toolkit-9-1, you should be able to use the 17.10 package.

Thanks! I’ve successfully installed CUDA toolkit package for 16.04, and I can compile the samples, provided I use g++6 instead of the g++7 installed by default on Ubuntu.

Running the samples I get errors like

: (48) no kernel image is available for execution on the device.

The compute capability of my graphics card is 2.1. According to this thread:
https://devtalk.nvidia.com/default/topic/1027262/cuda-setup-and-installation/no-kernel-image-available-for-execution-on-the-device-/
it seems my card is simply too old to support CUDA9. I wish the CUDA installation could somehow warn you about this. Ah well. At least I have tried, and now I have proper 3D acceleration.

Thanks for your quick replies!

Yes, sorry, missed that. cc 2.x was last supported with cuda 8.