Closed GoogleCodeExporter closed 8 years ago
Hi Vinitha, thanks for the report.
If you could post a complete, self-contained code sample which reproduces the
error, we'll be happy to look into it.
Original comment by jaredhoberock
on 18 Nov 2010 at 7:49
Hi Attaching the complete file. You just need to compile.
Original comment by vinitha....@gmail.com
on 18 Nov 2010 at 8:32
Attachments:
Hi , Do you find a problem in there????
Original comment by vinitha....@gmail.com
on 19 Nov 2010 at 1:47
Hi Vinitha,
Actually, this result is correct, although not intuitive. To parallelize scan
we require that the binary operation be associative. In this case the scan
function is computing the partial sums
P[0] = A[0];
P[1] = P[0] op A[1];
P[2] = P[1] op A[2];
...
P[5] = P[4] op A[5];
and
P[6] = A[6];
P[7] = P[6] op A[7];
P[8] = P[7] op A[8];
...
P[11] = P[10] op A[9];
By associativity the final values are then computed as
B[0] = P[0]
B[1] = P[1]
...
B[5] = P[5]
B[6] = P[5] + P[6]
B[7] = P[5] + P[7]
...
B[10] = P[5] + P[10]
B[11] = P[5] + P[11]
This is why the value of A[5] shows up in the result of B[10].
The underlying problem is that your functor is not associative. For example
F( F({X,2}, {Y,1}), {Z,0}) = F({Y,1}, {Z,0}) = {Z,0}
but
F( {X,2}, F({Y,1}, {Z,0})) = F({X,2}, {Z,0}) = {X,0}
Original comment by wnbell
on 21 Nov 2010 at 5:42
Original issue reported on code.google.com by
vinitha....@gmail.com
on 18 Nov 2010 at 7:45