Hello,
I’m using OpenClTemplate passing vector variables through C# code, so there are some simple but unevident things about memory I cant understand.
-
How can I allocate a buffer? I can’t use clCreateBuffer() 'cause it asks for OpenCl context which simply isnt declaring in the kernel - so I don’t even know a context name. Moreover, OpenClTemplate Codechecker shows an error facing cl_mem type (which seems quite strange).
-
More obvious, maybe: is it possible to pass a variable directly to private memory either than such way:
kernel void MainKernel(global int *vector)
{
int vector2[10];
for (int i=0; i<10; i++)
{
vector2[i]=vector[i];
}
}
In other words, can I write something like… kernel void MainKernel(private int *vector)? (that’s not working, of course). 'Cause the problem with the loop approach is that vector size can change and vector2 size is defined before compilation - and so it returns to first question about memory allocation.
Thanks.