« September 2007 | Main | April 2008 »

November 2007

November 05, 2007

Sieve vs. OpenMP: Custom reduction operations

Reduction is the process of combining elements of a vector (or array) to yield a single aggregate element.  Examples of reduction include: summing or multiplying all elements of a list, and computing minima/maxima.  In fact, reduction can basically performed using any associative operation [but see Sam Lindley's comment below about monoids].

Both Sieve and OpenMP provide some support for reductions: Sieve via its accumulator classes, OpenMP via its reduction clause. However, the reduction clause of OpenMP is very limited - certain reductions operators are available over basic types (float and int), but there is no way to define your own custom reductions for specific applications.

In this post I will illustrate the respective approaches to reduction taken by Sieve and OpenMP, and show how Sieve's accumulator mechanism can be used to define a custom reduction over structures - leading to parallel reductions which are not possible using OpenMP.

Continue reading "Sieve vs. OpenMP: Custom reduction operations" ยป