crashing on mapping PBO

Hey everybody,

I’m running a cpp-cuda integration project, and everything compiles good, but when I’m running in debug mode it doesn’t work. (didn’t even try release :) )

I’ve tried using breakpoints and watching at the next code, but I don’t seem to get what’s wrong…

unsigned char *m_videoY = NULL;

GLuint PBOA = m_videoMemoryCUDA->getVideoTextureWrite(0);

CUDA_SAFE_CALL( cudaGLMapBufferObject((void**)&m_videoY, PBOA) );

Some helper codes in the class videoMemoryCUDA:

GLuint CVideoMemoryCUDA::getVideoTextureWrite(int index)    	


	return m_videoMemoryBuffer[m_write + index];	


And I evaluated using breakpoints the values, PBOA is having value 2, which means it’s the 2 generated PBO so far in the program. Also the PBO is registered in CUDA by

extern "C" void registerPBO(GLuint PBO)


	CUDA_SAFE_CALL( cudaGLRegisterBufferObject(PBO));


Any ideas, what’s wrong in this simple code?

I tried to get something out of CUDA_SAFE_CALL, but it writes to a file i think? I don’t know which file, and if i try to printf it, I can’t seem to get it compiled again…

Any other code you need, just ask

Thanks in advance and best regards

Hi Everybody,

This issue is closed for me. Although I wanted to ask something about it.
Question 1:
As for now I’ve moved the registering of the buffers into my displayloop. So they get registered when entering cuda and unregistered at exiting.
I’ve checked the forum and I only notice that this behaviour can happen if the buffer is relocated, but between each cuda part I only map the buffer to the CPU and read/put some data from/in it, and unmap it afterwards, the program only crashes after executing this loop 4 times.

Question 2:
Instead of using Buffers, I’ve noticed a big speedup when i keep the data on the cpu-memory, and do a cudamalloc/memcopyH2D. How can this be explained?

kind regards