Multidimensional arrays in Kernels and jocl

I am trying to fill an array as a test of jocl using the following kernel but I am having a problem of not knowing how to setup the buffer such that I do not receive the following error
" subscripted value is not an array, pointer"

kernel void FillArray(global float2* arr,
            const int L,const int val) {

        //Get global position in Y direction
	int row = get_global_id(1);
	//Get global position in X direction
	int col   = get_global_id(0); 

        if (row >= L || col >= L) {

        arr[row][col]= val;

I tried using the following to setup the buffer

            CLBuffer<FloatBuffer> clBufferA = context.createFloatBuffer(globalWorkSize);

How does one setup a write buffer for the kernel so that one has a multidimensional array in the kernel.


This forum is about - it seems that you are using

But regardless of that: OpenCL does not know 2D arrays that can be accesed with something like
arr[row][col]= val;

In general instead of using 2D arrays, you are usually using 1D arrays and accessing them with
array[x+ysizeX] = …
sizeY+y] = …

Concerning the kernel itself, I’m also not sure what you intend to do: It looks like you’re trying to assign an ‘int’ value to a ‘float2’…?!

Thank you for the response. I realize there were to java bindings for openCL named jocl. I suppose I will access the arrays as you suggested.