HavoqGT
havoqgt::mpi::high_edge_partitioner Class Reference

#include <edge_partitioner.hpp>

Public Member Functions

 high_edge_partitioner (int s, int r, std::map< uint64_t, std::deque< OverflowSendInfo >> *transfer_info)
 
int operator() (std::pair< uint64_t, uint64_t > i, bool is_counting=true)
 

Private Attributes

const int m_mpi_size
 
const int m_mpi_rank
 
std::map< uint64_t, std::deque< OverflowSendInfo > > * m_transfer_info
 

Detailed Description

Definition at line 119 of file edge_partitioner.hpp.

Constructor & Destructor Documentation

havoqgt::mpi::high_edge_partitioner::high_edge_partitioner ( int  s,
int  r,
std::map< uint64_t, std::deque< OverflowSendInfo >> *  transfer_info 
)
inlineexplicit

Definition at line 121 of file edge_partitioner.hpp.

123  : m_mpi_size(s)
124  , m_mpi_rank(r)
125  , m_transfer_info(transfer_info)
126  /*, m_dof(dof)*/ { }
std::map< uint64_t, std::deque< OverflowSendInfo > > * m_transfer_info

Member Function Documentation

int havoqgt::mpi::high_edge_partitioner::operator() ( std::pair< uint64_t, uint64_t >  i,
bool  is_counting = true 
)
inline

Determines where to send an edge. If the edge's destination is owned by another node, then the edge is sent to that node. Otherwise, it is sent to a node based on the transfer_info.

Parameters
is_countingdetermines how to adjust the send_count variavles
Returns
the node to send the passed edge to.

Definition at line 136 of file edge_partitioner.hpp.

136  {
137 
138 
139  int dest = int(i.second % m_mpi_size);
140  if (dest == m_mpi_rank) {
141  // If the current node is the destination, then determine the destination
142  // by examing the transfer_info object
143  const uint64_t delegate_id = i.first;
144  if (m_transfer_info->count(delegate_id) == 0) {
145  return m_mpi_rank;
146  }
147 
148  assert(m_transfer_info->at(delegate_id).size() > 0);
149 
150  if (is_counting) {
151  // If it is counting then use the temp_to_send_count, which is reset
152  // the next time this called with an edge with the same delegate_id and
153  // is_counting is set to false.
154  for (size_t j = 0; j < m_transfer_info->at(delegate_id).size(); j++) {
155  if (m_transfer_info->at(delegate_id)[j].temp_to_send_count <
156  m_transfer_info->at(delegate_id)[j].to_send_count) {
157  (m_transfer_info->at(delegate_id)[j].temp_to_send_count)++;
158 
159  // If this has an edge to send, return the send_id
160  return m_transfer_info->at(delegate_id)[j].to_send_id;
161  }
162  }
163  return m_mpi_rank;
164  } else {
165  // Not counting, so update the edge counts
166  dest = m_transfer_info->at(delegate_id).front().to_send_id;
167  //m_dof->send_of_delegate(delegate_id, dest);
168 
169  const int to_send_count =
170  m_transfer_info->at(delegate_id).front().to_send_count--;
171  assert(m_transfer_info->at(delegate_id).front().to_send_count >= 0);
172 
173  // Cleanup, if no more edges for this destination then remove it.
174  // If no more edges for this delaget remove it!
175  if (m_transfer_info->at(delegate_id).front().to_send_count == 0) {
176  m_transfer_info->at(delegate_id).pop_front();
177  if (m_transfer_info->at(delegate_id).size() == 0) {
178  m_transfer_info->erase(delegate_id);
179  }
180  } else {
181  // Otherwise reset the temp variable
182  m_transfer_info->at(delegate_id).front().temp_to_send_count = 0;
183  }
184  } // else not counting
185 
186  } else { // if dest == rank
187  // m_dof->send_delegate(delegate_id, dest);
188  }
189 
190  assert(dest >= 0);
191  assert(dest != m_mpi_rank);
192  return dest;
193  } // operator()
std::map< uint64_t, std::deque< OverflowSendInfo > > * m_transfer_info

Member Data Documentation

const int havoqgt::mpi::high_edge_partitioner::m_mpi_rank
private

Definition at line 197 of file edge_partitioner.hpp.

const int havoqgt::mpi::high_edge_partitioner::m_mpi_size
private

Definition at line 196 of file edge_partitioner.hpp.

std::map<uint64_t, std::deque<OverflowSendInfo> >* havoqgt::mpi::high_edge_partitioner::m_transfer_info
private

Definition at line 198 of file edge_partitioner.hpp.


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