WarpX
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ablastr::utils::msg_logger::Logger Class Reference

#include <MsgLogger.H>

Public Member Functions

 Logger ()
 The constructor. More...
 
void record_msg (const Msg &msg)
 This function records a message. More...
 
std::vector< Msgget_msgs () const
 This function returns a vector containing the recorded messages. More...
 
std::vector< MsgWithCounterget_msgs_with_counter () const
 This function returns a vector containing the recorded messages with the corresponding counters. More...
 
std::vector< MsgWithCounterAndRankscollective_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< MsgWithCounterAndRanksone_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, intfind_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< MsgWithCounterAndRankscompute_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
 

Detailed Description

This class is responsible for storing messages and merging messages collected by different processes.

Constructor & Destructor Documentation

◆ Logger()

Logger::Logger ( )

The constructor.

Member Function Documentation

◆ collective_gather_msgs_with_counter_and_ranks()

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.

Returns
a vector of messages with counters and ranks if I/O rank, an empty vector otherwise

◆ compute_msgs_with_counter_and_ranks()

std::vector< MsgWithCounterAndRanks > Logger::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
private

This function uses data gathered on the "gather rank" to generate a vector of messages with global counters and emitting rank lists.

Parameters
[in]my_msg_mapmessages and counters of the current rank (as a map)
[in]all_dataa byte array containing all the data gathered on the gather rank
[in]displacementsa vector of displacements to access data corresponding to a given rank in all_data
[in]gather_rankthe ID of the "gather rank"
Returns
if gather_rank==m_rank a vector of messages with global counters and emitting rank lists, dummy data otherwise

◆ find_gather_rank_and_its_msgs()

std::pair< int, int > Logger::find_gather_rank_and_its_msgs ( int  how_many_msgs) const
private

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".

Parameters
[in]how_many_msgsthe number of messages that the current rank has
Returns
a pair containing the ID of the "gather rank" and its number of messages

◆ get_msgs()

std::vector< Msg > Logger::get_msgs ( ) const

This function returns a vector containing the recorded messages.

Returns
a vector of the recorded messages

◆ get_msgs_with_counter()

std::vector< MsgWithCounter > Logger::get_msgs_with_counter ( ) const

This function returns a vector containing the recorded messages with the corresponding counters.

Returns
a vector of the recorded messages with counters

◆ one_rank_gather_msgs_with_counter_and_ranks()

std::vector< MsgWithCounterAndRanks > Logger::one_rank_gather_msgs_with_counter_and_ranks ( ) const
private

This function implements the trivial special case of collective_gather_msgs_with_counter_and_ranks when there is only one rank.

Returns
a vector of messages with counters and ranks

◆ record_msg()

void Logger::record_msg ( const Msg msg)

This function records a message.

Parameters
[in]msga Msg struct

◆ swap_with_io_rank()

void Logger::swap_with_io_rank ( std::vector< MsgWithCounterAndRanks > &  msgs_with_counter_and_ranks,
int  gather_rank 
) const
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.

Parameters
[in]msgs_with_counter_and_ranksa vector of messages with counters and ranks
[in]gather_rankthe ID of the "gather rank"

Member Data Documentation

◆ m_io_rank

const int ablastr::utils::msg_logger::Logger::m_io_rank
private

Rank of the I/O process

◆ m_messages

std::map<Msg, std::int64_t> ablastr::utils::msg_logger::Logger::m_messages
private

This stores a map to associate warning messages with the corresponding counters

◆ m_num_procs

const int ablastr::utils::msg_logger::Logger::m_num_procs
private

Number of MPI ranks

◆ m_rank

const int ablastr::utils::msg_logger::Logger::m_rank
private

MPI rank of the current process


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