Problems in openGL with CUDA 10.1 graphical examples on Debian Buster, GTX 1050 Ti, Dell laptop G3

Hi, folks!

I just installed CUDA Toolkit 10.1 on my Dell laptop, and I could run all examples, except the opengl graphic examples (in 2_Graphics). On simpleGL, I got:

./simpleGL
simpleGL (VBO) starting…

GPU Device 0: “GeForce GTX 1050 Ti” with compute capability 6.1

CUDA error at simpleGL.cu:433 code=999(cudaErrorUnknown) “cudaGraphicsGLRegisterBuffer(vbo_res, *vbo, vbo_res_flags)”
CUDA error at simpleGL.cu:445 code=400(cudaErrorInvalidResourceHandle) “cudaGraphicsUnregisterResource(vbo_res)”

And all examples return similar error (cudaGraphicsGLRegisterBuffer).

lspci gives:

lspci |grep VGA
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (Mobile)

nvidia-smi gives:
Wed Oct 23 19:37:06 2019
±----------------------------------------------------------------------------+
| NVIDIA-SMI 418.87.00 Driver Version: 418.87.00 CUDA Version: 10.1 |
|-------------------------------±---------------------±---------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 105… Off | 00000000:01:00.0 Off | N/A |
| N/A 42C P8 N/A / N/A | 0MiB / 4040MiB | 0% Default |
±------------------------------±---------------------±---------------------+

±----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| No running processes found |
±----------------------------------------------------------------------------+

lsmod |grep nvidia gives:

nvidia_uvm 929792 0
nvidia 18235392 19 nvidia_uvm
ipmi_msghandler 65536 2 ipmi_devintf,nvidia

glxinfo |grep OpenGL gives:

OpenGL vendor string: VMware, Inc.
OpenGL renderer string: llvmpipe (LLVM 7.0, 256 bits)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 18.3.6
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.1 Mesa 18.3.6
OpenGL shading language version string: 1.40
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 18.3.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:

I have just one GPU a Geforce GTX 1050 Ti, and I need to run those examples in order to do my research in CUDA.

Thanks in advance.

Isaias.

Are you running the latest version of Debian Buster 10.1 because I’m thinking this might be a library dependency issue.

Hi!

Yes, I’m running the latest stable version.

Here is my sources.list:

cat /etc/apt/sources.list

deb cdrom:[Debian GNU/Linux 10.1.0 Buster - Official amd64 NETINST 20190908-01:07]/ buster main

deb cdrom:[Debian GNU/Linux 10.1.0 Buster - Official amd64 NETINST 20190908-01:07]/ buster main

deb Index of /debian buster main contrib non-free
deb-src Index of /debian buster main contrib non-free

deb Index of /debian-security buster/updates main contrib non-free
deb-src Index of /debian-security buster/updates main contrib non-free

buster-updates, previously known as ‘volatile’

deb Index of /debian buster-updates main contrib non-free
deb-src Index of /debian buster-updates main contrib non-free

Virtualbox

deb Index of /debian buster-proposed-updates non-free main contrib
deb Index of http://download.virtualbox.org/virtualbox/debian buster contrib

Hi, mikeroyal!

Do I need to upgrade to Debian testing?

Thanks!

Isaias

Hi, mikeroyal!

I’ve changed the sources and I’ve upgraded some packages, but nothing changed. Here is my sources.list:

#------------------------------------------------------------------------------#

OFFICIAL DEBIAN REPOS

#------------------------------------------------------------------------------#

Debian Main Repos

deb Index of /debian testing main contrib non-free
deb-src Index of /debian testing main contrib non-free

deb Index of /debian testing-updates main contrib non-free
deb-src Index of /debian testing-updates main contrib non-free

deb Index of /debian-security testing-security main
deb-src Index of /debian-security testing-security main

#------------------------------------------------------------------------------#

UNOFFICIAL REPOS

#------------------------------------------------------------------------------#

