简体   繁体   中英

CUDA Nsight Debug Focus Block not active

Original code:

for (int row_idx = 0; row_idx < 1370-1; row_idx++){
   for (int col_idx = 0; col_idx < 644-1; col_idx++){
      register int idx = row_idx*644 + col_idx;
      //some calculations which involve setting d_depthMap[idx]=0;
   }
}

Parallised code using cuda:

dim3 threadsPerBlock(8,8);
dim3 numBlocks(644/threadsPerBlock.x, 1370/threadsPerBlock.y);
Kernel <<<numBlocks,threadsPerBlock>>>(d_depthMap, d_dcf, d_inp, d_wdt);

__global__ void Kernel(unsigned char *d_depthMap, float* dcf, cv::Point3f *inp){
    register int rowIdx = (blockIdx.x*blockDim.x)+threadIdx.x;
    register int colIdx = (blockIdx.y*blockDim.y)+threadIdx.y;
    register int idx = rowIdx * 644 + col_idx;

    if (rowIdx < 1369 && colIdx < 643){
       //some calculations which involve setting d_depthMap[idx]=0;
    }
}

When I compare the depthMap with and without cuda the values don't match for idx==412295.

Since this idx is formed for column 135 and row 640 I try to lookup the value inside the kernel. This translates to Block(16,7) and Thread (80,0) but when I try to use night debug focus I get the following message: "Block not active".

I wonder what that means? It seems as if that block doesn't exist but why wouldn't it?

在此处输入图片说明

The Nsight VSE CUDA Debugger is a hardware debugger which means that it can only show state for thread blocks that are allocated to SMs at the time you stop execution. The error "Block not active" means that that block you are requesting is not currently allocated to a SM.

If you want to debug a specific block I would recommend setting a conditional breakpoint with a condition equal to the blockIdx and threadIdx.

In the Nsight Visual Studio Edition manual

  • Section Specify Debugger Context states "You can only choose blocks that are currently executing on the GPU hardware."
  • Section Set GPU Breakpoints subsection Conditional Breakpoints gives steps on how to add a conditional breakpoint for a specific thread.

For example you can add a conditional breakpoint with the expression

@blockIdx(16,7,0) && @threadIdx(7,0,0)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM