added reading cell storage in customizer
This commit is contained in:
parent
ec3cda32fa
commit
dff8c48842
@ -33,6 +33,9 @@ using CellStorageView = detail::CellStorageImpl<true>;
|
|||||||
namespace io
|
namespace io
|
||||||
{
|
{
|
||||||
template <bool UseShareMemory>
|
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,
|
inline void write(const boost::filesystem::path &path,
|
||||||
const detail::CellStorageImpl<UseShareMemory> &storage);
|
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()};
|
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,
|
friend void io::write<UseShareMemory>(const boost::filesystem::path &path,
|
||||||
const detail::CellStorageImpl<UseShareMemory> &storage);
|
const detail::CellStorageImpl<UseShareMemory> &storage);
|
||||||
|
|
||||||
|
@ -33,6 +33,18 @@ template <> inline void write(const boost::filesystem::path &path, const MultiLe
|
|||||||
writer.SerializeVector(mlp.cell_to_children);
|
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)
|
template <> inline void write(const boost::filesystem::path &path, const CellStorage &storage)
|
||||||
{
|
{
|
||||||
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
|
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
|
||||||
|
@ -74,10 +74,11 @@ int Customizer::Run(const CustomizationConfig &config)
|
|||||||
<< edge_based_graph->GetNumberOfEdges() << " edges, "
|
<< edge_based_graph->GetNumberOfEdges() << " edges, "
|
||||||
<< edge_based_graph->GetNumberOfNodes() << " nodes";
|
<< edge_based_graph->GetNumberOfNodes() << " nodes";
|
||||||
|
|
||||||
osrm::partition::MultiLevelPartition mlp;
|
partition::MultiLevelPartition mlp;
|
||||||
partition::io::read(config.mld_partition_path, 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);
|
TIMER_STOP(loading_data);
|
||||||
util::Log() << "Loading partition data took " << TIMER_SEC(loading_data) << " seconds";
|
util::Log() << "Loading partition data took " << TIMER_SEC(loading_data) << " seconds";
|
||||||
|
|
||||||
|
@ -181,8 +181,14 @@ int Partitioner::Run(const PartitionConfig &config)
|
|||||||
TIMER_STOP(packed_mlp);
|
TIMER_STOP(packed_mlp);
|
||||||
util::Log() << "MultiLevelPartition constructed in " << TIMER_SEC(packed_mlp) << " seconds";
|
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);
|
TIMER_START(writing_mld_data);
|
||||||
io::write(config.mld_partition_path, mlp);
|
io::write(config.mld_partition_path, mlp);
|
||||||
|
io::write(config.mld_storage_path, storage);
|
||||||
TIMER_STOP(writing_mld_data);
|
TIMER_STOP(writing_mld_data);
|
||||||
util::Log() << "MLD data writing took " << TIMER_SEC(writing_mld_data) << " seconds";
|
util::Log() << "MLD data writing took " << TIMER_SEC(writing_mld_data) << " seconds";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user