8 #ifndef ABLASTR_MSG_LOGGER_H_
9 #define ABLASTR_MSG_LOGGER_H_
223 std::vector<MsgWithCounterAndRanks>
234 std::vector<MsgWithCounterAndRanks>
247 int how_many_msgs)
const;
259 std::vector<MsgWithCounterAndRanks>
261 const std::map<Msg,std::int64_t>& my_msg_map,
262 const std::vector<char>& all_data,
263 const std::vector<int>& displacements,
264 const int gather_rank
277 std::vector<MsgWithCounterAndRanks>& msgs_with_counter_and_ranks,
278 int gather_rank)
const;
Definition: MsgLogger.H:186
const int m_io_rank
Definition: MsgLogger.H:284
std::map< Msg, std::int64_t > m_messages
Definition: MsgLogger.H:286
std::pair< int, int > find_gather_rank_and_its_msgs(int how_many_msgs) const
This collective function finds the rank having the most messages and how many messages this rank has....
Definition: MsgLogger.cpp:322
const int m_num_procs
Definition: MsgLogger.H:283
std::vector< MsgWithCounter > get_msgs_with_counter() const
This function returns a vector containing the recorded messages with the corresponding counters.
Definition: MsgLogger.cpp:235
void swap_with_io_rank(std::vector< MsgWithCounterAndRanks > &msgs_with_counter_and_ranks, int gather_rank) const
If the gather_rank is not the I/O rank, this function sends msgs_with_counter_and_ranks to the I/O ra...
Definition: MsgLogger.cpp:459
std::vector< MsgWithCounterAndRanks > one_rank_gather_msgs_with_counter_and_ranks() const
This function implements the trivial special case of collective_gather_msgs_with_counter_and_ranks wh...
Definition: MsgLogger.cpp:306
std::vector< MsgWithCounterAndRanks > collective_gather_msgs_with_counter_and_ranks() const
This collective function generates a vector containing the messages with counters and emitting ranks ...
Definition: MsgLogger.cpp:246
Logger()
The constructor.
Definition: MsgLogger.cpp:214
void record_msg(Msg msg)
This function records a message.
Definition: MsgLogger.cpp:220
const int m_rank
Definition: MsgLogger.H:282
std::vector< Msg > get_msgs() const
This function returns a vector containing the recorded messages.
Definition: MsgLogger.cpp:225
std::vector< MsgWithCounterAndRanks > compute_msgs_with_counter_and_ranks(const std::map< Msg, std::int64_t > &my_msg_map, const std::vector< char > &all_data, const std::vector< int > &displacements, const int gather_rank) const
This function uses data gathered on the "gather rank" to generate a vector of messages with global co...
Definition: MsgLogger.cpp:347
Definition: MsgLogger.H:20
Priority
Definition: MsgLogger.H:25
std::string PriorityToString(const Priority &priority)
This function converts a Priority into the corresponding string (e.g, Priority::low --> "low")
Definition: MsgLogger.cpp:102
constexpr bool operator<(const Msg &l, const Msg &r)
This implements the < operator for Msg. Warning messages are first ordered by priority (warning: high...
Definition: MsgLogger.H:173
Priority StringToPriority(const std::string &priority_string)
This function converts a string into the corresponding priority (e.g, "low" --> Priority::low)
Definition: MsgLogger.cpp:112
Definition: MsgLogger.H:58
static Msg deserialize(std::vector< char >::const_iterator &it)
This function generates a Msg struct from a byte vector.
Definition: MsgLogger.cpp:140
Priority priority
Definition: MsgLogger.H:61
std::string text
Definition: MsgLogger.H:60
std::string topic
Definition: MsgLogger.H:59
std::vector< char > serialize() const
This function returns a byte representation of the struct.
Definition: MsgLogger.cpp:128
Definition: MsgLogger.H:133
bool all_ranks
Definition: MsgLogger.H:135
std::vector< char > serialize() const
This function returns a byte representation of the struct.
Definition: MsgLogger.cpp:183
std::vector< int > ranks
Definition: MsgLogger.H:136
MsgWithCounter msg_with_counter
Definition: MsgLogger.H:134
static MsgWithCounterAndRanks deserialize(std::vector< char >::const_iterator &it)
This function generates a MsgWithCounterAndRanks struct from a byte vector.
Definition: MsgLogger.cpp:195
Definition: MsgLogger.H:95
Msg msg
Definition: MsgLogger.H:96
static MsgWithCounter deserialize(std::vector< char >::const_iterator &it)
This function generates a MsgWithCounter struct from a byte vector.
Definition: MsgLogger.cpp:166
std::vector< char > serialize() const
This function returns a byte representation of the struct.
Definition: MsgLogger.cpp:156
std::int64_t counter
Definition: MsgLogger.H:97