3rd Party Binary Repos

###Debian Multimedia
deb [arch=amd64,i386] http://www.deb-multimedia.org bullseye main non-free

###Ghostwriter
deb Index of /wereturtle/ppa/ubuntu bionic main
deb-src Index of /wereturtle/ppa/ubuntu bionic main

###Google Chrome Browser
deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main

###Open Shot
deb Index of /openshot.developers/ppa/ubuntu bionic main

deb-src Index of /openshot.developers/ppa/ubuntu bionic main

###Pantheon Desktop
deb [arch=amd64] http://gandalfn.ovh/debian testing-daily main contrib

###Paper GTK Theme
deb Index of /snwh/pulp/ubuntu bionic main
deb-src Index of /snwh/pulp/ubuntu bionic main

###Papirus GTK Theme
deb Index of /papirus/papirus/ubuntu bionic main
deb-src Index of /papirus/papirus/ubuntu bionic main

###Sublime Text
deb https://download.sublimetext.com/ apt/stable/

###Visual Studio Code
deb [arch=amd64] Index of /repos/vscode/ stable main

Virtualbox

deb Index of /debian buster-proposed-updates non-free main contrib
deb Index of http://download.virtualbox.org/virtualbox/debian buster contrib

Any ideas?

Is there any Nvidia Moderator here to help?

Hi, can anyone help?

Since you’re on a Dell laptop, this might apply

From: https://devtalk.nvidia.com/default/topic/1038755/cuda-setup-and-installation/cudaerrorunknown-cudagraphicsglregisterbuffer/post/5277676/#5277676
[i]This often comes about because the OpenGL context is created on a non-NVIDIA GPU (e.g. an intel iGPU).
…if you have any non-NVIDIA GPUs, and I don’t know if your OpenGL context is getting created on a non-NVIDIA GPU.

The CUDA/OpenGL interop sample codes require that the OpenGL context and the CUDA context get created on the same NVIDIA GPU[/i]

If this is your problem, you can control how your application is selecting the GPUs as described here: https://docs.nvidia.com/nsight-graphics/InstallationGuide/index.html#Setup_Hybrid_Mode
Sorry, I see there’s no linux version, but here’s a few (untested) links related to Hybrid mode (and the older Optimus mode)

  • https://www.linuxbabe.com/desktop-linux/switch-intel-nvidia-graphics-card-ubuntu
  • https://www.nvidia.com/en-us/geforce/forums/discover/111403/linux-and-hybrid-graphics-no-optimus-support-sad-but-true-but-/
  • https://www.reddit.com/r/linux_gaming/comments/aoh5be/guide_hybrid_graphics_on_linux_nvidia_optimus/

Also, check for incompatible nouveau drivers

lsmod | grep nouveau

As a side note (not likely your issue), NVIDIA is recommending using NVIDIA Nsight Graphics https://developer.nvidia.com/nsight-graphics

You have an intel graphics device that acts (usually) as the primary graphics adapter for your Optimus laptop. It’s typical for the OpenGL context to be created on that adapter, and in that case any sample code that uses cuda-graphics interop won’t work

Depending on the design of your laptop, it may or may not be possible to get the NVIDIA dGPU to fully take over the graphics tasks so that the OpenGL context gets created on the NVIDIA GPU. You may wish to study system BIOS setting on your laptop to see if there are high-performance graphics modes that you can enable. You may also wish to investigate the use of the nvidia-prime utility. If you install the nvidia-prime utility, you may then be able to do sudo prime-select nvidia to get the nvidia GPU to become the primary adapter.

I won’t be able to give detailed instructions to perform these steps, however there are many writeups on the web that you can refer to. Optimus laptop hardware designs vary, so a particular set of instructions may or may not have the desired effect on your laptop.

On windows, the general recommendation is to use an optimus profile to control the graphics behavior on an app-by-app basis, and this is documented elsewhere as well.