cudaErrorUnknown / cudaGraphicsGLRegisterBuffer


related topics are:

I have a desktop PC w/ AM4 board an 2560x1440 monitor connected via HDMI. I have a Fedora 27 runfile CUDA installation and get the error mentioned in the subject preventing to run the samples.

Any ideas?

Thank you!

This often comes about because the OpenGL context is created on a non-NVIDIA GPU (e.g. an intel iGPU). I don’t know if that is true in your case. I don’t know what a AM4 board is, I don’t know 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.

This seems like a repeat mostly of what is already covered in the first link in your question.

Sorry to have missed some crucial information that distinguishes the question from the other ones. The hardware is this:

AMD Ryzen 7 (AM4 chipset) and NIVIDIA GeForce GTX 1060

Cuda used to run on this hardware one year ago. I now installed Fedora 27, latest driver, then CUDA as recommended in and build the samples (contexts created on same NVIDIA GPU).

non-NVIDIA GPU is not an issue but I still get this error. Thank you!

How to query the OpenGL context?

In Fedora (see NVIDIA CUDA Installation Guide for Linux)

sudo dnf -y install freeglut-devel libX11-devel libXi-devel libXmu-devel
make mesa-libGLU-devel

installs and creates the OpenGL context?

Thank you!

You could just try googling “opengl context”

The openGL context is created by openGL calls in your program.

It’s not possible for me to say much without more information.

  1. Which CUDA version?
  2. What is the exact error output when you run the program?
  3. What is the output of:

lspci |grep -i vga

1.) OS & CUDA version

2.) exact error

[user@machine]$ ./fluidsGL
fluidsGL Starting…

NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.

GPU Device 0: “GeForce GTX 1060 6GB” with compute capability 6.1

CUDA device [GeForce GTX 1060 6GB] has 10 Multi-Processors
CUDA error at fluidsGL.cpp:472 code=30(cudaErrorUnknown) “cudaGraphicsGLRegisterBuffer(&cuda_vbo_resource, vbo, cudaGraphicsMapFlagsNone)”

3.) lspci |grep -i vga
1d:00.0 VGA compatible controller: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] (rev a1)

Thanks for looking into this problem!

cudaErrorUnknown is not the usual error you would get when the OpenGL context and the CUDA context are on different GPUs (and anyway you only seem to have 1 GPU in your setup). (the typical error would be something like “no devices available”)

Are you able to run other CUDA sample codes without issue (e.g. vectorAdd) ?

When you installed the 396.51 driver, did you say Yes or No to installing the OpenGL libs? Are you certain that the nouveau driver has been properly removed?

Are you currently running a X display on the GTX 1060 ?

Yes, I am able to run vectorAdd w/o any problems.

Yes, I am certain that nouveau is not running by using lsmod | grep nouveau. The driver does not ask that question, anyway all questions were answered “yes”.

I am not sure what is meant by running a X display. echo $XDG_SESSION_TYPE returns x11 and not wayland, if that is the question.

I could send the log file of the driver installation but do not know how to attach it. Thanks!

One solution is presented on

I advise against the advice to install the driver seperate to cuda - it leaves you w/ nouveau, try:

glxinfo | grep -i opengl

Hi everybody , I had the same problem and I resolved this unistalling all and install correctly . I made a blog on medium :