HavoqGT
havoqgt::mpi::mailbox_routed< TMsg > Class Template Reference

#include <mailbox.hpp>

Collaboration diagram for havoqgt::mpi::mailbox_routed< TMsg >:

Classes

class  msg_buffer
 
class  twod_router
 

Public Types

typedef TMsg message_type
 

Public Member Functions

 mailbox_routed (MPI_Comm _mpi_comm, int _mpi_tag)
 
 ~mailbox_routed ()
 
void send_tree_fast (int raw_dest, const TMsg &_raw_msg)
 
void send_tree_parent (const TMsg &_raw_msg)
 
void send_tree_children (const TMsg &_raw_msg)
 
void route_fast_path (uint32_t dest, const routed_msg_type &_msg)
 
template<typename OutputIterator >
void bcast (TMsg _raw_msg, OutputIterator _oitr)
 
void bcast_to_targets (TMsg _msg)
 
void check_for_starvation ()
 
template<typename OutputIterator >
void send (int raw_dest, const TMsg &_raw_msg, OutputIterator _oitr, bool fast=true)
 
template<typename OutputIterator >
void receive (OutputIterator _oitr, bool aggregsive=false)
 
bool is_idle ()
 
void flush_buffers_if_idle ()
 
int comm_rank () const
 
int comm_size () const
 

Private Types

typedef TMsg routed_msg_type
 

Private Member Functions

msg_buffer allocate_msg_buffer ()
 
void free_msg_buffer (void *_ptr)
 
void post_isend (int index)
 
bool cleanup_pending_isend_requests_index (size_t index)
 
void cleanup_pending_isend_requests (bool force_aggressive=false)
 
void post_new_irecv (void *_buff)
 

Private Attributes

MPI_Comm m_mpi_comm
 MPI configuration. More...
 
int m_mpi_tag
 
int m_mpi_rank
 
int m_mpi_size
 
size_t m_pending_partial_buffers
 
size_t m_num_pending_isend
 
size_t m_last_recv_count
 
std::vector< void * > m_vec_free_buffers
 
std::vector< msg_bufferm_buffer_per_rank
 
std::vector< std::list< boost::tuple< MPI_Request, void *, std::list< size_t >::iterator > > > m_list_isend_request_per_rank
 
std::list< size_t > m_list_isends
 
std::list< std::pair< MPI_Request, void * > > m_list_irecv_request
 
twod_router m_2d_comm
 
std::vector< std::list< size_t >::iterator > m_pending_iterator_per_rank
 
std::list< size_t > m_list_pending
 
int m_tree_parent
 
int m_tree_child1
 
int m_tree_child2
 
bool m_receiving
 
uint64_t m_mpi_send_counter
 
uint64_t m_tree_send_counter
 
uint64_t m_route_counter
 
uint64_t m_send_counter
 
uint64_t m_recv_counter
 

Detailed Description

template<typename TMsg>
class havoqgt::mpi::mailbox_routed< TMsg >

Definition at line 75 of file mailbox.hpp.

Member Typedef Documentation

template<typename TMsg>
typedef TMsg havoqgt::mpi::mailbox_routed< TMsg >::message_type

Definition at line 158 of file mailbox.hpp.

template<typename TMsg>
typedef TMsg havoqgt::mpi::mailbox_routed< TMsg >::routed_msg_type
private

Definition at line 88 of file mailbox.hpp.

Constructor & Destructor Documentation

template<typename TMsg>
havoqgt::mpi::mailbox_routed< TMsg >::mailbox_routed ( MPI_Comm  _mpi_comm,
int  _mpi_tag 
)
inline

Definition at line 160 of file mailbox.hpp.

