Proto  3.2
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
Proto::Reduction< T, OP, MEM > Class Template Reference

#include <Proto_Reduction.H>

Public Member Functions

 Reduction ()
 
 Reduction (bool a_dynamic)
 Constructor. More...
 
 ~Reduction ()
 Destructor. More...
 
fetchLocal ()
 Get Reduction. More...
 
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_DECORATIONinit ()
 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
 

Constructor & Destructor Documentation

◆ Reduction() [1/2]

template<typename T, Operation OP, MemType MEM = MEMTYPE_DEFAULT>
Proto::Reduction< T, OP, MEM >::Reduction ( )
inline

◆ Reduction() [2/2]

template<typename T, Operation OP, MemType MEM = MEMTYPE_DEFAULT>
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.

Parameters
a_dynamicDetermine number of GPU blocks dynamically?

◆ ~Reduction()

template<typename T, Operation OP, MemType MEM = MEMTYPE_DEFAULT>
Proto::Reduction< T, OP, MEM >::~Reduction ( )

Destructor.

Member Function Documentation

◆ init()

template<typename T, Operation OP, MemType MEM = MEMTYPE_DEFAULT>
static ACCEL_DECORATION T Proto::Reduction< T, OP, MEM >::init ( )
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().

◆ update()

template<typename T, Operation OP, MemType MEM = MEMTYPE_DEFAULT>
static ACCEL_DECORATION void Proto::Reduction< T, OP, MEM >::update ( T &  a_v1,
const T  a_v2 
)
static

Update Value.

Computed an updated value by executing OP on two values.

Parameters
a_v1A value compared with OP
a_v2A value compared with OP

Referenced by Proto::initKernel(), and Proto::Reduction< T, OP, MEM >::Reduction().

◆ fetchLocal()

template<typename T, Operation OP, MemType MEM = MEMTYPE_DEFAULT>
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().

◆ fetch()

template<typename T, Operation OP, MemType MEM = MEMTYPE_DEFAULT>
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().

◆ reduce()

template<typename T, Operation OP, MemType MEM = MEMTYPE_DEFAULT>
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.

Parameters
a_dataA buffer of data.
a_sizeThe number of elements in a_data.

Referenced by Proto::Reduction< T, OP, MEM >::Reduction().

◆ reset()

template<typename T, Operation OP, MemType MEM = MEMTYPE_DEFAULT>
void Proto::Reduction< T, OP, MEM >::reset ( )

Reset Reduction.

Reinitializes the reduction.

Referenced by Proto::Reduction< T, OP, MEM >::Reduction().

Member Data Documentation

◆ m_hostTotal

template<typename T, Operation OP, MemType MEM = MEMTYPE_DEFAULT>
T* Proto::Reduction< T, OP, MEM >::m_hostTotal
private

◆ m_hostTemp

template<typename T, Operation OP, MemType MEM = MEMTYPE_DEFAULT>
T* Proto::Reduction< T, OP, MEM >::m_hostTemp
private

The documentation for this class was generated from the following file: