How to use a three-dimensional array in the OpenCL core?

I am new to OpenCL. I worked with the OpenCL core with 1-D data. But when I tried to pass a three-dimensional pointer, he was unable to build a kernel. To be specific, I get CL_BUILD_PROGRAM_FAILURE . Here's the pseudo code for the kernel I'm trying to build -

__kernel void 3D_Test(__global float ***array)
{

x = get_global_id(0);
y = get_global_id(1);
z = get_global_id(2);

array[x][y][z] = 10.0;

}

Can someone give me an idea of ​​what is wrong with the code? Thanks in advance!

+5
source share
2 answers

OpenCL C ( ), 3D- , (sizeX * sizeY * sizeZ) :

int index = x + y * sizeX + z * sizeX * sizeY;

- clCreateImage3D

+5

- ...

?

0

All Articles