Fix reading MLD data into shared memory block

This commit is contained in:
Michael Krasnyk 2017-03-07 19:19:54 +01:00 committed by Patrick Niklaus
parent e423aa5511
commit 264cec12e9
3 changed files with 34 additions and 14 deletions

View File

@ -1108,7 +1108,7 @@ class ContiguousInternalMemoryAlgorithmDataFacade<algorithm::MLD>
auto level_data = auto level_data =
*data_layout.GetBlockPtr<partition::MultiLevelPartitionView::LevelData>( *data_layout.GetBlockPtr<partition::MultiLevelPartitionView::LevelData>(
memory_block, storage::DataLayout::MLD_PARTITION); memory_block, storage::DataLayout::MLD_LEVEL_DATA);
auto mld_partition_ptr = data_layout.GetBlockPtr<partition::PartitionID>( auto mld_partition_ptr = data_layout.GetBlockPtr<partition::PartitionID>(
memory_block, storage::DataLayout::MLD_PARTITION); memory_block, storage::DataLayout::MLD_PARTITION);

View File

@ -82,6 +82,7 @@ class FileReader
template <typename T> void ReadInto(T *dest, const std::size_t count) template <typename T> void ReadInto(T *dest, const std::size_t count)
{ {
#if not defined __GNUC__ or __GNUC__ > 4 #if not defined __GNUC__ or __GNUC__ > 4
static_assert(!std::is_pointer<T>::value, "saving pointer types is not allowed");
static_assert(std::is_trivially_copyable<T>::value, static_assert(std::is_trivially_copyable<T>::value,
"bytewise reading requires trivially copyable type"); "bytewise reading requires trivially copyable type");
#endif #endif

View File

@ -971,10 +971,17 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
io::FileReader reader(config.mld_partition_path, io::FileReader::VerifyFingerprint); io::FileReader reader(config.mld_partition_path, io::FileReader::VerifyFingerprint);
reader.ReadInto(mld_level_data_ptr); reader.ReadInto(mld_level_data_ptr, 1);
reader.ReadInto(mld_partition_ptr, layout.GetBlockEntries(DataLayout::MLD_PARTITION));
reader.ReadInto(mld_chilren_ptr, std::uint64_t size;
layout.GetBlockEntries(DataLayout::MLD_CELL_TO_CHILDREN));
reader.ReadInto(size);
BOOST_ASSERT(size == layout.GetBlockEntries(DataLayout::MLD_PARTITION));
reader.ReadInto(mld_partition_ptr, size);
reader.ReadInto(size);
BOOST_ASSERT(size == layout.GetBlockEntries(DataLayout::MLD_CELL_TO_CHILDREN));
reader.ReadInto(mld_chilren_ptr, size);
} }
if (boost::filesystem::exists(config.mld_storage_path)) if (boost::filesystem::exists(config.mld_storage_path))
@ -991,15 +998,27 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
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, DataLayout::MLD_CELL_LEVEL_OFFSETS);
reader.ReadInto(mld_cell_weights_ptr, std::uint64_t size;
layout.GetBlockEntries(DataLayout::MLD_CELL_WEIGHTS));
reader.ReadInto(mld_source_boundary_ptr, reader.ReadInto(size);
layout.GetBlockEntries(DataLayout::MLD_CELL_SOURCE_BOUNDARY)); BOOST_ASSERT(size == layout.GetBlockEntries(DataLayout::MLD_CELL_WEIGHTS));
reader.ReadInto(mld_destination_boundary_ptr, reader.ReadInto(mld_cell_weights_ptr, size);
layout.GetBlockEntries(DataLayout::MLD_CELL_DESTINATION_BOUNDARY));
reader.ReadInto(mld_cells_ptr, layout.GetBlockEntries(DataLayout::MLD_CELLS)); reader.ReadInto(size);
reader.ReadInto(mld_cell_level_offsets_ptr, BOOST_ASSERT(size == layout.GetBlockEntries(DataLayout::MLD_CELL_SOURCE_BOUNDARY));
layout.GetBlockEntries(DataLayout::MLD_CELL_LEVEL_OFFSETS)); reader.ReadInto(mld_source_boundary_ptr, size);
reader.ReadInto(size);
BOOST_ASSERT(size == layout.GetBlockEntries(DataLayout::MLD_CELL_DESTINATION_BOUNDARY));
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.edge_based_graph_path)) if (boost::filesystem::exists(config.edge_based_graph_path))