Hi zjin,
SYCL application debugging has also been addressed in other forum topics under the SYCL development category so you might wanna have a look, for example, here.
You can debug SYCL code with the standard tools you would use for debugging C++ but only on the host device.
- Make sure that you are compiling the application binary with the debug symbols by adding
-g
to your compilation command or if you are using CMake, specify the-DCMAKE_BUILD_TYPE=Debug
option. - Create a queue from a host device selector. e.g.,
cl::sycl::queue myQueue(cl::sycl::host_selector{});
- Run
gdb
and inspect the segfault-related frames from the backtrace. - I would also recommend running
valgrind
withmemcheck
to help detect the memory errors:
valgrind --leak-check=full --show-leak-kinds=all ./your-application
Lookup the memcheck-manual for more information that explains in details the memcheck
error messages.
Regards,
Georgi