Base class for aggregators. More...
Public Member Functions | |
aggregator_base (Cont *pc, size_t max_msg_sz=16384) | |
size_t | target_location (Elem const &x) const |
Returns the ID of the location where the specified element is stored. More... | |
void | add (Elem const &x) |
Adds an element to the aggregator. More... | |
void | add (Elem const &x, size_t loc) |
Adds an element to the aggregator, when the target location is given. More... | |
~aggregator_base () | |
Destructor will also flush any remaining elements in the queues. | |
void | flush (void) |
Flush the queues for all locations. | |
void | flush (size_t i) |
Flush the queue for the provided location. More... | |
void | local_flush (void) |
Flush the queue for this location. This is a local operation. | |
Cont * | container (void) |
void | manual_destruct (void) |
Flush all queues that are not empty. | |
Protected Attributes | |
std::vector< std::vector< Elem > > | m_send_queue |
Container for storing requests to each location. | |
std::vector< size_t > | m_loc_ids |
Container storing a random shuffling for all location-ids. Shuffling the location-ids provides better performance by easing network traffic. | |
Cont * | m_pc |
Pointer to the container where requests will be executed. | |
size_t | m_max_msg_aggregate_sz |
Maximum number of requests that will be aggregated. | |
size_t | m_loc_id |
The ID of this location. | |
Base class for aggregators.
Aggregates requests to vertices and flushes them out when either a set number of requests have been aggregated (on a per-location basis) or when the aggregator object is destroyed.
Performance optimization for hiding overhead of sending many small messages over the runtime. Experiments have shown significant benefit from using aggregators in algorithms requiring heavy communication as is the case with the Graph500 benchmark.
Elem | The type of the user-requests being aggregated. |
Cont | The type of the container (graphs). |
Derived | The most derived type for CRTP. |
size_t stapl::aggregator_base< Elem, Cont, Derived >::target_location | ( | Elem const & | x | ) | const |
Returns the ID of the location where the specified element is stored.
Derived classes may chose to overwrite this method to provide a suitable method to find what the element is. By default, the element GID is provided by the .target() method.
void stapl::aggregator_base< Elem, Cont, Derived >::add | ( | Elem const & | x | ) |
Adds an element to the aggregator.
This will trigger a flush if the queue for the target location has exceeded the maximum message size.
void stapl::aggregator_base< Elem, Cont, Derived >::add | ( | Elem const & | x, |
size_t | loc | ||
) |
Adds an element to the aggregator, when the target location is given.
This will trigger a flush if the queue for the target location has exceeded the maximum message size.
x | The element to send. |
loc | The location to send the element to. |
void stapl::aggregator_base< Elem, Cont, Derived >::flush | ( | size_t | i | ) |
Flush the queue for the provided location.
i | The location whose queue is to be flushed. |