Introduction to Reducers

Reducers address the problem of accessing nonlocal variables in parallel code. Conceptually, a reducer is a variable that can be safely used by multiple strands running in parallel. The runtime ensures that each worker has access to a private copy of the variable, eliminating the possibility of races without requiring locks. When the strands synchronize, the reducer copies are merged (or reduced) into a single variable. The runtime creates copies only when needed, minimizing overhead.

Reducers have several attractive properties:

Reducers are defined by writing C++ templates that provide an interface to the runtime system.

At some point, you may want to write your own reducer. How to Write a New Reducer provides more information.


Submit feedback on this help topic

Copyright © 1996-2011, Intel Corporation. All rights reserved.