When one types make dbg=1 in the :~/NVIDIA_GPU_Computing_SDK/C$ it will of course compile the CUDA examples and allow one to
run cuda-gdb on the executable to walk through the program’s code. However, how does one get to all of the source code programs? For example matrixMul
has several programs that provide source code to the executable. They are
I want to walk through the code in matrixMul_kernel.cu (which has the subprogram matrixMul) it truly is the most interesting part of the program for me. But when I compile as decribed above and then issue the commmand;
cuda-gdb matrixMul
everything is fine. When I issue the command break matrixMul (the program in matrixMul.cu) I get :
(cuda-gdb) break matrixMul
Function “matrixMul” not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (matrixMul) pending.
Now the idea is to get to the matrixMul subprogram (it is awkward that the subprogram and the main program’s computer file have the same name:matrixMul).
First, it puts a conditional on this break point (I answer yes) and an when I run the program it goes to the end not stopping in matrixMul.
(cuda-gdb) run
Starting program: /home/errol/NVIDIA_GPU_Computing_SDK/C/bin/linux/debug/matrixMul
[Thread debugging using libthread_db enabled]
[New process 27468]
[New Thread 140314278946560 (LWP 27468)]
Processing time: 1.270000 (ms)
Test PASSED
Press ENTER to exit…
How do I stop at matrixMul in matrixMul_kernel.cu so I can walk through the code?
All I can think of is that the CUDA program source is in a separate computer file and that may be a reason it skips over the source.
What is happening here?
Of course, I shut down Xwindows before starting this debugging session. It just does not stop at matrixMul which is a CUDA program.
The debugger is telling you that it can’t find matrixMul, because the SDK debug builds don’t contain GPU kernel debugging symbols. If you do this
[avid@n0007 matrixMul]$ nvcc -g -G -I../../common/inc -L../../lib -o matrixMul matrixMul.cu matrixMul_gold.cpp -lcutil
[avid@n0007 matrixMul]$ cuda-gdb matrixMul
NVIDIA (R) CUDA Debugger
BETA release
Portions Copyright (C) 2008,2009 NVIDIA Corporation
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu"...
Using host libthread_db library "/lib64/libthread_db.so.1".
(cuda-gdb) list matrixMul
34 ////////////////////////////////////////////////////////////////////////////////
35 __global__ void
36 matrixMul( float* C, float* A, float* B, int wA, int wB)
37 {
38 // Block index
39 int bx = blockIdx.x;
40 int by = blockIdx.y;
41
42 // Thread index
43 int tx = threadIdx.x;
(cuda-gdb)
it will work. If you modify the common.inc so that NVCC adds the necessary symbols, then you can debug in cuda-gdb to you hearts content.
gcc: warning: ‘-x c++’ after last input file has no effect
gcc: no input files
I know that matrixMul.cu is there since I typed on the command line, but it says “No such file or directory” so what is going on? It also says “gcc: no input files”, but of course they are typed in on the command line. This is the exact command that you have shown above. But my CUDA 64 bit compiler does not like it.
I honestly have no idea. The compiler is telling you it can’t find the source files. Are you really sure they are in the same directory where you are trying to run the compile command?
I am sorry about the last message. I did not check my source one of my files matrixMu.cu was accidentally renamed matrixMu.cu~. Which of course explains the inability of the compiler to find
matrixMul.cu
It actually was not there since the filed had been renamed.
When I type it now it says that it cannot find lcutil. That is highly possible.
cutil is the SDK utility library, and it should be in NVIDIA_GPU_Computing_SDK/C/lib. If it isn’t then you need to run make in the NVIDIA_GPU_Computing_SDK/C/common directory.
In this command that I was given about a month ago. What does the last term “-lcutil” do or mean? I guess it has something to do with the cutil library, but that is called in the header file cutil_inline.h. At the very end of that file (which is included in the source code for the program) cutil_inline.h is called and it calls cutil. h which should take care of cutil.h or does it? I agree that the command which I restated at the beginnnig of this reply works. I mean you must include -lcutil or the compiler will give you an error.