question pointer in OpenCL kernel

Discussion created by shingoxlf on Oct 16, 2011
Latest reply on Oct 16, 2011 by antzrhere

Hi, I was trying to use pointer in test_kernel1 as in the code, however, it gives me an error in building the program



but if i change the cod to test_kernel2 , it works:


can anyone tell me why kernel1 doesn't work? It works in CUDA.


__kernel void test_kernel1(__global double *data) { int a = get_global_id(0); double *pt; pt = data+a; *pt += a+1; return; } __kernel void test_kernel2(__global double *data) { int a = get_global_id(0); double pt; pt = *(data+a); pt += a+1; *(data+1)=pt; return; }