Integrate CellStorage into datafacade
This commit is contained in:
committed by
Patrick Niklaus
parent
ef71cc0d12
commit
694bf9d8b1
@@ -252,17 +252,17 @@ int Partitioner::Run(const PartitionConfig &config)
|
||||
TIMER_START(packed_mlp);
|
||||
osrm::util::MultiLevelPartition mlp{partitions, level_to_num_cells};
|
||||
TIMER_STOP(packed_mlp);
|
||||
util::Log() << "PackedMultiLevelPartition constructed in " << TIMER_SEC(packed_mlp)
|
||||
util::Log() << "MultiLevelPartition constructed in " << TIMER_SEC(packed_mlp)
|
||||
<< " seconds";
|
||||
|
||||
TIMER_START(cell_storage);
|
||||
osrm::util::CellStorage<false> storage(mlp, *edge_based_graph);
|
||||
osrm::util::CellStorage storage(mlp, *edge_based_graph);
|
||||
TIMER_STOP(cell_storage);
|
||||
util::Log() << "CellStorage constructed in " << TIMER_SEC(cell_storage) << " seconds";
|
||||
|
||||
TIMER_START(writing_mld_data);
|
||||
io::write(config.mld_partition_path, mlp);
|
||||
storage.Write(config.mld_storage_path);
|
||||
io::write(config.mld_storage_path, storage);
|
||||
TIMER_STOP(writing_mld_data);
|
||||
util::Log() << "MLD data writing took " << TIMER_SEC(writing_mld_data) << " seconds";
|
||||
}
|
||||
|
||||
+42
-10
@@ -422,12 +422,29 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
|
||||
if (boost::filesystem::exists(config.mld_storage_path))
|
||||
{
|
||||
auto mld_cell_storage_size =
|
||||
util::CellStorage<true>().GetRequiredMemorySize(config.mld_storage_path);
|
||||
layout.SetBlockSize<char>(DataLayout::MLD_CELL_STORAGE, mld_cell_storage_size);
|
||||
io::FileReader reader(config.mld_storage_path, io::FileReader::VerifyFingerprint);
|
||||
|
||||
const auto weights_count = reader.ReadVectorSize<EdgeWeight>();
|
||||
layout.SetBlockSize<EdgeWeight>(DataLayout::MLD_CELL_WEIGHTS, weights_count);
|
||||
const auto source_node_count = reader.ReadVectorSize<NodeID>();
|
||||
layout.SetBlockSize<NodeID>(DataLayout::MLD_CELL_SOURCE_BOUNDARY, source_node_count);
|
||||
const auto destination_node_count = reader.ReadVectorSize<NodeID>();
|
||||
layout.SetBlockSize<NodeID>(DataLayout::MLD_CELL_DESTINATION_BOUNDARY,
|
||||
destination_node_count);
|
||||
const auto cell_count = reader.ReadVectorSize<util::CellStorage::CellData>();
|
||||
layout.SetBlockSize<util::CellStorage::CellData>(DataLayout::MLD_CELLS, cell_count);
|
||||
const auto level_offsets_count = reader.ReadVectorSize<std::uint64_t>();
|
||||
layout.SetBlockSize<std::uint64_t>(DataLayout::MLD_CELL_LEVEL_OFFSETS,
|
||||
level_offsets_count);
|
||||
}
|
||||
else
|
||||
layout.SetBlockSize<char>(DataLayout::MLD_CELL_STORAGE, 0);
|
||||
{
|
||||
layout.SetBlockSize<char>(DataLayout::MLD_CELL_WEIGHTS, 0);
|
||||
layout.SetBlockSize<char>(DataLayout::MLD_CELL_SOURCE_BOUNDARY, 0);
|
||||
layout.SetBlockSize<char>(DataLayout::MLD_CELL_DESTINATION_BOUNDARY, 0);
|
||||
layout.SetBlockSize<char>(DataLayout::MLD_CELLS, 0);
|
||||
layout.SetBlockSize<char>(DataLayout::MLD_CELL_LEVEL_OFFSETS, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -897,14 +914,29 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
layout.GetBlockEntries(DataLayout::MLD_CELL_TO_CHILDREN));
|
||||
}
|
||||
|
||||
const auto mld_cell_storage_ptr =
|
||||
layout.GetBlockPtr<char, true>(memory_ptr, DataLayout::MLD_CELL_STORAGE);
|
||||
const auto mld_cell_storage_size = layout.GetBlockSize(DataLayout::MLD_CELL_STORAGE);
|
||||
if (boost::filesystem::exists(config.mld_storage_path))
|
||||
{
|
||||
util::CellStorage<true>().Read(config.mld_storage_path,
|
||||
mld_cell_storage_ptr,
|
||||
mld_cell_storage_ptr + mld_cell_storage_size);
|
||||
io::FileReader reader(config.mld_storage_path, io::FileReader::VerifyFingerprint);
|
||||
auto mld_cell_weights_ptr =
|
||||
layout.GetBlockPtr<EdgeWeight, true>(memory_ptr, DataLayout::MLD_CELL_WEIGHTS);
|
||||
auto mld_source_boundary_ptr =
|
||||
layout.GetBlockPtr<NodeID, true>(memory_ptr, DataLayout::MLD_CELL_SOURCE_BOUNDARY);
|
||||
auto mld_destination_boundary_ptr = layout.GetBlockPtr<NodeID, true>(
|
||||
memory_ptr, DataLayout::MLD_CELL_DESTINATION_BOUNDARY);
|
||||
auto mld_cells_ptr = layout.GetBlockPtr<util::CellStorage::CellData, true>(
|
||||
memory_ptr, DataLayout::MLD_CELLS);
|
||||
auto mld_cell_level_offsets_ptr = layout.GetBlockPtr<std::uint64_t, true>(
|
||||
memory_ptr, DataLayout::MLD_CELL_LEVEL_OFFSETS);
|
||||
|
||||
reader.ReadInto(mld_cell_weights_ptr,
|
||||
layout.GetBlockEntries(DataLayout::MLD_CELL_WEIGHTS));
|
||||
reader.ReadInto(mld_source_boundary_ptr,
|
||||
layout.GetBlockEntries(DataLayout::MLD_CELL_SOURCE_BOUNDARY));
|
||||
reader.ReadInto(mld_destination_boundary_ptr,
|
||||
layout.GetBlockEntries(DataLayout::MLD_CELL_DESTINATION_BOUNDARY));
|
||||
reader.ReadInto(mld_cells_ptr, layout.GetBlockEntries(DataLayout::MLD_CELLS));
|
||||
reader.ReadInto(mld_cell_level_offsets_ptr,
|
||||
layout.GetBlockEntries(DataLayout::MLD_CELL_LEVEL_OFFSETS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ StorageConfig::StorageConfig(const boost::filesystem::path &base)
|
||||
names_data_path{base.string() + ".names"}, properties_path{base.string() + ".properties"},
|
||||
intersection_class_path{base.string() + ".icd"}, turn_lane_data_path{base.string() + ".tld"},
|
||||
turn_lane_description_path{base.string() + ".tls"},
|
||||
mld_partition_path{base.string() + ".partition"}, mld_storage_path{base.string() + ".cell"}
|
||||
mld_partition_path{base.string() + ".partition"}, mld_storage_path{base.string() + ".cells"}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user