161  :
162  m_mpi_comm(_mpi_comm),
163  m_mpi_tag(_mpi_tag) {
166 
167  m_last_recv_count = 0;
168 
169  //statistics
170  m_mpi_send_counter = 0;
172  m_route_counter = 0;
173  m_send_counter = 0;
174  m_recv_counter = 0;
175 
176  m_receiving = false;
177 
178 
179  CHK_MPI(MPI_Comm_rank(m_mpi_comm, &m_mpi_rank) );
180  CHK_MPI(MPI_Comm_size(m_mpi_comm, &m_mpi_size) );
181 
182  //Allocate buffer slots for each rank.
183  //This does not acutally allocate the buffer's memory
187 
188 
189  for(size_t i=0; i<get_environment().mailbox_num_irecv(); ++i) {
190  void* irecv_buff = NULL;
191  int ret = posix_memalign(&irecv_buff, 32,
192  get_environment().mailbox_aggregation() * sizeof(routed_msg_type));
193  if(ret !=0) {
194  perror("posix_memalign-irecv"); exit(-1);
195  }
196  post_new_irecv(irecv_buff);
197  }
198  m_2d_comm = twod_router(m_mpi_rank, m_mpi_size);
199 
201  m_tree_child1 = (m_mpi_rank * 2) + 1;
202  m_tree_child2 = (m_mpi_rank * 2) + 2;
203  }
std::vector< std::list< boost::tuple< MPI_Request, void *, std::list< size_t >::iterator > > > m_list_isend_request_per_rank
Definition: mailbox.hpp:536
uint32_t mailbox_num_irecv() const
Definition: environment.hpp:79
MPI_Comm m_mpi_comm
MPI configuration.
Definition: mailbox.hpp:523
std::vector< msg_buffer > m_buffer_per_rank
Definition: mailbox.hpp:533
old_environment & get_environment()
#define CHK_MPI(a)
Definition: mpi.hpp:68
std::vector< std::list< size_t >::iterator > m_pending_iterator_per_rank
Definition: mailbox.hpp:543
std::list< size_t > m_list_pending
Definition: mailbox.hpp:545
void post_new_irecv(void *_buff)
Definition: mailbox.hpp:511
template<typename TMsg>
havoqgt::mpi::mailbox_routed< TMsg >::~mailbox_routed ( )
inline

Definition at line 205 of file mailbox.hpp.

205  {
206  assert(m_pending_partial_buffers == 0);
207  while(m_num_pending_isend > 0) {
209  }
210  while(!m_list_irecv_request.empty()) {
211  CHK_MPI( MPI_Cancel( &(m_list_irecv_request.front().first) ) );
212  free(m_list_irecv_request.front().second);
213  m_list_irecv_request.pop_front();
214  }
215  for(size_t i=0; i<m_vec_free_buffers.size(); ++i) {
216  free(m_vec_free_buffers[i]);
217  }
218 
219  if(get_environment().mailbox_print_stats()) {
220  uint64_t g_mpi_send_counter = mpi_all_reduce(m_mpi_send_counter, std::plus<uint64_t>(), MPI_COMM_WORLD);
221  uint64_t g_tree_send_counter = mpi_all_reduce(m_tree_send_counter, std::plus<uint64_t>(), MPI_COMM_WORLD);
222  uint64_t g_route_counter = mpi_all_reduce(m_route_counter, std::plus<uint64_t>(), MPI_COMM_WORLD);
223  uint64_t g_send_counter = mpi_all_reduce(m_send_counter, std::plus<uint64_t>(), MPI_COMM_WORLD);
224  uint64_t g_recv_counter = mpi_all_reduce(m_recv_counter, std::plus<uint64_t>(), MPI_COMM_WORLD);
225  if(m_mpi_rank == 0) {
226  std::cout << "****************** Mailbox Statistics ********************" << std::endl;
227  std::cout << "routed message size = " << sizeof(TMsg) << std::endl;
228  std::cout << "mpi_send_counter = " << g_mpi_send_counter << std::endl;
229  std::cout << "tree_send_counter = " << g_tree_send_counter << std::endl;
230  std::cout << "route_counter = " << g_route_counter << std::endl;
231  std::cout << "send_counter = " << g_send_counter << std::endl;
232  std::cout << "recv_counter = " << g_recv_counter << std::endl;
233  std::cout << "Average send size = " << double(g_send_counter + g_route_counter) / double(g_mpi_send_counter) << std::endl;
234  std::cout << "***********************************************************" << std::endl;
235  }
236  }
237 
238  CHK_MPI( MPI_Barrier( m_mpi_comm ) );
239  }
std::list< std::pair< MPI_Request, void * > > m_list_irecv_request
Definition: mailbox.hpp:539
MPI_Comm m_mpi_comm
MPI configuration.
Definition: mailbox.hpp:523
T mpi_all_reduce(T in_d, Op in_op, MPI_Comm mpi_comm)
Definition: mpi.hpp:176
void cleanup_pending_isend_requests(bool force_aggressive=false)
Definition: mailbox.hpp:504
old_environment & get_environment()
#define CHK_MPI(a)
Definition: mpi.hpp:68
std::vector< void * > m_vec_free_buffers
Definition: mailbox.hpp:532

Member Function Documentation

template<typename TMsg>
msg_buffer havoqgt::mpi::mailbox_routed< TMsg >::allocate_msg_buffer ( )
inlineprivate

Definition at line 424 of file mailbox.hpp.

424  {
425  if(m_vec_free_buffers.empty()) {
426  void* buff = NULL;
427  int ret = posix_memalign(&buff, 32,
428  get_environment().mailbox_aggregation() * sizeof(routed_msg_type));
429  if(ret !=0) {
430  perror("posix_memalign"); exit(-1);
431  }
432  m_vec_free_buffers.push_back(buff);
433  }
434  msg_buffer to_return(m_vec_free_buffers.back());
435  m_vec_free_buffers.pop_back();
436  return to_return;
437  }
old_environment & get_environment()
std::vector< void * > m_vec_free_buffers
Definition: mailbox.hpp:532

Here is the caller graph for this function:

template<typename TMsg>
template<typename OutputIterator >
void havoqgt::mpi::mailbox_routed< TMsg >::bcast ( TMsg  _raw_msg,
OutputIterator  _oitr 
)
inline

Definition at line 288 of file mailbox.hpp.

288  {
289  assert(_raw_msg.get_bcast());
290  _raw_msg.set_dest(m_mpi_size+1);
291  for(uint32_t i=0; i<m_2d_comm.bcast_proxies().size(); ++i) {
292  uint32_t proxy_rank = m_2d_comm.bcast_proxies()[i];
293  if(proxy_rank == uint32_t(m_mpi_rank)) {
294  bcast_to_targets(_raw_msg);
295  } else {
296  route_fast_path(proxy_rank, _raw_msg);
297  }
298  }
299  if(m_receiving) return; //prevent receive recursion @todo, make this a function called wait
300  do {
302  receive(_oitr);
303  } while(m_num_pending_isend > get_environment().mailbox_num_isend());
304  }
void receive(OutputIterator _oitr, bool aggregsive=false)
Definition: mailbox.hpp:364
const std::vector< uint32_t > & bcast_proxies() const
Definition: mailbox.hpp:124
void bcast_to_targets(TMsg _msg)
Definition: mailbox.hpp:306
void route_fast_path(uint32_t dest, const routed_msg_type &_msg)
Definition: mailbox.hpp:271
void cleanup_pending_isend_requests(bool force_aggressive=false)
Definition: mailbox.hpp:504
old_environment & get_environment()

Here is the caller graph for this function:

template<typename TMsg>
void havoqgt::mpi::mailbox_routed< TMsg >::bcast_to_targets ( TMsg  _msg)
inline

Definition at line 306 of file mailbox.hpp.

306  {
307  assert(_msg.get_bcast());
308  for(uint32_t i=0; i<m_2d_comm.bcast_targets().size(); ++i) {
309  uint32_t target = m_2d_comm.bcast_targets()[i];
310  _msg.set_dest(target);
311  route_fast_path(target, _msg);
312  }
313  }
void route_fast_path(uint32_t dest, const routed_msg_type &_msg)
Definition: mailbox.hpp:271
const std::vector< uint32_t > & bcast_targets() const
Definition: mailbox.hpp:123

Here is the caller graph for this function:

template<typename TMsg>
void havoqgt::mpi::mailbox_routed< TMsg >::check_for_starvation ( )
inline

Definition at line 318 of file mailbox.hpp.

