added reading cell storage in customizer

This commit is contained in:
Michael Krasnyk 2017-03-07 15:43:41 +01:00 committed by Patrick Niklaus
parent ec3cda32fa
commit dff8c48842
4 changed files with 26 additions and 2 deletions

View File

@ -33,6 +33,9 @@ using CellStorageView = detail::CellStorageImpl<true>;
namespace io
{
template <bool UseShareMemory>
inline void read(const boost::filesystem::path &path,
detail::CellStorageImpl<UseShareMemory> &storage);
template <bool UseShareMemory>
inline void write(const boost::filesystem::path &path,
const detail::CellStorageImpl<UseShareMemory> &storage);
}
@ -346,6 +349,8 @@ template <bool UseShareMemory> class CellStorageImpl
cells[cell_index], weights.data(), source_boundary.data(), destination_boundary.data()};
}
friend void io::read<UseShareMemory>(const boost::filesystem::path &path,
detail::CellStorageImpl<UseShareMemory> &storage);
friend void io::write<UseShareMemory>(const boost::filesystem::path &path,
const detail::CellStorageImpl<UseShareMemory> &storage);

View File

@ -33,6 +33,18 @@ template <> inline void write(const boost::filesystem::path &path, const MultiLe
writer.SerializeVector(mlp.cell_to_children);
}
template <> inline void read(const boost::filesystem::path &path, CellStorage &storage)
{
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
storage::io::FileReader reader{path, fingerprint};
reader.DeserializeVector(storage.weights);
reader.DeserializeVector(storage.source_boundary);
reader.DeserializeVector(storage.destination_boundary);
reader.DeserializeVector(storage.cells);
reader.DeserializeVector(storage.level_to_cell_offset);
}
template <> inline void write(const boost::filesystem::path &path, const CellStorage &storage)
{
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;

View File

@ -74,10 +74,11 @@ int Customizer::Run(const CustomizationConfig &config)
<< edge_based_graph->GetNumberOfEdges() << " edges, "
<< edge_based_graph->GetNumberOfNodes() << " nodes";
osrm::partition::MultiLevelPartition mlp;
partition::MultiLevelPartition mlp;
partition::io::read(config.mld_partition_path, mlp);
partition::CellStorage storage(mlp, *edge_based_graph);
partition::CellStorage storage;
partition::io::read(config.mld_storage_path, storage);
TIMER_STOP(loading_data);
util::Log() << "Loading partition data took " << TIMER_SEC(loading_data) << " seconds";

View File

@ -181,8 +181,14 @@ int Partitioner::Run(const PartitionConfig &config)
TIMER_STOP(packed_mlp);
util::Log() << "MultiLevelPartition constructed in " << TIMER_SEC(packed_mlp) << " seconds";
TIMER_START(cell_storage);
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);
io::write(config.mld_storage_path, storage);
TIMER_STOP(writing_mld_data);
util::Log() << "MLD data writing took " << TIMER_SEC(writing_mld_data) << " seconds";