21namespace kamping::measurements {
27template <
typename DataType>
33 using StorageType = std::unordered_map<GlobalAggregationMode, std::vector<ScalarOrContainer<DataType>>>;
67template <
typename DataType>
75 template <
typename MeasurementNode,
typename Communicator>
99 template <
typename MeasurementNode,
typename Communciator>
107 "Currently processed MeasurementTreeNode has not the same name on all ranks -> measurement trees have "
113 "Currently processed MeasurementTreeNode has not the same number of measurements on all ranks -> "
114 "measurement trees have "
124 if (!
comm.is_root()) {
130 for (
size_t rank = 0; rank <
comm.size(); ++rank) {
134 for (
auto const& aggregation_mode: measurement_tree_node.measurements_aggregation_operations()) {
135 aggregate_measurements_globally(aggregation_mode, cur_durations, aggregation_tree_node);
138 for (
auto& measurement_tree_child: measurement_tree_node.children()) {
139 auto& aggregation_tree_child = aggregation_tree_node.find_or_insert(measurement_tree_child->name());
140 aggregate(aggregation_tree_child, *measurement_tree_child.get(), comm);
149 void aggregate_measurements_globally(
150 GlobalAggregationMode mode,
151 std::vector<DataType>
const& gathered_data,
155 case GlobalAggregationMode::max: {
156 using Operation = internal::Max;
157 evaluation_node.
add(mode, Operation::compute(gathered_data));
160 case GlobalAggregationMode::min: {
161 using Operation = internal::Min;
162 evaluation_node.
add(mode, Operation::compute(gathered_data));
165 case GlobalAggregationMode::sum: {
166 using Operation = internal::Sum;
167 evaluation_node.
add(mode, Operation::compute(gathered_data));
170 case GlobalAggregationMode::gather: {
171 using Operation = internal::Gather;
172 evaluation_node.
add(mode, Operation::compute(gathered_data));
Wrapper for MPI communicator providing access to rank() and size() of the communicator....
Definition communicator.hpp:49
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
Class representing a node in an (globally) aggregated tree, i.e., a node of a timer (or counter) tree...
Definition aggregated_tree_node.hpp:28
auto const & aggregated_data() const
Access to stored aggregated data.
Definition aggregated_tree_node.hpp:37
void add(GlobalAggregationMode aggregation_mode, std::optional< DataType > data)
Add scalar of type T to aggregated data storage together with the name of the applied aggregation ope...
Definition aggregated_tree_node.hpp:45
void add(GlobalAggregationMode aggregation_mode, std::vector< DataType > const &data)
Add scalar of type T to aggregated data storage together with the name of the applied aggregation ope...
Definition aggregated_tree_node.hpp:55
std::unordered_map< GlobalAggregationMode, std::vector< ScalarOrContainer< DataType > > > StorageType
Type into which the aggregated data is stored together with the applied aggregation operation.
Definition aggregated_tree_node.hpp:33
StorageType _aggregated_data
Storage of the aggregated data.
Definition aggregated_tree_node.hpp:60
Class representing an aggregated measurement tree, i.e., a measurement tree for which the global aggr...
Definition aggregated_tree_node.hpp:68
auto const & root() const
Access to the root of the aggregated tree.
Definition aggregated_tree_node.hpp:88
AggregatedTree(MeasurementNode const &measurement_root_node, Communicator const &comm)
Globally aggregates the measurement tree provided with.
Definition aggregated_tree_node.hpp:76
auto & root()
Access to the root of the aggregated tree.
Definition aggregated_tree_node.hpp:82
Object representing a node in a tree. The class is not meant to be used on its own but to encapsulate...
Definition measurement_utils.hpp:108
TreeNode()
Constructs node without pointer to parent and empty name.
Definition measurement_utils.hpp:111
constexpr int heavy_communication
Assertions that perform heavyweight communication.
Definition assertion_levels.hpp:31
constexpr int light_communication
Assertions that perform lightweight communication.
Definition assertion_levels.hpp:25
auto recv_buf(Container &&container)
Passes a container, into which the received elements will be written, to the underlying call....
Definition named_parameters.hpp:859
auto send_buf(internal::ignore_t< Data > ignore)
Generates a dummy send buf that wraps a nullptr.
Definition named_parameters.hpp:51
GlobalAggregationMode
Enum to specify how time durations with same key shall be aggregated across the participating ranks.
Definition measurement_aggregation_definitions.hpp:37