Multiple calls to cudaGraphicsGLRegisterBuffer

Hi everybody,
i’m writing a program that reads data from an external .dat file and draws a 3d matrix allowing users to navigate along the three different axes x, y and z. I’m using three different Glut subwindows of a Glut main window to show the three views of the matrix and so i’m creating three different OpenGL buffers that contain vertex and color data (every buffer has the first half filled with vertex data and the second half filled with colors data) and three cudagraphicsresources to bind the buffers to. For each buffer i call glgenbuffers, glbindbuffer, glbufferdata and then cudaGraphicsGLRegisterBuffer, but when i launch the program i get:

CUDA error at Interop_test1.cu:692 code=6(the launch timed out and was terminated) "cudaGraphicsGLRegisterBuffer( &resource2, bufferObj2, cudaGraphicsMapFlagsNone )"

I’ve also a function that is run on the GPU and determines the max value of my dataset and when i launch the program with only one buffer i get 1.68 as maximum value, but when i use three buffers i get 1.55846e+38 as maximum value befor getting the error.
Do you know which can be the problem? I suppose i can’t call cudaGraphicsGLRegisterBuffer more than once, but i don’t know how to fix this.
Thanks a lot to everybody.

A “launch timed out and was terminated” error is frequently due to a CUDA kernel taking too long to run.

It’s possible this error has nothing to do wtih your usage of cudaGraphicsGLRegisterBuffer, that is simply the API call that happens to be reporting the error, which occurred asynchronously, previous to that particular API call.

You should inspect kernel launches prior to this call to determine their execution time. If any are more than about one second in duration, you should either:

  1. Reduce the duration of that kernel call, perhaps by dividing the kernel into a sequence of shorter-execution-time kernels
  2. Extend the display watchdog timeout.

For item 2 above, the exact methodology will depend on whether you are on windows or linux.

If on windows, take a look at this forum thread:

[url]https://devtalk.nvidia.com/default/topic/459869/cuda-programming-and-performance/-quot-display-driver-stopped-responding-and-has-recovered-quot-wddm-timeout-detection-and-recovery-/[/url]

If on linux, take a look at this help article:

[url]USING CUDA AND X | NVIDIA

Thank you! I suppose i will measure the execution time of my kernels in order to find which is the slowest and then i will try to edit them or to edit the xorg.conf file (i hope i will find it since i’m on Ubuntu 15.04!).
Thanks for your help, i’ll let you know.