1

I've compiled a simple CUDA project in VS10 (and it works), but strangely I cannot put a breakpoint or step-over some parts of the code, namely those involving Thrust call, not even host-side thrust. Having been through nvcc, with the debug keys specified: -D_NEXUS_DEBUG -g and -G0, the parts in question are invisible to F10 and breakpoints.

For example, in the function below, the step debug jumps only on the starred (easy) lines:

int thrust_test() {
thrust::host_vector<int> h_vec(1000);
thrust::generate(h_vec.begin(), h_vec.end(), rand);
*h_vec[0] = 1002;
thrust::device_vector<int> d_vec = h_vec;
*int h_res=-1;
h_res = thrust::reduce(h_vec.begin(), h_vec.end(), int(0), thrust::maximum<int>());
*int d_res=-1;
d_res = thrust::reduce(d_vec.begin(), d_vec.end(), int(0), thrust::maximum<int>());
*int prod=-1;
*prod = h_res*d_res;
return 0;

}

I can step in the Disassembly window and then go back to Source and Thrust source gets picked-up. But something is broken clearly.

Question 2: why in the build log below all the warnings are printed twice?

------ Configuration: Debug x64 ------
Compiling CUDA source file ..\..\..\src\cudamain.cu...
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe" -gencode=arch=compute_13,code=\"sm_13,compute_13\" --use-local-env --cl-version 2010 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64"  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include"  -G0  --keep-dir "x64\Debug" -maxrregcount=0  --machine 64 --compile  -D_NEXUS_DEBUG -g    -Xcompiler "/EHsc /nologo /Od /Zi  /MDd " -o "x64\Debug\cudamain.cu.obj" "cudamain.cu" 
cudamain.cu(21): warning : variable "prod" was set but never used
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include\thrust/functional.h(759): warning : type qualifier on return type is meaningless
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include\thrust/functional.h(759): warning : type qualifier on return type is meaningless
cudamain.cu(21): warning : variable "prod" was set but never used
rych
  • 682
  • 3
  • 10
  • 22
  • 1
    The warnings get printed twice because ```nvcc``` needs to run ```cudafe``` over the source code multiple times. – Jared Hoberock Oct 03 '11 at 05:45
  • Oh, thanks for that, I mean I'm glad to hear it's by design at least. When I don't specify -g and -G0, the warnings go away. And since I can't debug anyway, neither the GPU (without 2x GPUs and Nsight) nor the CPU, why would I want to have -g -G0?! – rych Oct 03 '11 at 23:34

0 Answers0