Adds a special graph for MLD with effcient boundary scan

This graph enables efficient boundary edge scans at each level.
Currenly this needs about |V|*|L| bytes of storage.
We can optimize this when the highest boundary nodes ID is << |V|.
This commit is contained in:
Patrick Niklaus
2017-03-07 03:59:28 +00:00
committed by Patrick Niklaus
parent 58681fa7ea
commit 655ca803d8
12 changed files with 518 additions and 131 deletions
+8 -6
View File
@@ -6,7 +6,6 @@
#include "partition/cell_storage.hpp"
#include "partition/edge_based_graph_reader.hpp"
#include "partition/io.hpp"
#include "partition/io.hpp"
#include "partition/multi_level_partition.hpp"
#include "updater/updater.hpp"
@@ -71,7 +70,8 @@ void CellStorageStatistics(const Graph &graph,
}
}
auto LoadAndUpdateEdgeExpandedGraph(const CustomizationConfig &config)
auto LoadAndUpdateEdgeExpandedGraph(const CustomizationConfig &config,
const partition::MultiLevelPartition &mlp)
{
updater::Updater updater(config.updater_config);
@@ -82,7 +82,9 @@ auto LoadAndUpdateEdgeExpandedGraph(const CustomizationConfig &config)
auto directed = partition::splitBidirectionalEdges(edge_based_edge_list);
auto tidied =
partition::prepareEdgesForUsageInGraph<StaticEdgeBasedGraphEdge>(std::move(directed));
auto edge_based_graph = std::make_unique<StaticEdgeBasedGraph>(num_nodes, std::move(tidied));
auto edge_based_graph =
std::make_unique<partition::MultiLevelGraph<EdgeBasedGraphEdgeData, false>>(
mlp, num_nodes, std::move(tidied));
util::Log() << "Loaded edge based graph for mapping partition ids: "
<< edge_based_graph->GetNumberOfEdges() << " edges, "
@@ -95,11 +97,11 @@ int Customizer::Run(const CustomizationConfig &config)
{
TIMER_START(loading_data);
auto edge_based_graph = LoadAndUpdateEdgeExpandedGraph(config);
partition::MultiLevelPartition mlp;
partition::io::read(config.mld_partition_path, mlp);
auto edge_based_graph = LoadAndUpdateEdgeExpandedGraph(config, mlp);
partition::CellStorage storage;
partition::io::read(config.mld_storage_path, storage);
TIMER_STOP(loading_data);
@@ -117,7 +119,7 @@ int Customizer::Run(const CustomizationConfig &config)
util::Log() << "MLD customization writing took " << TIMER_SEC(writing_mld_data) << " seconds";
TIMER_START(writing_graph);
io::write(config.mld_graph_path, *edge_based_graph);
partition::io::write(config.mld_graph_path, *edge_based_graph);
TIMER_STOP(writing_graph);
util::Log() << "Graph writing took " << TIMER_SEC(writing_graph) << " seconds";
+19 -8
View File
@@ -447,21 +447,27 @@ void Storage::PopulateLayout(DataLayout &layout)
io::FileReader reader(config.mld_graph_path, io::FileReader::VerifyFingerprint);
const auto num_nodes =
reader.ReadVectorSize<customizer::StaticEdgeBasedGraph::NodeArrayEntry>();
reader.ReadVectorSize<customizer::MultiLevelEdgeBasedGraph::NodeArrayEntry>();
const auto num_edges =
reader.ReadVectorSize<customizer::StaticEdgeBasedGraph::EdgeArrayEntry>();
reader.ReadVectorSize<customizer::MultiLevelEdgeBasedGraph::EdgeArrayEntry>();
const auto num_node_offsets =
reader.ReadVectorSize<customizer::MultiLevelEdgeBasedGraph::EdgeOffset>();
layout.SetBlockSize<customizer::StaticEdgeBasedGraph::NodeArrayEntry>(
layout.SetBlockSize<customizer::MultiLevelEdgeBasedGraph::NodeArrayEntry>(
DataLayout::MLD_GRAPH_NODE_LIST, num_nodes);
layout.SetBlockSize<customizer::StaticEdgeBasedGraph::EdgeArrayEntry>(
layout.SetBlockSize<customizer::MultiLevelEdgeBasedGraph::EdgeArrayEntry>(
DataLayout::MLD_GRAPH_EDGE_LIST, num_edges);
layout.SetBlockSize<customizer::MultiLevelEdgeBasedGraph::EdgeOffset>(
DataLayout::MLD_GRAPH_NODE_TO_OFFSET, num_node_offsets);
}
else
{
layout.SetBlockSize<customizer::StaticEdgeBasedGraph::NodeArrayEntry>(
layout.SetBlockSize<customizer::MultiLevelEdgeBasedGraph::NodeArrayEntry>(
DataLayout::MLD_GRAPH_NODE_LIST, 0);
layout.SetBlockSize<customizer::StaticEdgeBasedGraph::EdgeArrayEntry>(
layout.SetBlockSize<customizer::MultiLevelEdgeBasedGraph::EdgeArrayEntry>(
DataLayout::MLD_GRAPH_EDGE_LIST, 0);
layout.SetBlockSize<customizer::MultiLevelEdgeBasedGraph::EdgeOffset>(
DataLayout::MLD_GRAPH_NODE_TO_OFFSET, 0);
}
}
}
@@ -938,16 +944,21 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
io::FileReader reader(config.mld_graph_path, io::FileReader::VerifyFingerprint);
auto nodes_ptr =
layout.GetBlockPtr<customizer::StaticEdgeBasedGraph::NodeArrayEntry, true>(
layout.GetBlockPtr<customizer::MultiLevelEdgeBasedGraph::NodeArrayEntry, true>(
memory_ptr, DataLayout::MLD_GRAPH_NODE_LIST);
auto edges_ptr =
layout.GetBlockPtr<customizer::StaticEdgeBasedGraph::EdgeArrayEntry, true>(
layout.GetBlockPtr<customizer::MultiLevelEdgeBasedGraph::EdgeArrayEntry, true>(
memory_ptr, DataLayout::MLD_GRAPH_EDGE_LIST);
auto node_to_offset_ptr =
layout.GetBlockPtr<customizer::MultiLevelEdgeBasedGraph::EdgeOffset, true>(
memory_ptr, DataLayout::MLD_GRAPH_NODE_TO_OFFSET);
auto num_nodes = reader.ReadElementCount64();
reader.ReadInto(nodes_ptr, num_nodes);
auto num_edges = reader.ReadElementCount64();
reader.ReadInto(edges_ptr, num_edges);
auto num_node_to_offset = reader.ReadElementCount64();
reader.ReadInto(node_to_offset_ptr, num_node_to_offset);
}
}
}