Load data directly into CellStorageView
This commit is contained in:
parent
c87ce2dede
commit
4e3009260c
@ -926,39 +926,46 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
|||||||
|
|
||||||
if (boost::filesystem::exists(config.mld_storage_path))
|
if (boost::filesystem::exists(config.mld_storage_path))
|
||||||
{
|
{
|
||||||
io::FileReader reader(config.mld_storage_path, io::FileReader::VerifyFingerprint);
|
BOOST_ASSERT(layout.GetBlockSize(storage::DataLayout::MLD_CELLS) > 0);
|
||||||
auto mld_cell_weights_ptr =
|
BOOST_ASSERT(layout.GetBlockSize(storage::DataLayout::MLD_CELL_LEVEL_OFFSETS) > 0);
|
||||||
layout.GetBlockPtr<EdgeWeight, true>(memory_ptr, DataLayout::MLD_CELL_WEIGHTS);
|
|
||||||
auto mld_source_boundary_ptr =
|
auto mld_cell_weights_ptr = layout.GetBlockPtr<EdgeWeight, true>(
|
||||||
layout.GetBlockPtr<NodeID, true>(memory_ptr, DataLayout::MLD_CELL_SOURCE_BOUNDARY);
|
memory_ptr, storage::DataLayout::MLD_CELL_WEIGHTS);
|
||||||
|
auto mld_source_boundary_ptr = layout.GetBlockPtr<NodeID, true>(
|
||||||
|
memory_ptr, storage::DataLayout::MLD_CELL_SOURCE_BOUNDARY);
|
||||||
auto mld_destination_boundary_ptr = layout.GetBlockPtr<NodeID, true>(
|
auto mld_destination_boundary_ptr = layout.GetBlockPtr<NodeID, true>(
|
||||||
memory_ptr, DataLayout::MLD_CELL_DESTINATION_BOUNDARY);
|
memory_ptr, storage::DataLayout::MLD_CELL_DESTINATION_BOUNDARY);
|
||||||
auto mld_cells_ptr = layout.GetBlockPtr<partition::CellStorage::CellData, true>(
|
auto mld_cells_ptr = layout.GetBlockPtr<partition::CellStorageView::CellData, true>(
|
||||||
memory_ptr, DataLayout::MLD_CELLS);
|
memory_ptr, storage::DataLayout::MLD_CELLS);
|
||||||
auto mld_cell_level_offsets_ptr = layout.GetBlockPtr<std::uint64_t, true>(
|
auto mld_cell_level_offsets_ptr = layout.GetBlockPtr<std::uint64_t, true>(
|
||||||
memory_ptr, DataLayout::MLD_CELL_LEVEL_OFFSETS);
|
memory_ptr, storage::DataLayout::MLD_CELL_LEVEL_OFFSETS);
|
||||||
|
|
||||||
std::uint64_t size;
|
auto weight_entries_count =
|
||||||
|
layout.GetBlockEntries(storage::DataLayout::MLD_CELL_WEIGHTS);
|
||||||
|
auto source_boundary_entries_count =
|
||||||
|
layout.GetBlockEntries(storage::DataLayout::MLD_CELL_SOURCE_BOUNDARY);
|
||||||
|
auto destination_boundary_entries_count =
|
||||||
|
layout.GetBlockEntries(storage::DataLayout::MLD_CELL_DESTINATION_BOUNDARY);
|
||||||
|
auto cells_entries_counts = layout.GetBlockEntries(storage::DataLayout::MLD_CELLS);
|
||||||
|
auto cell_level_offsets_entries_count =
|
||||||
|
layout.GetBlockEntries(storage::DataLayout::MLD_CELL_LEVEL_OFFSETS);
|
||||||
|
|
||||||
reader.ReadInto(size);
|
util::vector_view<EdgeWeight> weights(mld_cell_weights_ptr, weight_entries_count);
|
||||||
BOOST_ASSERT(size == layout.GetBlockEntries(DataLayout::MLD_CELL_WEIGHTS));
|
util::vector_view<NodeID> source_boundary(mld_source_boundary_ptr,
|
||||||
reader.ReadInto(mld_cell_weights_ptr, size);
|
source_boundary_entries_count);
|
||||||
|
util::vector_view<NodeID> destination_boundary(mld_destination_boundary_ptr,
|
||||||
|
destination_boundary_entries_count);
|
||||||
|
util::vector_view<partition::CellStorageView::CellData> cells(mld_cells_ptr,
|
||||||
|
cells_entries_counts);
|
||||||
|
util::vector_view<std::uint64_t> level_offsets(mld_cell_level_offsets_ptr,
|
||||||
|
cell_level_offsets_entries_count);
|
||||||
|
|
||||||
reader.ReadInto(size);
|
partition::CellStorageView storage{std::move(weights),
|
||||||
BOOST_ASSERT(size == layout.GetBlockEntries(DataLayout::MLD_CELL_SOURCE_BOUNDARY));
|
std::move(source_boundary),
|
||||||
reader.ReadInto(mld_source_boundary_ptr, size);
|
std::move(destination_boundary),
|
||||||
|
std::move(cells),
|
||||||
reader.ReadInto(size);
|
std::move(level_offsets)};
|
||||||
BOOST_ASSERT(size == layout.GetBlockEntries(DataLayout::MLD_CELL_DESTINATION_BOUNDARY));
|
partition::files::readCells(config.mld_storage_path, storage);
|
||||||
reader.ReadInto(mld_destination_boundary_ptr, size);
|
|
||||||
|
|
||||||
reader.ReadInto(size);
|
|
||||||
BOOST_ASSERT(size == layout.GetBlockEntries(DataLayout::MLD_CELLS));
|
|
||||||
reader.ReadInto(mld_cells_ptr, size);
|
|
||||||
|
|
||||||
reader.ReadInto(size);
|
|
||||||
BOOST_ASSERT(size == layout.GetBlockEntries(DataLayout::MLD_CELL_LEVEL_OFFSETS));
|
|
||||||
reader.ReadInto(mld_cell_level_offsets_ptr, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boost::filesystem::exists(config.mld_graph_path))
|
if (boost::filesystem::exists(config.mld_graph_path))
|
||||||
|
Loading…
Reference in New Issue
Block a user