I have a question regarding nvcc, specifically nvcc -g -G (to use with cuda-gdb).
I’m on redhat linux, I have set up Eclipse CDT to work with CUDA.
When I compile from eclipse, the build goes as:
Building file: …/log.cu
Invoking: CUDA NVCC Compiler
nvcc -c -o “cu_log.o” “…/log.cu” &&
echo -n ‘cu_log.d’ ./ > ‘cu_log.d’ &&
nvcc -M “…/log.cu” >> ‘cu_log.d’
Finished building: …/log.cu
Building target: CudaParameters
Invoking: C++ Linker
nvcc -L/usr/local/cuda/lib64 -Xlinker -rpath -Xlinker /usr/local/cuda/lib64 -o “CudaParameters” ./InputArray.o ./cu_log.o -lcudart
Finished building target: CudaParameters
Once this is finished I can run the project.
But if I try to debug from a terminal with NVCC -g -G: this is what I get:
$ nvcc -g -G log.cu
/tmp/tmpxft_00003f42_00000000-13_log.o: In function
main': workspace/CudaParameters/log.cu:40: undefined reference to InputArray::InitiateArray(std::basic_fstream<char, std::char_traits >&)’
collect2: ld returned 1 exit status
I have successfully debugged the file before (compiled with NVCC -g -G). The difference is that I added a c++ file to the project. Now NVCC -g -G doesn’t work for me.
Are there other flags I should be putting in?