Quantcast
Channel: Intel® Software - OpenCL*
Viewing all articles
Browse latest Browse all 1182

How to debug segfault in an OpenCL kernel?

$
0
0

My kernel works on AMD and NVIDIA OpenCL, but for some specific test, it fails on Intel ocl with i7-7700k. it threw a segfault and crashed.

I want to find out where in my code had caused the issue. I wish there are some debugging tools, like valgrind, to print out the offending lines. 

I installed oclgrind on my Ubuntu 16.04 box, for a small workload, it worked without any issue, no error was captured. but for large enough workload, oclgrind crashed too without printing anything useful related to my kernel! 

simulation run# 1 ...  /usr/bin/oclgrind: line 145:  7204 Killed                  LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH LD_PRELOAD=$LIBDIR/liboclgrind-rt.so "$@"

does Intel OCL sdk have any tool for this purpose? I don't have a windows machine installed with intel ocl, so a command line tool is preferred.

thanks

PS: if you are interested in testing, here is my code

git clone https://github.com/fangq/mcxcl.git
cd mcxcl/src
make
cd ../example/benchmark
../../bin/mcxcl -L
./run_benchmark2.sh -G ???

where ??? is an 01 string to select the CPU. for example, if the mcxcl -L command above lists 3 devices, the CPU is the 1st, you should use -G 1; if it is the 2nd, you should give -G 01, if it is the 3rd, use -G 001 and so on. You should see a segfault when running the last command.


Viewing all articles
Browse latest Browse all 1182

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>