c 中的DIM3类型是做什么用的?
c 中的DIM3类型是做什么用的?
源码如下:
// Kernel definition
__global__ void MatAdd(float A[N][N], float B[N][N], float C[N][N])
{
int i = threadIdx.x;
int j = threadIdx.y;
C[i][j] = A[i][j] + B[i][j];
}i
nt main() {
...
// Kernel invocation with one block of N * N * 1 threads
int numBlocks = 1;
dim3 threadsPerBlock(N, N);
MatAdd<<<numBlocks, threadsPerBlock>>>(A, B, C);
}
dim3 threadsPerBlock(N, N);中看的不是很明白 只知道是个类型定义
那位高手指点下。