I have a vector in my kernel, and I need to sum up all of its members.
Is there a function or at least best way to sum it up? I am doing the following right now but I wondered if there was a better way that I am not finding in the builtin functions.
float8 t = (float8)0;
// ... code to get a bunch of results into the vector members ...
// Horizontal add
t.s0 += t.s1;
t.s2 += t.s3;
t.s4 += t.s5;
t.s6 += t.s7;
t.s0 += t.s2;
t.s4 += t.s6;
t.s0 += t.s4;
Is there a better way to perform the "horizontal add" part?
Thanks
uh...
t.s0123 += t.s4567;
t.s01 += t.s23;
t.s0 += t.s1;
probably :-)