318  {
319  /*if(!m_list_pending.empty()) {
320  size_t to_check = m_list_pending.front();
321  size_t size = m_send_ticket_per_rank.size();
322  //size_t to_check = ++m_fair_checker % size;
323  if(m_send_counter > m_send_ticket_per_rank[to_check] + size) {
324  post_isend(to_check);
325  }
326  }*/
327  }

Here is the caller graph for this function:

template<typename TMsg>
void havoqgt::mpi::mailbox_routed< TMsg >::cleanup_pending_isend_requests ( bool  force_aggressive = false)
inlineprivate

If the number of current pending isends is less than user desired, just check the next fair bit. If the number is greater than desired, aggregsively check all bits.

Definition at line 504 of file mailbox.hpp.

504  {
505  while(!m_list_isends.empty()) {
507  if(!found) break;
508  }
509  }
std::list< size_t > m_list_isends
Definition: mailbox.hpp:538
bool cleanup_pending_isend_requests_index(size_t index)
Definition: mailbox.hpp:481

Here is the caller graph for this function:

template<typename TMsg>
bool havoqgt::mpi::mailbox_routed< TMsg >::cleanup_pending_isend_requests_index ( size_t  index)
inlineprivate

Definition at line 481 of file mailbox.hpp.

481  {
482  bool to_return = false;
483  if(m_list_isend_request_per_rank[index].empty()) return true;
484  while(!m_list_isend_request_per_rank[index].empty()) {
485  int flag(0);
486  MPI_Request* request_ptr = &(m_list_isend_request_per_rank[index].front().get<0>());
487  CHK_MPI( MPI_Test( request_ptr, &flag, MPI_STATUS_IGNORE) );
488  if(flag) {
489  free_msg_buffer(m_list_isend_request_per_rank[index].front().get<1>());
490  m_list_isends.erase(m_list_isend_request_per_rank[index].front().get<2>());
491  m_list_isend_request_per_rank[index].pop_front();
493  to_return = true;
494  } else {
495  break;
496  }
497  }
498  return to_return;
499  }
std::vector< std::list< boost::tuple< MPI_Request, void *, std::list< size_t >::iterator > > > m_list_isend_request_per_rank
Definition: mailbox.hpp:536
std::list< size_t > m_list_isends
Definition: mailbox.hpp:538
void free_msg_buffer(void *_ptr)
Definition: mailbox.hpp:439
#define CHK_MPI(a)
Definition: mpi.hpp:68

Here is the caller graph for this function:

template<typename TMsg>
int havoqgt::mpi::mailbox_routed< TMsg >::comm_rank ( ) const
inline

Definition at line 419 of file mailbox.hpp.

419 { return m_mpi_rank; }

Here is the caller graph for this function:

template<typename TMsg>
int havoqgt::mpi::mailbox_routed< TMsg >::comm_size ( ) const
inline

Definition at line 420 of file mailbox.hpp.

420 { return m_mpi_size; }

Here is the caller graph for this function:

template<typename TMsg>
void havoqgt::mpi::mailbox_routed< TMsg >::flush_buffers_if_idle ( )
inline

Definition at line 410 of file mailbox.hpp.

410  {
411  if(!m_list_pending.empty()) {
412  size_t index = m_list_pending.front();
413  if(m_num_pending_isend < 1 && !m_buffer_per_rank[index].empty()) {
414  post_isend(index);
415  }
416  }
417  }
void post_isend(int index)
Definition: mailbox.hpp:443
std::vector< msg_buffer > m_buffer_per_rank
Definition: mailbox.hpp:533
std::list< size_t > m_list_pending
Definition: mailbox.hpp:545

Here is the caller graph for this function:

template<typename TMsg>
void havoqgt::mpi::mailbox_routed< TMsg >::free_msg_buffer ( void *  _ptr)
inlineprivate

Definition at line 439 of file mailbox.hpp.

439  {
440  m_vec_free_buffers.push_back(_ptr);
441  }
std::vector< void * > m_vec_free_buffers
Definition: mailbox.hpp:532

Here is the caller graph for this function:

template<typename TMsg>
bool havoqgt::mpi::mailbox_routed< TMsg >::is_idle ( )
inline

Definition at line 405 of file mailbox.hpp.

