8 #ifndef ABLASTR_MSG_LOGGER_H_
9 #define ABLASTR_MSG_LOGGER_H_
11 #include <AMReX_Config.H>
68 [[nodiscard]] std::vector<char>
serialize()
const;
104 [[nodiscard]] std::vector<char>
serialize()
const;
143 [[nodiscard]] std::vector<char>
serialize()
const;
206 [[nodiscard]] std::vector<Msg>
get_msgs()
const;
214 [[nodiscard]] std::vector<MsgWithCounter>
224 [[nodiscard]] std::vector<MsgWithCounterAndRanks>
235 [[nodiscard]] std::vector<MsgWithCounterAndRanks>
247 [[nodiscard]] std::pair<int, int>
260 [[nodiscard]] std::vector<MsgWithCounterAndRanks>
262 const std::map<Msg,std::int64_t>& my_msg_map,
263 const std::vector<char>& all_data,
264 const std::vector<int>& displacements,
278 std::vector<MsgWithCounterAndRanks>& msgs_with_counter_and_ranks,
279 int gather_rank)
const;
Definition: MsgLogger.H:186
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, 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:353
const int m_io_rank
Definition: MsgLogger.H:285
std::map< Msg, std::int64_t > m_messages
Definition: MsgLogger.H:287
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:328
const int m_num_procs
Definition: MsgLogger.H:284
std::vector< MsgWithCounter > get_msgs_with_counter() const
This function returns a vector containing the recorded messages with the corresponding counters.
Definition: MsgLogger.cpp:236
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:467
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:311
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:249
Logger()
The constructor.
Definition: MsgLogger.cpp:213
const int m_rank
Definition: MsgLogger.H:283
void record_msg(const Msg &msg)
This function records a message.
Definition: MsgLogger.cpp:219
std::vector< Msg > get_msgs() const
This function returns a vector containing the recorded messages.
Definition: MsgLogger.cpp:224
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:99
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:110
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:139
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:127
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:182
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:194
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:165
std::vector< char > serialize() const
This function returns a byte representation of the struct.
Definition: MsgLogger.cpp:155
std::int64_t counter
Definition: MsgLogger.H:97