Question


I'd like to know what is the best debugger for a JCuda project (if exists).
I know that for normal CUDA applications there are tools like cuda-gdb and cuda-memcheck and I wonder if I can use any of them or similar ones for a JCuda project.
Thank you!

Was it helpful?

Solution

You should be able to use regular CUDA debugger (e.g. Nsight or cuda-gdb) to debug the GPU code in your JCuda application. You can use Java debuggers (e.g. Eclipse) to debug Java code. There is no debugger that can seamlessly debug Java and CUDA code though.

OTHER TIPS

On Linux, you can use Nvidia Nsight (cuda-gdb).

To set up a debugging session that launches your executable:

  • launch Nsight as root (surprising, but necessary for me)
  • go to Run menu > Debug Configurations...
  • Right-click "C/C++ Application", choose New
  • Under Main tab
    • Set the executable (field C/C++ Application) to /usr/bin/java or whatever the correct path
  • Under Arguments tab
    • set the startup arguments, eg -jar target/MyApp.jar
    • set the working directory
  • Under Debugger tab
    • set the "CUDA GDB init file" path (see below)
    • set additional options, like enabling CUDA memcheck

Because Java uses segmentation faults internally for some too-clever purposes, you will need to create a file with the following GDB option and point to it as the "CUDA GDB init file". Note that by setting this option you won't be able to catch segmentation fault bugs inside your own JNI code. This shouldn't be a problem.

handle SIGSEGV nostop noprint pass

If you compile your kernels with debug symbols, you'll be able to debug them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top