405  {
408  }
void cleanup_pending_isend_requests(bool force_aggressive=false)
Definition: mailbox.hpp:504

Here is the caller graph for this function:

template<typename TMsg>
void havoqgt::mpi::mailbox_routed< TMsg >::post_isend ( int  index)
inlineprivate

Definition at line 443 of file mailbox.hpp.

443  {
444  if(m_buffer_per_rank[index].empty()) return;
446  int dest = index;
447  bool was_first_pending = false;
448  if(m_pending_iterator_per_rank[dest] != m_list_pending.end()) {
449  if(m_pending_iterator_per_rank[dest] == m_list_pending.begin()) {
450  was_first_pending = true;
451  }
454  }
455 
456  m_list_isends.push_back(index);
457  boost::tuple<MPI_Request, void*,std::list<size_t>::iterator> isend_req_tuple;
458  MPI_Request* request_ptr = &(isend_req_tuple.get<0>());
459  isend_req_tuple.get<1>() = m_buffer_per_rank[index].get_ptr();
460  isend_req_tuple.get<2>() = --m_list_isends.end();
461  void* buffer_ptr = m_buffer_per_rank[index].get_ptr();
462  int size_in_bytes = m_buffer_per_rank[index].size_in_bytes();
463 
464  CHK_MPI( MPI_Isend( buffer_ptr, size_in_bytes, MPI_BYTE, dest,
465  m_mpi_tag, m_mpi_comm, request_ptr) );
466 
468  m_buffer_per_rank[index].clear();
469  //int flag(0);
470  //CHK_MPI( MPI_Test( request_ptr, &flag, MPI_STATUS_IGNORE) );
471  //if(!flag) {
472  m_list_isend_request_per_rank[index].push_back(isend_req_tuple);
474  //}
476  if(!was_first_pending/* && m_tree_parent != index && m_tree_child1 != index && m_tree_child2 != index*/) {
477  post_isend(m_list_pending.front());
478  }
479  }
std::vector< std::list< boost::tuple< MPI_Request, void *, std::list< size_t >::iterator > > > m_list_isend_request_per_rank
Definition: mailbox.hpp:536
std::list< size_t > m_list_isends
Definition: mailbox.hpp:538
void post_isend(int index)
Definition: mailbox.hpp:443
MPI_Comm m_mpi_comm
MPI configuration.
Definition: mailbox.hpp:523
std::vector< msg_buffer > m_buffer_per_rank
Definition: mailbox.hpp:533
void cleanup_pending_isend_requests(bool force_aggressive=false)
Definition: mailbox.hpp:504
#define CHK_MPI(a)
Definition: mpi.hpp:68
std::vector< std::list< size_t >::iterator > m_pending_iterator_per_rank
Definition: mailbox.hpp:543
std::list< size_t > m_list_pending
Definition: mailbox.hpp:545

Here is the caller graph for this function:

template<typename TMsg>
void havoqgt::mpi::mailbox_routed< TMsg >::post_new_irecv ( void *  _buff)
inlineprivate

Definition at line 511 of file mailbox.hpp.

511  {
512  std::pair<MPI_Request, void*> irecv_req;
513  irecv_req.second = _buff;
514  MPI_Request* request_ptr = &(irecv_req.first);
515  int num_bytes = get_environment().mailbox_aggregation() * sizeof(routed_msg_type);
516  CHK_MPI( MPI_Irecv( _buff, num_bytes, MPI_BYTE, MPI_ANY_SOURCE,
517  m_mpi_tag, m_mpi_comm, request_ptr) );
518  m_list_irecv_request.push_back(irecv_req);
519  }
std::list< std::pair< MPI_Request, void * > > m_list_irecv_request
Definition: mailbox.hpp:539
MPI_Comm m_mpi_comm
MPI configuration.
Definition: mailbox.hpp:523
uint32_t mailbox_aggregation() const
Definition: environment.hpp:81
old_environment & get_environment()
#define CHK_MPI(a)
Definition: mpi.hpp:68

Here is the caller graph for this function:

template<typename TMsg>
template<typename OutputIterator >
void havoqgt::mpi::mailbox_routed< TMsg >::receive ( OutputIterator  _oitr,
bool  aggregsive = false 
)
inline

