jrprice / Oclgrind

An OpenCL device simulator and debugger
Other
346 stars 61 forks source link

Segfault on Linux. #150

Closed tuanpham91 closed 6 years ago

tuanpham91 commented 6 years ago

Hi if this is a duplicate, please remove.

I installed oclgrind with the command (sudo apt-get oclgrind..) and have clang-3.9. When I am trying to run my code i got this :

/usr/bin/oclgrind: line 145: 13792 Segmentation fault (core dumped) LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH LD_PRELOAD=$LIBDIR/liboclgrind-rt.so "$@"

My opencl program runs fine in my IDE.

Thanks.

jrprice commented 6 years ago

Does Oclgrind work with any other simple OpenCL codes? For example, does it work with clinfo (which can be installed via apt-get)?

tuanpham91 commented 6 years ago

I just tested with a simple OpenCL program and it worked. What do you mean by "does it work with clinfo" ? Anyway, is the problem caused by my program ?

jrprice commented 6 years ago

clinfo was just an example of a simple OpenCL program, but if you've tried another and it works then that is fine - I just wanted to check whether Oclgrind was completely broken or not.

Is your source code available somewhere for me to try and reproduce the crash? Failing that, are you able to provide a backtrace for the crash (from gdb for example)?

tuanpham91 commented 6 years ago

Hi, i cant provide you the code, only the stack trace. It shows nothing :

screenshot from 2018-04-25 17-06-30

tuanpham91 commented 6 years ago

Hi,

The problem was an array out of bound error in my program. If you dont mind, can you explain how should i read this error produced by oclgrind ? screenshot from 2018-04-25 23-43-07

What does "Entity" and the next line means ?

If you have a doc about that, please let me know.

Thanks and have a good day!

jrprice commented 6 years ago

The entity in this case is a work-item, so Oclgrind is showing you that the work-item with global ID (0,1,0) is reading memory that it shouldn't, from one of the arrays in global memory listed on the last line.

The %168 = load ... line is the SPIR/LLVM instruction that is being executed - this is usually only useful for people working at the compiler level so you can probably just ignore.

tuanpham91 commented 6 years ago

Thanks for your help !