开发者

List of pointers in cuda?

__global__ void finalImageGathering(float3 *lists[]) {
    unsigned int x = blockIdx.x*blockDim.x + threadIdx.x;
    unsigned int y = blockIdx.y*blockDim.y + threadIdx.y;
    float3 test;
    for(int i = 0; i<Blah; i++)
        test += lists[i][y * width + x];
}

Is it possible to have a list of pointers to diffrent float3 lists, or开发者_开发技巧 do I need to do something else?


You can do that, CUDA imposes no special limits on pointer indirection for anything other than function pointers (and that limitation is mostly gone on recent hardware too). What is more complex is allocating the memory for such an array of device pointers, and copying it to and from host memory, if you need to.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