Definition at line 364 of file mailbox.hpp.

364  {
365  m_receiving = true;
366  m_last_recv_count = 0;
367  int flag(0);
368  //do {
369  if(!m_list_irecv_request.empty()) {
370  std::pair<MPI_Request, void* > pair_req = m_list_irecv_request.front();
371  m_list_irecv_request.pop_front();
372  MPI_Request* request_ptr = &(pair_req.first);
373  MPI_Status status;
374  CHK_MPI( MPI_Test( request_ptr, &flag, &status) );
375  if(flag) {
376  routed_msg_type* recv_ptr = static_cast<routed_msg_type*> (
377  pair_req.second );
378  int count(0);
379  CHK_MPI( MPI_Get_count(&status, MPI_BYTE, &count) );
380  for(size_t i=0; i<count/sizeof(routed_msg_type); ++i) {
381  if(recv_ptr[i].dest() == uint32_t(m_mpi_rank) /*|| recv_ptr[i].is_tree_op()*/) {
382  *_oitr = recv_ptr[i];//.msg;
383  ++_oitr;
384  ++m_recv_counter;
385  } else if(recv_ptr[i].get_bcast()) {
386  bcast_to_targets(recv_ptr[i]);
387  } else if(recv_ptr[i].is_intercept()) {
388  if( _oitr.intercept(recv_ptr[i]) ) {
389  route_fast_path(recv_ptr[i].dest(), recv_ptr[i]);
390  }
391  } else {
392  route_fast_path(recv_ptr[i].dest(), recv_ptr[i]);
393  }
394  }
395  post_new_irecv(recv_ptr);
396  } else {
397  m_list_irecv_request.push_front(pair_req);
398  }
399  }
400  //} while(flag);
401  m_receiving = false;
402  }
std::list< std::pair< MPI_Request, void * > > m_list_irecv_request
Definition: mailbox.hpp:539
void bcast_to_targets(TMsg _msg)
Definition: mailbox.hpp:306
void route_fast_path(uint32_t dest, const routed_msg_type &_msg)
Definition: mailbox.hpp:271
#define CHK_MPI(a)
Definition: mpi.hpp:68
void post_new_irecv(void *_buff)
Definition: mailbox.hpp:511

Here is the caller graph for this function:

template<typename TMsg>
void havoqgt::mpi::mailbox_routed< TMsg >::route_fast_path ( uint32_t  dest,
const routed_msg_type _msg 
)
inline

Definition at line 271 of file mailbox.hpp.

271  {
272  ++m_route_counter;
273  if(!m_buffer_per_rank[dest].is_init()) {
276  m_list_pending.push_back(dest);
278  }
279  size_t size = m_buffer_per_rank[dest].push_back(_msg);
280 
281  if(size == get_environment().mailbox_aggregation() ) {
282  post_isend(dest);
284  }
285  }
msg_buffer allocate_msg_buffer()
Definition: mailbox.hpp:424
void post_isend(int index)
Definition: mailbox.hpp:443
std::vector< msg_buffer > m_buffer_per_rank
Definition: mailbox.hpp:533
old_environment & get_environment()
std::vector< std::list< size_t >::iterator > m_pending_iterator_per_rank
Definition: mailbox.hpp:543
std::list< size_t > m_list_pending
Definition: mailbox.hpp:545

Here is the caller graph for this function:

template<typename TMsg>
template<typename OutputIterator >
void havoqgt::mpi::mailbox_routed< TMsg >::send ( int  raw_dest,
const TMsg &  _raw_msg,
OutputIterator  _oitr,
bool  fast = true 
)
inline

Definition at line 330 of file mailbox.hpp.

