Crash error in cudaGraphicsUnregisterResource

I use the following code to clear the CUDA usage of the pbos pair in preparation for re-creating them of a different size:

glFinish();
CUDA_SAFE_CALL(cudaGraphicsUnregisterResource(m_cuda_pbo_resource));
CUDA_SAFE_CALL(cudaGraphicsUnregisterResource(m_cuda_pbo_depth_resource));
glDeleteBuffersARB(1, &m_pbo);
glDeleteBuffersARB(1, &m_pbo_depth);

During the resize operation of my window, this code is called in the drawing operation when the window is redrawn with the new size. Sometimes a call to unregister m_cuda_pbo_resource fails and the program terminates. This is likely to have a higher chance that the window will be constantly changed by the user as quickly as possible. Since this does not happen all the time, it may be some kind of race condition, but I did not have enough ideas about how to debug it.

+3
source share
2 answers

You can free buffers while the kernel is running. Try to stick

   cudaThreadSynchronize();

.

+1

, ?

? ? ?

PBO ?

def on_resize( w, h):
    - lock_redraw
    - clean the PBO
    - reallocate the PBO of the new size
    - unlock redraw 
0

All Articles