Reducer Library

The provided reducer library contains the reducers shown in the following table.

A description of each reducer is described in the comments that appear in the corresponding header file.

In the following table, the middle column shows each reducer's identity element and Update operation (there may be several).

Reducer/Header File

Identity/ Update

Description

reducer_list_append

<cilk/reducer_list.h>

empty list push_back()

Creates a list using an append operation. The final list has the same order as the list constructed by the equivalent serial program, regardless of the worker count or the order in which the workers are scheduled.

reducer_list_prepend

<cilk/reducer_list.h>

empty list

push_front()

Creates a list using a prepend operation.

reducer_max

<cilk/reducer_max.h>

Argument to constructor

cilk::max_of

Finds the maximum value over a set of values. The constructor argument has an initial maximum value.

reducer_max_index

<cilk/reducer_max.h>

Arguments to constructor cilk::max_of

Finds the maximum value and the index of the element containing the maximum value over a set of values. The constructor argument has an initial maximum value and index.

reducer_min

<cilk/reducer_min.h>

Argument to constructor cilk::min_of

Finds the minimum value over a set of values. The constructor argument has an initial minimum value.

reducer_min_index

<cilk/reducer_min.h>

Arguments to constructor cilk::min_of

Finds the minimum value and the index of the element containing the minimum value over a set of values. The constructor argument has an initial minimum value and index.

reducer_opadd

<cilk/reducer_opadd.h>

0 +=, =, -=, ++, --

Performs a sum.

reducer_opand

<cilk/reducer_opand.h>

1 / true &, &=, =

Perform logical or bitwise AND.

reducer_opor

<cilk/reducer_opor.h>

0 / false |, |=, =

Perform logical or bitwise OR.

reducer_opxor

<cilk/reducer_opxor.h>

0 / false ^, ^=, =

Perform logical or bitwise XOR.

reducer_ostream

<cilk/reducer_ostream.h>

Arguments to constructor <<

Provides an output stream that can be written in parallel. In order to preserve a consistent order in the output stream, output is buffered by the reducer class until there is no more pending output to the left of the current position. This ensures that the output always appear in the same order as the output generated by the equivalent serial program.

reducer_basic_string

<cilk/reducer_string.h>

Empty string, or arguments to constructor +=, append

Creates a string using append or += operations. Internally, the string is maintained as a list of substrings in order to minimize copying and memory fragmentation. The substrings are assembled into a single output string when get_value() is called.

reducer_string

<cilk/reducer_string.h>

Empty string, or arguments to constructor +=, append

Provides a shorthand for a reducer_basic_string of type char.

reducer_wstring

<cilk/reducer_string.h>

Empty string, or arguments to constructor +=, append

Provides a shorthand for a reducer_basic_string of type wchar_t.


Submit feedback on this help topic

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