330  {
331  ++m_send_counter;
332  assert(raw_dest >= 0 && raw_dest < m_mpi_size);
333  //++m_last_recv_count;
334  assert(raw_dest != m_mpi_rank); // just dont send to self!
335  //routed_msg_type msg(raw_dest, _raw_msg);
336  routed_msg_type msg = _raw_msg; //@todo fixme
337  int dest = m_2d_comm.proxy_rank(raw_dest);
338  if(dest == m_mpi_rank) dest = raw_dest;
339  if(!m_buffer_per_rank[dest].is_init()) {
342  m_list_pending.push_back(dest);
344  }
345  size_t size = m_buffer_per_rank[dest].push_back(msg);
346 
347  if(size == get_environment().mailbox_aggregation() ) {
348  post_isend(dest);
350  if(m_receiving) return; //prevent receive recursion
351  do {
352  //cleanup_pending_isend_requests_index(dest);
354  receive(_oitr);
355  //} while(m_list_isend_request_per_rank[dest].size() > 1);
356  } while(m_num_pending_isend > get_environment().mailbox_num_isend());
357  }
358  //if(m_last_recv_count > 128) {
359  // receive(_oitr);
360  //}
361  }
msg_buffer allocate_msg_buffer()
Definition: mailbox.hpp:424
void receive(OutputIterator _oitr, bool aggregsive=false)
Definition: mailbox.hpp:364
void post_isend(int index)
Definition: mailbox.hpp:443
uint32_t proxy_rank(uint32_t dest)
Definition: mailbox.hpp:119
std::vector< msg_buffer > m_buffer_per_rank
Definition: mailbox.hpp:533
void cleanup_pending_isend_requests(bool force_aggressive=false)
Definition: mailbox.hpp:504
old_environment & get_environment()
std::vector< std::list< size_t >::iterator > m_pending_iterator_per_rank
Definition: mailbox.hpp:543
std::list< size_t > m_list_pending
Definition: mailbox.hpp:545

Here is the caller graph for this function:

template<typename TMsg>
void havoqgt::mpi::mailbox_routed< TMsg >::send_tree_children ( const TMsg &  _raw_msg)
inline

Definition at line 262 of file mailbox.hpp.

262  {
263  if(m_tree_child1 < m_mpi_size) {
264  send_tree_fast(m_tree_child1, _raw_msg);
265  if(m_tree_child2 < m_mpi_size) {
266  send_tree_fast(m_tree_child2, _raw_msg);
267  }
268  }
269  }
void send_tree_fast(int raw_dest, const TMsg &_raw_msg)
Definition: mailbox.hpp:241
template<typename TMsg>
void havoqgt::mpi::mailbox_routed< TMsg >::send_tree_fast ( int  raw_dest,
const TMsg &  _raw_msg 
)
inline

Definition at line 241 of file mailbox.hpp.

241  {
243  routed_msg_type msg(raw_dest, _raw_msg);
244  if(!m_buffer_per_rank[raw_dest].is_init()) {
247  m_list_pending.push_back(raw_dest);
248  m_pending_iterator_per_rank[raw_dest] = --m_list_pending.end();
249  }
250  size_t size = m_buffer_per_rank[raw_dest].push_back(msg);
251 
252  if(size >= get_environment().mailbox_tree_aggregation() ) {
253  post_isend(raw_dest);
255  }
256  }
msg_buffer allocate_msg_buffer()
Definition: mailbox.hpp:424
void post_isend(int index)
Definition: mailbox.hpp:443
std::vector< msg_buffer > m_buffer_per_rank
Definition: mailbox.hpp:533
old_environment & get_environment()
std::vector< std::list< size_t >::iterator > m_pending_iterator_per_rank
Definition: mailbox.hpp:543
std::list< size_t > m_list_pending
Definition: mailbox.hpp:545

Here is the caller graph for this function:

template<typename TMsg>
void havoqgt::mpi::mailbox_routed< TMsg >::send_tree_parent ( const TMsg &  _raw_msg)
inline

Definition at line 258 of file mailbox.hpp.

258  {
259  send_tree_fast(m_tree_parent, _raw_msg);
260  }
void send_tree_fast(int raw_dest, const TMsg &_raw_msg)
Definition: mailbox.hpp:241

Member Data Documentation

template<typename TMsg>
twod_router havoqgt::mpi::mailbox_routed< TMsg >::m_2d_comm
private

Definition at line 541 of file mailbox.hpp.

template<typename TMsg>
std::vector<msg_buffer> havoqgt::mpi::mailbox_routed< TMsg >::m_buffer_per_rank
private

