HILA
|
Special reduction class: enables delayed and non-blocking reductions, which are not possible with the standard reduction. See user guide for details. More...
#include <reduction.h>
Public Member Functions | |
Reduction () | |
template<typename S , std::enable_if_t< hila::is_assignable< T &, S >::value, int > = 0> | |
Reduction (const S &v) | |
Reduction (const Reduction< T > &r)=delete | |
~Reduction () | |
Destructor cleans up communications if they are in progress. | |
Reduction & | allreduce (bool b=true) |
allreduce(bool) turns allreduce on or off. By default on. | |
Reduction & | nonblocking (bool b=true) |
nonblocking(bool) turns allreduce on or off. By default on. | |
Reduction & | delayed (bool b=true) |
deferred(bool) turns deferred on or off. By default turns on. | |
const T | value () |
Return value of the reduction variable. Wait for the comms if needed. | |
template<typename S , std::enable_if_t< hila::is_assignable< T &, S >::value, int > = 0> | |
void | set (const S &rhs) |
Method set is the same as assignment, but without return value. | |
template<typename S , std::enable_if_t< hila::is_assignable< T &, S >::value, int > = 0> | |
T | operator= (const S &rhs) |
Assignment is used only outside site loops - drop comms if on, no need to wait. | |
template<typename S , std::enable_if_t< hila::is_assignable< T &, hila::type_plus< T, S > >::value, int > = 0> | |
void | operator+= (const S &rhs) |
void | start_reduce () |
For delayed reduction, start_reduce starts or completes the reduction operation. | |
void | reduce () |
Complete the reduction - start if not done, and wait if ongoing. | |
Special reduction class: enables delayed and non-blocking reductions, which are not possible with the standard reduction. See user guide for details.
Definition at line 14 of file reduction.h.
|
inline |
Initialize to zero by default (? exception to other variables) allreduce = true by default
Definition at line 102 of file reduction.h.
|
inline |
Initialize to value only on rank 0 - ensures expected result for delayed reduction
Definition at line 109 of file reduction.h.
|
delete |
Delete copy construct from another reduction just in case don't make Reduction temporaries
|
inline |
Compound operator += is used in reduction but can be used outside onsites too. returns void, unconventionally: these are used within site loops but their value is not well-defined. Thus a = (r += b); is disallowed
Definition at line 193 of file reduction.h.
|
inline |
For delayed reduction, start_reduce starts or completes the reduction operation.
Product reduction – currently works only for scalar data types. For Complex, Matrix and Vector data product is not element-wise. TODO: Array or std::array ? TODO: implement using custom MPI ops (if needed)
Definition at line 260 of file reduction.h.