WarpX
|
#include <MsgLogger.H>
Public Member Functions | |
Logger () | |
The constructor. More... | |
void | record_msg (const Msg &msg) |
This function records a message. More... | |
std::vector< Msg > | get_msgs () const |
This function returns a vector containing the recorded messages. More... | |
std::vector< MsgWithCounter > | get_msgs_with_counter () const |
This function returns a vector containing the recorded messages with the corresponding counters. More... | |
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 by gathering data from all the ranks. More... | |
Private Member Functions | |
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 when there is only one rank. More... | |
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. The rank having the most messages is designated as "gather rank". More... | |
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 counters and emitting rank lists. More... | |
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 rank. This function uses point-to-point communications. More... | |
Private Attributes | |
const int | m_rank |
const int | m_num_procs |
const int | m_io_rank |
std::map< Msg, std::int64_t > | m_messages |
This class is responsible for storing messages and merging messages collected by different processes.
Logger::Logger | ( | ) |
The constructor.
std::vector< MsgWithCounterAndRanks > Logger::collective_gather_msgs_with_counter_and_ranks | ( | ) | const |
This collective function generates a vector containing the messages with counters and emitting ranks by gathering data from all the ranks.
|
private |
This function uses data gathered on the "gather rank" to generate a vector of messages with global counters and emitting rank lists.
[in] | my_msg_map | messages and counters of the current rank (as a map) |
[in] | all_data | a byte array containing all the data gathered on the gather rank |
[in] | displacements | a vector of displacements to access data corresponding to a given rank in all_data |
[in] | gather_rank | the ID of the "gather rank" |
This collective function finds the rank having the most messages and how many messages this rank has. The rank having the most messages is designated as "gather rank".
[in] | how_many_msgs | the number of messages that the current rank has |
std::vector< Msg > Logger::get_msgs | ( | ) | const |
This function returns a vector containing the recorded messages.
std::vector< MsgWithCounter > Logger::get_msgs_with_counter | ( | ) | const |
This function returns a vector containing the recorded messages with the corresponding counters.
|
private |
This function implements the trivial special case of collective_gather_msgs_with_counter_and_ranks when there is only one rank.
void Logger::record_msg | ( | const Msg & | msg | ) |
This function records a message.
[in] | msg | a Msg struct |
|
private |
If the gather_rank is not the I/O rank, this function sends msgs_with_counter_and_ranks to the I/O rank. This function uses point-to-point communications.
[in] | msgs_with_counter_and_ranks | a vector of messages with counters and ranks |
[in] | gather_rank | the ID of the "gather rank" |
|
private |
Rank of the I/O process
|
private |
This stores a map to associate warning messages with the corresponding counters
|
private |
Number of MPI ranks
|
private |
MPI rank of the current process