Search code examples
ccudanvidiansight

How to see CUDA thread value using Nvidia NSight in VS 2010?


I would like to know is there a way to look at all the variable values in a given kernel, for example, for threadIdx.x = 1 on what data is it currently working and what's the value of that data?

All is working correctly, so my question is how to see variables like you can do in normal VS, using "Quick watch" or "Add watch", what is their equivalent in NSight? Thank you, have been struggling for a few hours now.

I have CUDA Info window and CUDA Warp window showing only blockIdx, threadIDx coordinates when debuging through NSight.

   __global__ void addKernel(int *c, const int *a, const int *b)
{
    int i = threadIdx.x;

    if(i<N)
        c[i]=a[i]*b[i];
    // DUmmy code
    if(i<2)
    int k=i;
}

My kernel is called like this addKernel<<<1,N>>>(dev_c,dev_a,dev_b)and my #DEFINE N 10.

I put breakpoints inside if and else. Output in Warp window is set to show:

*(a+i)  *(b+i)  *(c+i)  i

 0          0     -1     0
 2          1     -1     1
 4          4     -1     2
 6          9     -1     3
 8         16     -1     4

So, my c is never set up. How so? thank you

P.S. Can those guys that give me minuses give up always when they see my question I get -1. Thanks again


Solution

  • After adding some dummy lines to my kernel I was able to see value of column c updated. So, that was the solution. I know it sounds trivial , but I have try adding dummy lines before and it didn't work unless extra dummy lines are some other variable, not threads used in calculation of c. So, in short, calculate new threads(or whatever new can go in kernel) and add those extra lines after the variable you would like to see in CUDA Warp window.