how to debug mixed code (cuda and opencv)

Dear Cuda Developers,

I have a problem with debugging my code. I have a mixed code (openCV and cuda). I’m working with cuda 5.0 and a device with compute cap 3.0 and opencv 2.4.2. Furthermore I’m using Visual Studio 2010 and Nsight Monitor 2.2.0.
When I start to debug my code (using VS-debugger) everything seems to work quite well until it I’m reaching the level where I call functions from my cu-files. At this point I’m not able to debug any more, obviously.

When I’m using my the nsight-dubugger I’m getting the same error message (R6010- -abort()has been called) while doing my init part (where I’m mainly using some opencv calls to a allocate memory (GpuMat and CudaMem)). But of course I’m not ably to see that is happening exactly, because I not able to debug it.

Does someone else can give us an advice how to debug this kind of code, please?

Thank you very much for any hint in advance.

cheers Greg

By the way it isn’t a console application, but MFC. That’s way I’m not able to use printf.
Nevertheless, maybe there is a possibility to write messages to the Output Window out of cuda kernals, I don’t know about it?


I’m assuming that you have already gotten PDB symbols and compiled the library with debugging on, if not, these might help:

I would advise to de-couple your OpenCV from the CUDA part of your code if possible, assuming the affected/crashing function is an OpenCV one – that way you’ll be able to see if you still have crashes outside CUDA.

If others have any ideas, please comment :)