cuda-memcheck oddity -- reporting wrong source location for an invalid write! Line number report


so my cuda program is aborting with “Runtime API error 4: unspecified launch failure.” and I am using cuda-memcheck to debug it.

At first it was odd because of 4 different parameters that crash, cuda-memcheck does not find any issues. Then I found another set of parameters that do crash and where cuda-memcheck reports

When I check the line it seems odd that the crash would occur here, because it only references variables that are on the stack and not dynamically allocated.

Further debugging shows me that cuda-memcheck always reports the same line, even when I insert new debugging statements earlier in the code. That just doesn’t make sense to me though; I can clearly see that the program is the newly compiled version because I can see my debug output.

What am I doing wrong? Is cuda-memcheck really so inaccurate?


P.S. I am using cuda 4.0 on a geforce gtx 460 under Linux.

Since you are getting source line information from cuda-memcheck, I assume you did a full debug build (-g -G) of the code in question? As far as I know cuda-memcheck relies on the debug information generated by the compiler to determine a source line from the “crash PC”. It’s possible that the debug information could be incorrect, causing cuda-memcheck to report the wrong line number, or that there is some other issue causing an incorrect line number to be reported.

If you are certain that the line number reported by cuda-memcheck is incorrect, I would suggest filing a bug, attaching a small self-contained repro case (it sounds like you may have one in hand already), so the debugger team can have a look.

Thanks for the feedback.

While not huge, the program I have is probably not quite simple enough for a bug report. I will see if I can reduce it and still trigger the bug.