Hi to everyone! I’m takeru and i’m a newbie on opencl and i’m trying to understand how can i transfer the content of an host variable to set another variable to the local memory on kernel.
This is an extract of the kernel:
#define LS 16
__kernel void matrix_mul(__global const int *A,
__global const int *B,
__global int *C,
int n, int k, int local_size
) {
…
__local int al[LS][LS];
__local int bl[LS][LS];
…
}
How can i set the variable “al” without use “LS”, that use “define” and use “local_size”?
Because i would to use the content of variable “local_size” and if I substitute “LS” with “local_size” i receive the error:
Error: failed to build program executable
<program source>:23:14: error: automatic variable qualified with an address space
__local int Al[local_size][local_size];
And this is the extract of the host code:
…
err = clSetKernelArg(kernel, 0, sizeof(cl_mem), (void *)&a_mem_obj);
err |= clSetKernelArg(kernel, 1, sizeof(cl_mem), (void *)&b_mem_obj);
err |= clSetKernelArg(kernel, 2, sizeof(cl_mem), (void *)&c_mem_obj);
err |= clSetKernelArg(kernel, 3, sizeof(int), (void *)&n);
err |= clSetKernelArg(kernel, 4, sizeof(int), (void *)&k);
err |= clSetKernelArg(kernel, 5, sizeof(int), (void *)&ls);
…
Can someone help me? Thanks a lot!