I have a CUDA C/C++ application that I wrote for an RTX2060, which I am now debugging. The first step that I took was to run the executable with compute-sanitizer
, and discovered there were some out-of-bounds accesses occurring. Essentially, a very similar issue to the one happening in this thread: Unspecified launch failure on Memcpy. Here is what one looks like:
Starting iteration 0
Evolving fluid interior and boundary
========= Invalid __global__ read of size 4 bytes
========= at FluidAdvance(float *, float *, float *, float *, float *, float *, float *, float *, const float *, const float *, const float *, const float *, const float *, const float *, const float *, const float *, float *, float *, float *, float *, float *, float *, float *, float *, float, float, float, float, float, int, int, int)+0xfc50
========= by thread (0,2,0) in block (0,0,0)
========= Address 0x74fafcffc110 is out of bounds
========= and is 16,112 bytes before the nearest allocation at 0x74fafd000000 of size 1,048,576 bytes
========= Saved host backtrace up to driver entry point at kernel launch time
Using my novice understanding of CMake I had a working build system functioning, and in order to determine where the out of bounds accesses are occurring, I added the following line to CMakeLists.txt
:
target_compile_options(imhd-debug PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:
-v
-g
-lineinfo
>)
However, when I rebuild the project, and run compute-sanitizer
, I do not find any information added to the output that indicates the lines in the source where the errors are occurring.
Why is this, and what do I need to do to fix it? Thank you for any help.
EDIT: Question is solved! imhd-debug
represented the main executable, but the function where the out of bounds access was occurring is defined in a different library that I needed to add a target_compile_options( ... -lineinfo)
for. After doing this, I found the line information that I needed! :)
EDIT: Question is solved! imhd-debug
represented the main executable, but the function where the out of bounds access was occurring is defined in a different library that I needed to add a target_compile_options( ... -lineinfo)
for. After doing this, I found the line information that I needed! :)