cudaErrorUnknown / cudaGraphicsGLRegisterBuffer

Hi,

related topics are:

https://devtalk.nvidia.com/default/topic/935085/cuda-setup-and-installation/error-code-46-devices-unavailable-with-cuda-7-5-samples-on-windows-8-1/

https://devtalk.nvidia.com/default/topic/669272/error-while-executing-quot-particles-quot-/

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 https://devtalk.nvidia.com/default/topic/1036332/cuda-setup-and-installation/cuda-9-2-88-on-fedora-28-/ 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.

https://www.khronos.org/opengl/wiki/OpenGL_Context
https://www.khronos.org/opengl/wiki/Creating_an_OpenGL_Context_(WGL)

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
4.17.14-102.fc27.x86_64

NVIDIA-Linux-x86_64-396.51.run
cuda_9.2.148_396.37_linux.run
cuda_9.2.148.1_linux.run

2.) exact error
$HOME/Cuda/NVIDIA_CUDA-9.2_Samples/5_Simulations/fluidsGL

[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 https://devtalk.nvidia.com/default/topic/1035667/?offset=6#5278531

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 : https://medium.com/@nilcesarrojasvales/cuda-on-windows-the-definitive-guide-b4130b9fc419