hi all..
I'm passing in an array of structures, with the size of each structure to a kernel. The first member of the structure is a uint and i would like to be able to change only this member within the kernel. I've tried this:
typedef struct
{
unsigned int dataOfInterestToKernel;
char s[64] notOfInterestToKernel;
}AStruct;
AStruct data[40];
call clEnqueueNDRangeKernel with pointer to data[], sizeof(AStruct) using 40 threads.
__kernel void test(__global char *structData, uint structSz)
{
uint ndx = get_local_id(0);
uint* s = (uint*)(structData + ndx *structSz);
*s = ndx;
}
Unfortunately the kernel doesn't build:
error: invalid type conversion
uint* s = (uint*)(structData + ndx * structSz);
Is there a good way to do this? It is possible to do it in CUDA.