I have this code in OpenCL:
__kernel void vector_add(__global float *C) {
int i = get_global_id(0);
float t =3.5f;
C[i] = t;
}
When I run in GPU the return in variable C is 3.5, so it's ok. But when I run in CPU the return is 3.0. This happen with any float value.
But if I run this code:
__kernel void vector_add(__global const float A, __global float *C) {
int i = get_global_id(0);
C[i] = A;
}
And I passed the 3.5 value to variable A, this run ok in CPU and GPU.
Why this happen?