is it possible to expand 2d array to 3d array using

this is originally from the

http://forums.nvidia.com/index.php?showtopic=60998

i have a question:
now i have define a three-dimensional array in CPU(use malloc funtion),i want to konw how to define a three-dimensional array in >GPU(device),and how to copy data from cpu(host) to GPU(device)?

my code to define a three-dimensional array(353535) on cpu as follow:

int d1=35, d2=35, d3=35; ///32768
int delta=(int)malloc(d1 * sizeof(int**));
for(int ii=0;ii<d1;ii++)
{
delta[ii]=(int**)malloc(d2 * sizeof(int*));
for(int j=0;j<d2;j++)
{
delta[ii][j]=(int*)malloc(d3*sizeof(int));
for(int k=0;k<d3;k++)
{
delta[ii][j][k]=1;
}
}
}

i’ve just finished a similar conversion of the above using 2d array by using pointer arrays.

http://forums.nvidia.com/index.php?showtopic=185852

i know its not efficient but theoretically can i do it?

if its doable, where should i be careful? any comments?

thanks in advance.

this is originally from the

http://forums.nvidia.com/index.php?showtopic=60998

i have a question:
now i have define a three-dimensional array in CPU(use malloc funtion),i want to konw how to define a three-dimensional array in >GPU(device),and how to copy data from cpu(host) to GPU(device)?

my code to define a three-dimensional array(353535) on cpu as follow:

int d1=35, d2=35, d3=35; ///32768
int delta=(int)malloc(d1 * sizeof(int**));
for(int ii=0;ii<d1;ii++)
{
delta[ii]=(int**)malloc(d2 * sizeof(int*));
for(int j=0;j<d2;j++)
{
delta[ii][j]=(int*)malloc(d3*sizeof(int));
for(int k=0;k<d3;k++)
{
delta[ii][j][k]=1;
}
}
}

i’ve just finished a similar conversion of the above using 2d array by using pointer arrays.

http://forums.nvidia.com/index.php?showtopic=185852

i know its not efficient but theoretically can i do it?

if its doable, where should i be careful? any comments?

thanks in advance.