简体   繁体   English

CUDA Nsight调试焦点块未激活

[英]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: 使用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. 当我比较带有和不带有cuda的depthMap时,idx == 412295的值不匹配。

Since this idx is formed for column 135 and row 640 I try to lookup the value inside the kernel. 由于此idx是为第135列和第640行形成的,因此我尝试在内核内部查找该值。 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". 这将转换为Block(16,7)和Thread(80,0),但是当我尝试使用夜间调试焦点时,会收到以下消息:“ 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. Nsight VSE CUDA调试器是一个硬件调试器,这意味着它只能在停止执行时显示分配给SM的线程块的状态。 The error "Block not active" means that that block you are requesting is not currently allocated to a SM. 错误“块未激活”表示您所请求的块当前未分配给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. 如果要调试特定的块,我建议设置条件断点,其条件等于blockIdx和threadIdx。

In the Nsight Visual Studio Edition manual 在Nsight Visual Studio Edition手册中

  • Section Specify Debugger Context states "You can only choose blocks that are currently executing on the GPU hardware." 指定调试器上下文状态”部分说明“您只能选择当前在GPU硬件上执行的块”。
  • Section Set GPU Breakpoints subsection Conditional Breakpoints gives steps on how to add a conditional breakpoint for a specific thread. 设置GPU断点”小节“条件断点”小节提供了有关如何为特定线程添加条件断点的步骤。

For example you can add a conditional breakpoint with the expression 例如,您可以使用表达式添加条件断点

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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