Proto
3.2
|
#include <Proto_Reduction.H>
Public Member Functions | |
Reduction () | |
Reduction (bool a_dynamic) | |
Constructor. More... | |
~Reduction () | |
Destructor. More... | |
T | fetchLocal () |
Get Reduction. More... | |
T | fetch () |
Get Reduction. More... | |
void | reduce (const T *a_data, const size_t a_size) |
Compute Reduction. More... | |
void | reset () |
Reset Reduction. More... | |
Static Public Member Functions | |
static ACCEL_DECORATION T | init () |
Initialize Value. More... | |
static ACCEL_DECORATION void | update (T &a_v1, const T a_v2) |
Update Value. More... | |
Private Attributes | |
T * | m_hostTotal |
T * | m_hostTemp |
|
inline |
Proto::Reduction< T, OP, MEM >::Reduction | ( | bool | a_dynamic | ) |
Constructor.
Creates a Reduction operator with or without dynamic block allocation. If a_dynamic==true
, the minimum number of GPU blocks needed to compute a reduction will be determined on each call to Reduction::reduce
. Otherwise, the maximum bumber of blocks available on the device will be used instead.
a_dynamic | Determine number of GPU blocks dynamically? |
Proto::Reduction< T, OP, MEM >::~Reduction | ( | ) |
Destructor.
|
static |
Initialize Value.
Initialize a value based on OP. Minima Ops: a_value
-> max value of T Maxima Ops: a_value
-> min value of T Sum Ops: a_value
-> 0
Referenced by Proto::initKernel(), and Proto::Reduction< T, OP, MEM >::Reduction().
|
static |
Update Value.
Computed an updated value by executing OP on two values.
a_v1 | A value compared with OP |
a_v2 | A value compared with OP |
Referenced by Proto::initKernel(), and Proto::Reduction< T, OP, MEM >::Reduction().
T Proto::Reduction< T, OP, MEM >::fetchLocal | ( | ) |
Get Reduction.
Returns the computed reduction, waiting for kernel completion on GPUs. The result is local to a single MPI process if MPI is enabled.
Referenced by Proto::Reduction< T, OP, MEM >::Reduction().
T Proto::Reduction< T, OP, MEM >::fetch | ( | ) |
Get Reduction.
Returns the computed reduction, waiting for kernel completion on GPUs. If MPI is enabled, the result is communicated to all processes.
Referenced by Proto::Reduction< T, OP, MEM >::Reduction().
void Proto::Reduction< T, OP, MEM >::reduce | ( | const T * | a_data, |
const size_t | a_size | ||
) |
Compute Reduction.
Calculates a reduction on the buffer a_data
of size a_size
. Here a_size
is the number of elements of a_data
. Subsequent calls to reduce
will update the reduction until Reduction::reset()
is called.
a_data | A buffer of data. |
a_size | The number of elements in a_data . |
Referenced by Proto::Reduction< T, OP, MEM >::Reduction().
void Proto::Reduction< T, OP, MEM >::reset | ( | ) |
Reset Reduction.
Reinitializes the reduction.
Referenced by Proto::Reduction< T, OP, MEM >::Reduction().
|
private |
|
private |