Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __kernel void add(__constant float *a, __global float *answer)
- {
- const int id_x = (int)get_global_id(0);
- int i,j;
- float sum = 0;
- for(i = 0; i < 3; i++)
- {
- for(j = 0; j < 3; j++)
- {
- //This will not work
- sum += a[i+j];
- /*
- This will work:
- sum += a[j*i];
- So will this:
- sum += a[j];
- And this:
- sum += a[i];
- */
- }
- }
- //Write result
- answer[id_x] = sum;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement