【发布时间】:2011-10-15 20:26:49
【问题描述】:
我想使用 3D 网格进行 cuda 计算。此页面 [1] 或此答案 [2] 说我可以为此使用三个维度,但查询我的设备属性会得到以下信息:
--- General Information for device 0 ---
Name: Quadro 4000
Compute capability: 2.0
Clock rate: 950000
Device copy overlap: Enabled
Kernel execution timeout : Enabled
--- Memory Information for device 0 ---
Total global mem: 2146631680
Total constant Mem: 65536
Max mem pitch: 2147483647
Texture Alignment: 512
--- MP Information for device 0 ---
Multiprocessor count: 8
Shared mem per mp: 49152
Registers per mp: 32768
Threads in warp: 32
Max threads per block: 1024
Max thread dimensions: (1024, 1024, 64)
Max grid dimensions: (65535, 65535, 1)
如果我尝试在我的代码中使用 3D 网格,则没有任何反应:
__global__ void updateBuffer( ... )
{
int x = blockIdx.x;
int y = blockIdx.y;
int z = threadIdx.x;
int offset =
x +
y * width +
z * width * height;
buffer[offset] = ...;
}
__global__ void updateBuffer2( ... )
{
int x = blockIdx.x;
int y = blockIdx.y;
int z = blockIdx.z;
int offset =
x +
y * width +
z * width * height;
buffer[offset] = ...;
}
void callKerner() {
dim3 blocks(extW,extH,1);
dim3 threads(extD,1,1);
dim3 blocks2(extW,extH,extD);
dim3 threads2(1,1,1);
updateBuffer<<<blocks,threads>>>( ... ); // works fine
updateBuffer2<<<blocks2,threads2>>>( ... ); // nothing happens
}
那么是不是 3d 网格不适用于某些卡片?
[1]http://en.wikipedia.org/wiki/CUDA#Version_features_and_specifications [2]Maximum blocks per grid:CUDA
【问题讨论】:
-
如果我提到我使用 cuda v3.0 可能会有所帮助
标签: cuda