52 #ifndef HAVOQGT_MPI_DELEGATE_PARTITIONED_GRAPH_HPP_INCLUDED
53 #define HAVOQGT_MPI_DELEGATE_PARTITIONED_GRAPH_HPP_INCLUDED
61 #include <boost/unordered_set.hpp>
62 #include <boost/unordered_map.hpp>
63 #include <boost/container/map.hpp>
64 #include <boost/interprocess/containers/map.hpp>
65 #include <boost/interprocess/containers/vector.hpp>
66 #include <boost/interprocess/allocators/allocator.hpp>
76 #warning Debug MACRO is for delegate_partitioned_graph.
77 #define IS_DEBUGING true
79 #define IS_DEBUGING false
85 namespace bip = boost::interprocess;
97 template <
typename SegementManager>
113 template <
typename T,
typename Allocator>
116 template <
typename T,
typename SegManagerOther>
128 template <
typename Container>
131 Container& edges, uint64_t max_vertex,
132 uint64_t delegate_degree_threshold,
135 template <
typename Container>
137 MPI_Comm mpi_comm, Container& edges);
147 edge_iterator
edges_begin(vertex_locator locator)
const;
150 edge_iterator
edges_end(vertex_locator locator)
const;
153 uint64_t
degree(vertex_locator locator)
const;
168 template <
typename T,
typename SegManagerOther>
171 const char *obj_name =
nullptr)
const;
174 template <
typename T,
typename SegManagerOther>
176 const T& init, SegManagerOther*,
177 const char *obj_name =
nullptr)
const;
180 template <
typename T,
typename SegManagerOther>
183 const char *obj_name =
nullptr)
const;
186 template <
typename T,
typename SegManagerOther>
188 const T& init, SegManagerOther*,
189 const char *obj_name =
nullptr)
const;
212 typedef typename bip::vector<vertex_locator, SegmentAllocator<vertex_locator> >
260 return !(*
this == other);
269 boost::unordered_set<uint64_t>& global_hubs,
278 template <
typename Container>
281 template <
typename InputIterator>
283 InputIterator unsorted_itr_end,
284 boost::unordered_set<uint64_t>& global_hub_set);
287 template <
typename Container>
289 std::map< uint64_t, std::deque<OverflowSendInfo> > &transfer_info);
292 template <
typename InputIterator>
294 InputIterator unsorted_itr_end,
295 boost::unordered_set<uint64_t>& global_hub_set,
296 uint64_t delegate_degree_threshold);
299 void send_high_info(std::vector< boost::container::map< uint64_t, uint64_t> >&
300 maps_to_send,
int maps_to_send_element_count);
304 uint64_t delegate_degree_threshold,
305 std::vector< boost::container::map<
306 int, std::pair<uint64_t, uint64_t> > >& maps_to_send,
307 int maps_to_send_element_count);
315 std::map< uint64_t, std::deque<OverflowSendInfo> > &transfer_info);
367 bip::vector<vertex_locator, SegmentAllocator<vertex_locator> >
387 #endif //HAVOQGT_MPI_DELEGATE_PARTITIONED_GRAPH_HPP_INCLUDED
bool operator!=(delegate_partitioned_graph< SegementManager > &other)
bip::vector< vertex_locator, SegmentAllocator< vertex_locator > > m_controller_locators
edge_iterator edges_end(vertex_locator locator) const
Returns an end iterator for edges of a vertex.
uint64_t m_global_edge_count
uint64_t max_global_vertex_id()
size_t num_local_vertices() const
void count_edge_degrees(InputIterator unsorted_itr, InputIterator unsorted_itr_end, boost::unordered_set< uint64_t > &global_hub_set, uint64_t delegate_degree_threshold)
bip::vector< vertex_locator, SegmentAllocator< vertex_locator > >::const_iterator controller_iterator
vertex_iterator vertices_end() const
Returns an end iterator for all local vertices.
void partition_low_degree(Container &unsorted_edges)
bip::vector< uint64_t, SegmentAllocator< uint64_t > > m_delegate_info
bip::vector< uint32_t, SegmentAllocator< uint32_t > > m_local_outgoing_count
uint64_t m_edges_high_count
uint64_t degree(vertex_locator locator) const
Returns the degree of a vertex.
void send_high_info(std::vector< boost::container::map< uint64_t, uint64_t > > &maps_to_send, int maps_to_send_element_count)
bip::vector< uint64_t, SegmentAllocator< uint64_t > > m_delegate_label
uint64_t locator_to_label(vertex_locator locator) const
Converts a vertex_locator to the vertex label.
edge_iterator edges_begin(vertex_locator locator) const
Returns a begin iterator for edges of a vertex.
bip::map< uint64_t, vertex_locator, std::less< uint64_t >, SegmentAllocator< std::pair< const uint64_t, vertex_locator > > > m_map_delegate_locator
bool is_label_delegate(uint64_t label) const
Tests if vertex label is a delegate.
uint64_t max_local_vertex_id()
uint64_t local_degree(vertex_locator locator) const
Returns the local degree of a vertex.
size_t m_delegate_targets_size
size_t m_owned_targets_size
vertex_iterator vertices_begin() const
Returns a begin iterator for all local vertices.
ConstructionState m_graph_state
void send_vertex_info(uint64_t &high_vertex_count, uint64_t delegate_degree_threshold, std::vector< boost::container::map< int, std::pair< uint64_t, uint64_t > > > &maps_to_send, int maps_to_send_element_count)
controller_iterator controller_end() const
void complete_construction(const SegmentAllocator< void > &seg_allocator, MPI_Comm mpi_comm, Container &edges)
Edge storage allocation phase of graph construction.
uint32_t master(const vertex_locator &locator) const
void initialize_high_meta_data(boost::unordered_set< uint64_t > &global_hubs)
void partition_high_degree(Container &unsorted_edges, std::map< uint64_t, std::deque< OverflowSendInfo > > &transfer_info)
bool compare(delegate_partitioned_graph< SegementManager > *b)
bip::vector< vert_info, SegmentAllocator< vert_info > > m_owned_info
bip::vector< uint32_t, SegmentAllocator< uint32_t > > m_local_incoming_count
void generate_send_list(std::vector< uint64_t > &send_list, uint64_t num_send, int send_id, std::map< uint64_t, std::deque< OverflowSendInfo > > &transfer_info)
void sync_global_hub_set(const boost::unordered_set< uint64_t > &local_hubs, boost::unordered_set< uint64_t > &global_hubs, bool local_change)
Synchronizes hub set amongst all processes.
void initialize_edge_storage(const SegmentAllocator< void > &seg_allocator)
void calculate_overflow(std::map< uint64_t, std::deque< OverflowSendInfo > > &transfer_info)
vertex_locator label_to_locator(uint64_t label) const
Converts a vertex label to a vertex_locator.
bool operator==(delegate_partitioned_graph< SegementManager > &other)
uint64_t m_edges_low_count
bip::offset_ptr< vertex_locator > m_delegate_targets
void initialize_low_meta_data(boost::unordered_set< uint64_t > &global_hub_set)
bip::vector< uint64_t, SegmentAllocator< uint64_t > > m_delegate_degree
controller_iterator controller_begin() const
bip::vector< uint32_t, SegmentAllocator< uint32_t > > m_owned_info_tracker
bip::allocator< T, SegementManager > SegmentAllocator
uint64_t m_global_max_vertex
delegate_partitioned_graph(const SegmentAllocator< void > &seg_allocator, MPI_Comm mpi_comm, Container &edges, uint64_t max_vertex, uint64_t delegate_degree_threshold, ConstructionState stop_after=GraphReady)
Constructor that initializes given and unsorted sequence of edges.
uint64_t m_delegate_degree_threshold
void count_high_degree_edges(InputIterator unsorted_itr, InputIterator unsorted_itr_end, boost::unordered_set< uint64_t > &global_hub_set)
bip::offset_ptr< vertex_locator > m_owned_targets
size_t num_delegates() const
void print_graph_statistics()
vertex_data< T, SegManagerOther > * create_vertex_data(SegManagerOther *, const char *obj_name=nullptr) const
Creates vertex_data of type T.
edge_data< T, SegManagerOther > * create_edge_data(SegManagerOther *, const char *obj_name=nullptr) const
Creates edge_data of type T.