Definition at line 533 of file mailbox.hpp.

template<typename TMsg>
size_t havoqgt::mpi::mailbox_routed< TMsg >::m_last_recv_count
private

Definition at line 530 of file mailbox.hpp.

template<typename TMsg>
std::list< std::pair<MPI_Request, void*> > havoqgt::mpi::mailbox_routed< TMsg >::m_list_irecv_request
private

Definition at line 539 of file mailbox.hpp.

template<typename TMsg>
std::vector< std::list< boost::tuple<MPI_Request, void*, std::list<size_t>::iterator > > > havoqgt::mpi::mailbox_routed< TMsg >::m_list_isend_request_per_rank
private

Definition at line 536 of file mailbox.hpp.

template<typename TMsg>
std::list<size_t> havoqgt::mpi::mailbox_routed< TMsg >::m_list_isends
private

Definition at line 538 of file mailbox.hpp.

template<typename TMsg>
std::list<size_t> havoqgt::mpi::mailbox_routed< TMsg >::m_list_pending
private

Definition at line 545 of file mailbox.hpp.

template<typename TMsg>
MPI_Comm havoqgt::mpi::mailbox_routed< TMsg >::m_mpi_comm
private

MPI configuration.

Definition at line 523 of file mailbox.hpp.

template<typename TMsg>
int havoqgt::mpi::mailbox_routed< TMsg >::m_mpi_rank
private

Definition at line 525 of file mailbox.hpp.

template<typename TMsg>
uint64_t havoqgt::mpi::mailbox_routed< TMsg >::m_mpi_send_counter
private

Definition at line 554 of file mailbox.hpp.

template<typename TMsg>
int havoqgt::mpi::mailbox_routed< TMsg >::m_mpi_size
private

Definition at line 526 of file mailbox.hpp.

template<typename TMsg>
int havoqgt::mpi::mailbox_routed< TMsg >::m_mpi_tag
private

Definition at line 524 of file mailbox.hpp.

template<typename TMsg>
size_t havoqgt::mpi::mailbox_routed< TMsg >::m_num_pending_isend
private

Definition at line 529 of file mailbox.hpp.

template<typename TMsg>
std::vector< std::list<size_t>::iterator > havoqgt::mpi::mailbox_routed< TMsg >::m_pending_iterator_per_rank
private

Definition at line 543 of file mailbox.hpp.

template<typename TMsg>
size_t havoqgt::mpi::mailbox_routed< TMsg >::m_pending_partial_buffers
private

Definition at line 528 of file mailbox.hpp.

template<typename TMsg>
bool havoqgt::mpi::mailbox_routed< TMsg >::m_receiving
private

Definition at line 551 of file mailbox.hpp.

template<typename TMsg>
uint64_t havoqgt::mpi::mailbox_routed< TMsg >::m_recv_counter
private

Definition at line 558 of file mailbox.hpp.

template<typename TMsg>
uint64_t havoqgt::mpi::mailbox_routed< TMsg >::m_route_counter
private

Definition at line 556 of file mailbox.hpp.

template<typename TMsg>
uint64_t havoqgt::mpi::mailbox_routed< TMsg >::m_send_counter
private

Definition at line 557 of file mailbox.hpp.

template<typename TMsg>
int havoqgt::mpi::mailbox_routed< TMsg >::m_tree_child1
private

Definition at line 548 of file mailbox.hpp.

template<typename TMsg>
int havoqgt::mpi::mailbox_routed< TMsg >::m_tree_child2
private

Definition at line 549 of file mailbox.hpp.

template<typename TMsg>
int havoqgt::mpi::mailbox_routed< TMsg >::m_tree_parent
private

Definition at line 547 of file mailbox.hpp.

template<typename TMsg>
uint64_t havoqgt::mpi::mailbox_routed< TMsg >::m_tree_send_counter
private

Definition at line 555 of file mailbox.hpp.

template<typename TMsg>
std::vector<void*> havoqgt::mpi::mailbox_routed< TMsg >::m_vec_free_buffers
private

Definition at line 532 of file mailbox.hpp.


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