Hello, in normal C programming we could define a 3D pointer such as int ***ptr so that we can access a 3D volume in format ptr[z][y]. Can we do this in CUDA? Looks like cudaMalloc3D function still malloc 1D linear memory block…may be I am wrong, please correct me :">
You can have n-D pointers in CUDA without a problem… But yeah , you need to allocate things just like you would do in the CPU…
For example:
int **x;
x = malloc(10*sizeof(int*));
for(i=0;i<10;i++)
x[i]= malloc(10*sizeof(int));
This is how u would do in CPU. U need to apply similar logic in GPU…