开发者

crashing error in cudaGraphicsUnregisterResource

I use the following code to clean up CUDA's use of a pair of pbos in preparation to recreate them at 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 a resize operation of my window, this code is called in a draw operation while the window is redrawn at a new size. Sometimes, the call to unregister m_cuda_pbo_resource fails and the program terminates. This seems to have a higher chance of happening when the window is continuously being resized by the u开发者_StackOverflow社区ser as fast as possible. Because it doesn't happen all the time, it may be some sort of race condition, but I have run out of ideas of ways to try to debug it.


You could be freeing the buffers while a kernel is running. Try sticking a

   cudaThreadSynchronize();

Right before that block of code.


Are you sure you are not trying to delete the buffer twice ?

How does it fails ? Error code ? Does your application have multiple threads ?

Does your application handle the case of resizing the PBO when the user resize the window ?

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