KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
Loading...
Searching...
No Matches
kamping::measurements::Counter< CommunicatorType > Class Template Reference

Distributed counter object. More...

#include <counter.hpp>

Public Types

using DataType = std::int64_t
 

Public Member Functions

 Counter ()
 Constructs a timer using the MPI_COMM_WORLD communicator.
 
 Counter (CommunicatorType const &comm)
 Constructs a timer using a given communicator.
 
void add (std::string const &name, DataType const &data, std::vector< GlobalAggregationMode > const &global_aggregation_modi=std::vector< GlobalAggregationMode >{})
 Creates a measurement entry with name.
 
void append (std::string const &name, DataType const &data, std::vector< GlobalAggregationMode > const &global_aggregation_modi=std::vector< GlobalAggregationMode >{})
 Looks for a measurement entry with name.
 
auto aggregate ()
 Aggregate the measurement entries globally.
 
void clear ()
 Clears all stored measurements.
 
template<typename Printer >
void aggregate_and_print (Printer &&printer)
 Aggregates and outputs the the executed measurements. The output is done via the print() method of a given Printer object.
 

Detailed Description

template<typename CommunicatorType = Communicator<>>
class kamping::measurements::Counter< CommunicatorType >

Distributed counter object.

Template Parameters
CommunicatorTypeCommunicator in which the measurements are executed.

Member Typedef Documentation

◆ DataType

template<typename CommunicatorType = Communicator<>>
using kamping::measurements::Counter< CommunicatorType >::DataType = std::int64_t

Data type of the stored measurements.

Constructor & Destructor Documentation

◆ Counter()

template<typename CommunicatorType = Communicator<>>
kamping::measurements::Counter< CommunicatorType >::Counter ( CommunicatorType const & comm)
inline

Constructs a timer using a given communicator.

Parameters
commCommunicator in which the time measurements are executed.

Member Function Documentation

◆ add()

template<typename CommunicatorType = Communicator<>>
void kamping::measurements::Counter< CommunicatorType >::add ( std::string const & name,
DataType const & data,
std::vector< GlobalAggregationMode > const & global_aggregation_modi = std::vector<GlobalAggregationMode>{} )
inline

Creates a measurement entry with name.

Parameters
nameand stores
datatherein. If such an entry already exists with associated data entry data_prev, data will be added to it, i.e. data_prev + data.
global_aggregation_modiSpecify how the measurement entry is aggregated over all participationg PEs when Counter::aggregate() is called.

◆ aggregate()

template<typename CommunicatorType = Communicator<>>
auto kamping::measurements::Counter< CommunicatorType >::aggregate ( )
inline

Aggregate the measurement entries globally.

Returns
AggregatedTree object which encapsulates the aggregated data in a tree structure representing the measurements.

◆ aggregate_and_print()

template<typename CommunicatorType = Communicator<>>
template<typename Printer >
void kamping::measurements::Counter< CommunicatorType >::aggregate_and_print ( Printer && printer)
inline

Aggregates and outputs the the executed measurements. The output is done via the print() method of a given Printer object.

The print() method must accept an object of type AggregatedTreeNode and receives the root of the evaluated timer tree as parameter. The print() method is only called on the root rank of the communicator. See EvaluationTreeNode for the accessible data. The EvaluationTreeNode::children() member function can be used to navigate the nested measurement structure.

Template Parameters
PrinterType of printer which is used to output the aggregated timing data. Printer must possess a member print() which accepts a EvaluationTreeNode as parameter.
Parameters
printerPrinter object used to output the aggregated timing data.

◆ append()

template<typename CommunicatorType = Communicator<>>
void kamping::measurements::Counter< CommunicatorType >::append ( std::string const & name,
DataType const & data,
std::vector< GlobalAggregationMode > const & global_aggregation_modi = std::vector<GlobalAggregationMode>{} )
inline

Looks for a measurement entry with name.

Parameters
nameand appends
datato the list of previously stored data. If no such entry exists, a new measurement entry with data as first entry will be created. entry data_prev, data will be added to it, i.e. data_prev + data.
global_aggregation_modiSpecify how the measurement entry is aggregated over all participationg PEs when Counter::aggregate() is called.

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