Previous | Next --- Slide 81 of 90
Back to Lecture Thumbnails
ChrisGabor

It appears the benefit of using these reduction clauses is that we do not need to worry about race conditions on updates to shared variables that have been assigned to the reduction, which makes the code simpler. Another benefit I could imagine on the implementation side would be the partial results of the reduction could be computed faster in parallel which could potentially reduce the number of locks acquired to update the variable. We may be able to complete the full update to the variable with an order of O(log(n)) locks or synchronization calls, similar to what we saw in the lectures for parallel prefix sum. If we instead did not introduce parallelism for the partial sums we would need to acquire O(n) locks as each thread would need to contribute a write update to the variable.

icebear101

Completely agree with the above post. In the project, I did try both reduction and self-written-reduction with atomic operations on shared variable, and the latter is much slower than the former one.

Please log in to leave a comment.