我正在尝试使用NSight Visual Studio探查器分析以下内核:
__global__ void cuMultiplyMatricesStandard(float* A, float* B, float* C, int matrixSize)
{
int gridsPerMatrixX = (matrixSize + (blockDim.x*gridDim.x) - 1)/(blockDim.x*gridDim.x);
int gridsPerMatrixY = (matrixSize + (blockDim.y*gridDim.y) - 1)/(blockDim.y*gridDim.y);
for (int i = 0; i < (gridsPerMatrixX * gridsPerMatrixY); i++)
{
int row = (blockIdx.y * blockDim.y + threadIdx.y) + (i/gridsPerMatrixX)*gridDim.y*blockDim.y;
int col = (blockIdx.x * blockDim.x + threadIdx.x) + (i%gridsPerMatrixX)*gridDim.x*blockDim.x;
if (row >= matrixSize || col >= matrixSize) continue;
float Clocal = 0;
for (int k = 0; k < matrixSize; k++)
Clocal += A[row*matrixSize + k]*B[k*matrixSize + col];
C[row*matrixSize + col] = Clocal;
}
}
如果重要,则调用代码位于http://pastebin.com/kB7c7s9W下。
当我在没有分析的情况下在NSight调试器下运行应用程序时,它工作正常(“P”代表“通过”,“F”代表“失败”):
P P P P P P P
P P P P P P P
P P P P P P P
P P P P P P P
P P P P P P P
P P P P P P P
P P P P P P P
Press any key to continue . . .
当我尝试从“NSIGHT - &gt;启动性能分析”选项(使用任何实验配置)配置CUDA应用程序时,它崩溃了:
Nsight: Profiling CUDA Kernel cuMultiplyMatricesStandard on device [0] GeForce GTX 760
Nsight: Saving Pinned Host Memory 0 allocations 0.0 MB
Nsight: Saving Device Memory 3 allocations 0.0 MB
Nsight: Dependency Analysis ( 1/ 9):.
Nsight: Memory Global ( 2/ 9):
Nsight: Experiments complete, total replays needed: 1
CUDA ERROR IN LINE 83 OF FILE C:/Users/Maciej/Documents/Visual Studio 2012/Projects/CUDA-PR/CUDA-PR/Main.cu: unknown error (30)
CUDA ERROR IN LINE 86 OF FILE C:/Users/Maciej/Documents/Visual Studio 2012/Projects/CUDA-PR/CUDA-PR/Main.cu: unknown error (30)
F F F F F F F
F F F F F F F
F F F F F F F
F F F F F F F
F F F F F F F
F F F F F F F
F F F F F F F
Press any key to continue . . .
第83行是内核调用,第86行是后续的cudaMemcpy。然后,探查器抱怨没有注册任何内核启动,我没有得到任何数据。发生了什么事?
答案 0 :(得分:2)
Nsight 3.1在CUDA探查器依赖性分析实验中有一个错误,导致一些内核在下次重播时崩溃。更新到更新版本的Nsight可以解决问题。