Linux: seeking debugging ideas


I’d like to ask JCuda fellows how do they debug their JCuda applications on Linux boxes.



There are either not so many Linux user around here, or none of them has an idea about how to use the debugger. I’m personally mainly working on windows. But debugging CUDA may in any case be tedious. The most obvious difficulty is that stopping a CUDA program at a certain breakpoint blocks the Graphics card - so with less than 2 Graphics Cards, it will be a hassle, anyhow.

So I’m not familiar with Linux or the GDB, and thus can hardly give any specific hints for using the cuda-gdb. But in the best case, it might be possible to use the cuda-gdb in a similar way as the gdb. Did you, for example, try to run the respective JCuda program via a shell script? Something like
cuda-gdb shellScript
where the shell script contains the command to launch the JCuda program, like
java -cp “.:jcuda-0.4.0.jar” ProgramToDebug
At least on Windows, I had some success with running debugging- and profiling tools by passing them such a batch file instead of an executable (for example, the for JOCL) so it might be worth a try…

In any case, I’ve always been trying to do as much of the debugging as possible on Java side - for me, this meant writing static Java methods that have at least been “similar” to the real kernels, to get rid of null pointer or out-of-bounds-errors, and to have a basis for the real kernel. But of course, the possibilities are rather limited there.