Pull everthing in the facades

This commit is contained in:
Patrick Niklaus
2017-03-01 22:55:18 +00:00
committed by Patrick Niklaus
parent ff0a98196f
commit 108fce896b
17 changed files with 478 additions and 283 deletions
+3
View File
@@ -45,6 +45,9 @@ OSRM::OSRM(engine::EngineConfig &config)
case EngineConfig::Algorithm::CoreCH:
engine_ = std::make_unique<engine::Engine<engine::algorithm::CoreCH>>(config);
break;
case EngineConfig::Algorithm::MLD:
engine_ = std::make_unique<engine::Engine<engine::algorithm::MLD>>(config);
break;
default:
util::exception("Algorithm not implemented!");
}
+4 -4
View File
@@ -5,6 +5,7 @@
#include "partition/edge_based_graph_reader.hpp"
#include "partition/node_based_graph_to_edge_based_graph_mapping_reader.hpp"
#include "partition/recursive_bisection.hpp"
#include "partition/io.hpp"
#include "util/cell_storage.hpp"
#include "util/coordinate.hpp"
@@ -21,7 +22,6 @@
#include <vector>
#include <boost/assert.hpp>
#include <boost/container/small_vector.hpp>
#include "util/geojson_debug_logger.hpp"
#include "util/geojson_debug_policies.hpp"
@@ -203,7 +203,7 @@ int Partitioner::Run(const PartitionConfig &config)
// split bisection id bits into groups starting from SCC and stop at level 1
BOOST_ASSERT(recursive_bisection.SCCDepth() != 0);
int mask_from = sizeof(BisectionID) * CHAR_BIT - recursive_bisection.SCCDepth();
boost::container::small_vector<BisectionID, 8> level_masks;
std::vector<BisectionID> level_masks;
for (int mask_to = sizeof(BisectionID) * CHAR_BIT; mask_to > first_nonzero_position;
mask_to = mask_from, mask_from -= 3) // TODO: find better grouping
{
@@ -250,7 +250,7 @@ int Partitioner::Run(const PartitionConfig &config)
}
TIMER_START(packed_mlp);
osrm::util::PackedMultiLevelPartition<false> mlp{partitions, level_to_num_cells};
osrm::util::MultiLevelPartition mlp{partitions, level_to_num_cells};
TIMER_STOP(packed_mlp);
util::Log() << "PackedMultiLevelPartition constructed in " << TIMER_SEC(packed_mlp)
<< " seconds";
@@ -261,7 +261,7 @@ int Partitioner::Run(const PartitionConfig &config)
util::Log() << "CellStorage constructed in " << TIMER_SEC(cell_storage) << " seconds";
TIMER_START(writing_mld_data);
mlp.Write(config.mld_partition_path);
io::write(config.mld_partition_path, mlp);
storage.Write(config.mld_storage_path);
TIMER_STOP(writing_mld_data);
util::Log() << "MLD data writing took " << TIMER_SEC(writing_mld_data) << " seconds";
+24 -11
View File
@@ -400,12 +400,21 @@ void Storage::PopulateLayout(DataLayout &layout)
// Loading MLD Data
if (boost::filesystem::exists(config.mld_partition_path))
{
auto mld_partition_size = util::PackedMultiLevelPartition<true>().GetRequiredMemorySize(
config.mld_partition_path);
layout.SetBlockSize<char>(DataLayout::MLD_CELL_PARTITION, mld_partition_size);
io::FileReader reader(config.mld_partition_path, io::FileReader::VerifyFingerprint);
reader.Skip<util::MultiLevelPartition::LevelData>(1);
layout.SetBlockSize<util::MultiLevelPartition::LevelData>(DataLayout::MLD_LEVEL_DATA, 1);
const auto partition_entries_count = reader.ReadVectorSize<util::PartitionID>();
layout.SetBlockSize<util::PartitionID>(DataLayout::MLD_PARTITION, partition_entries_count);
const auto children_entries_count = reader.ReadVectorSize<util::CellID>();
layout.SetBlockSize<util::CellID>(DataLayout::MLD_CELL_TO_CHILDREN, children_entries_count);
}
else
layout.SetBlockSize<char>(DataLayout::MLD_CELL_PARTITION, 0);
{
layout.SetBlockSize<util::MultiLevelPartition::LevelData>(DataLayout::MLD_LEVEL_DATA, 0);
layout.SetBlockSize<util::PartitionID>(DataLayout::MLD_PARTITION, 0);
layout.SetBlockSize<util::CellID>(DataLayout::MLD_CELL_TO_CHILDREN, 0);
}
if (boost::filesystem::exists(config.mld_storage_path))
{
@@ -866,13 +875,17 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
{
// Loading MLD Data
const auto mld_partition_ptr =
layout.GetBlockPtr<char, true>(memory_ptr, DataLayout::MLD_CELL_PARTITION);
const auto mld_partition_size = layout.GetBlockSize(DataLayout::MLD_CELL_PARTITION);
if (boost::filesystem::exists(config.mld_partition_path))
{
util::PackedMultiLevelPartition<true>().Read(
config.mld_partition_path, mld_partition_ptr, mld_partition_ptr + mld_partition_size);
auto mld_level_data_ptr = layout.GetBlockPtr<util::MultiLevelPartition::LevelData, true>(memory_ptr, DataLayout::MLD_LEVEL_DATA);
auto mld_partition_ptr = layout.GetBlockPtr<util::PartitionID, true>(memory_ptr, DataLayout::MLD_PARTITION);
auto mld_chilren_ptr = layout.GetBlockPtr<util::CellID, true>(memory_ptr, DataLayout::MLD_CELL_TO_CHILDREN);
io::FileReader reader(config.mld_partition_path, io::FileReader::VerifyFingerprint);
reader.ReadInto(mld_level_data_ptr);
reader.ReadInto(mld_partition_ptr, layout.GetBlockEntries(DataLayout::MLD_PARTITION));
reader.ReadInto(mld_chilren_ptr, layout.GetBlockEntries(DataLayout::MLD_CELL_TO_CHILDREN));
}
const auto mld_cell_storage_ptr =
@@ -881,8 +894,8 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
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);
mld_cell_storage_ptr,
mld_cell_storage_ptr + mld_cell_storage_size);
}
}
}
+2 -2
View File
@@ -20,8 +20,8 @@ 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() + ".mld_partition"},
mld_storage_path{base.string() + ".mld_storage"}
mld_partition_path{base.string() + ".partition"},
mld_storage_path{base.string() + ".cell"}
{
}
+3 -1
View File
@@ -55,6 +55,8 @@ EngineConfig::Algorithm stringToAlgorithm(const std::string &algorithm)
return EngineConfig::Algorithm::CH;
if (algorithm == "CoreCH")
return EngineConfig::Algorithm::CoreCH;
if (algorithm == "MLD")
return EngineConfig::Algorithm::MLD;
throw util::exception("Invalid algorithm name: " + algorithm);
}
@@ -100,7 +102,7 @@ inline unsigned generateServerProgramOptions(const int argc,
"Load data from shared memory") //
("algorithm,a",
value<std::string>(&algorithm)->default_value("CH"),
"Algorithm to use for the data. Can be CH, CoreCH") //
"Algorithm to use for the data. Can be CH, CoreCH, MLD.") //
("max-viaroute-size",
value<int>(&max_locations_viaroute)->default_value(500),
"Max. locations supported in viaroute query") //