Dump memory usage stats after partitioning.
This commit is contained in:
parent
b789da45bd
commit
b62b09e5f6
@ -12,7 +12,8 @@ namespace osrm
|
||||
{
|
||||
namespace util
|
||||
{
|
||||
inline void DumpMemoryStats()
|
||||
|
||||
inline void DumpSTXXLStats()
|
||||
{
|
||||
#if STXXL_VERSION_MAJOR > 1 || (STXXL_VERSION_MAJOR == 1 && STXXL_VERSION_MINOR >= 4)
|
||||
auto manager = stxxl::block_manager::get_instance();
|
||||
@ -22,7 +23,10 @@ inline void DumpMemoryStats()
|
||||
#warning STXXL 1.4+ recommended - STXXL memory summary will not be available
|
||||
util::Log() << "STXXL: memory summary not available, needs STXXL 1.4 or higher";
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void DumpMemoryStats()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
rusage usage;
|
||||
getrusage(RUSAGE_SELF, &usage);
|
||||
@ -40,4 +44,4 @@ inline void DumpMemoryStats()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -96,13 +96,11 @@ void LogGeojson(const std::string &filename, std::vector<std::uint32_t> bisectio
|
||||
return x;
|
||||
};
|
||||
|
||||
|
||||
std::transform(bisection_ids.begin(),bisection_ids.end(),bisection_ids.begin(),reverse_bits);
|
||||
std::transform(bisection_ids.begin(), bisection_ids.end(), bisection_ids.begin(), reverse_bits);
|
||||
|
||||
printBisectionStats(bisection_ids, graph);
|
||||
std::vector<std::vector<util::Coordinate>> border_vertices(33);
|
||||
|
||||
|
||||
for (NodeID nid = 0; nid < graph.NumberOfNodes(); ++nid)
|
||||
{
|
||||
const auto source_id = bisection_ids[nid];
|
||||
|
@ -22,15 +22,30 @@ void printBisectionStats(std::vector<RecursiveBisectionState::BisectionID> const
|
||||
|
||||
std::unordered_set<RecursiveBisectionState::BisectionID> all_ids[32];
|
||||
|
||||
|
||||
std::uint32_t flag = 0;
|
||||
for (std::uint32_t level = 0; level < 32; ++level)
|
||||
{
|
||||
flag |= (1 << level);
|
||||
std::uint32_t bit = 1u << (31 - level);
|
||||
flag |= bit;
|
||||
|
||||
for (std::size_t i = 0; i < bisection_ids.size(); ++i)
|
||||
all_ids[level].insert(bisection_ids[i] & flag);
|
||||
|
||||
if (level > 0 && all_ids[level - 1] == all_ids[level])
|
||||
break;
|
||||
|
||||
std::cout << "Level" << std::endl;
|
||||
for (auto itr : all_ids[level])
|
||||
std::cout << "\t" << std::bitset<32>(itr) << std::endl;
|
||||
|
||||
for (const auto &node : graph.Nodes())
|
||||
{
|
||||
const auto bisection_id_node = bisection_ids[node.original_id];
|
||||
all_ids[level].insert(bisection_id_node&flag);
|
||||
|
||||
// subrange is not partitioned anymore
|
||||
if (all_ids[level].count((bisection_id_node & flag) ^ bit) == 0)
|
||||
continue;
|
||||
|
||||
auto is_border_node = false;
|
||||
for (const auto &edge : graph.Edges(node))
|
||||
{
|
||||
@ -38,7 +53,7 @@ void printBisectionStats(std::vector<RecursiveBisectionState::BisectionID> const
|
||||
is_border_node = true;
|
||||
}
|
||||
|
||||
if (is_border_node)
|
||||
if (is_border_node && level == 0)
|
||||
++total_border_nodes;
|
||||
|
||||
cell_sizes[level][bisection_id_node & flag]++;
|
||||
@ -86,11 +101,12 @@ void printBisectionStats(std::vector<RecursiveBisectionState::BisectionID> const
|
||||
<< total_border / (double)cell_sizes[level].size();
|
||||
|
||||
std::cout << " Cell Sizes: " << min_size << " " << max_size << " "
|
||||
<< total_size / (double)cell_sizes[level].size();
|
||||
<< total_size / (double)cell_sizes[level].size()
|
||||
<< " Total Vertices In Level: " << total_size;
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
} while (level < 31 && cell_sizes[level++].size() > 1);
|
||||
} while (level < 31 && cell_sizes[++level].size() > 1);
|
||||
}
|
||||
|
||||
} // namespace partition
|
||||
|
@ -181,6 +181,7 @@ int main(int argc, char *argv[]) try
|
||||
|
||||
auto exitcode = contractor::Contractor(contractor_config).Run();
|
||||
|
||||
util::DumpSTXXLStats();
|
||||
util::DumpMemoryStats();
|
||||
|
||||
return exitcode;
|
||||
|
@ -167,6 +167,7 @@ int main(int argc, char *argv[]) try
|
||||
extractor_config.profile_path.string().c_str());
|
||||
auto exitcode = extractor::Extractor(extractor_config).run(scripting_environment);
|
||||
|
||||
util::DumpSTXXLStats();
|
||||
util::DumpMemoryStats();
|
||||
|
||||
return exitcode;
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "partition/partitioner.hpp"
|
||||
|
||||
#include "util/log.hpp"
|
||||
#include "util/meminfo.hpp"
|
||||
#include "util/version.hpp"
|
||||
|
||||
#include <tbb/task_scheduler_init.h>
|
||||
@ -153,6 +154,9 @@ int main(int argc, char *argv[]) try
|
||||
}
|
||||
|
||||
auto exitcode = partition::Partitioner().Run(partition_config);
|
||||
|
||||
util::DumpMemoryStats();
|
||||
|
||||
return exitcode;
|
||||
}
|
||||
catch (const std::bad_alloc &e)
|
||||
|
@ -147,7 +147,6 @@ BOOST_AUTO_TEST_CASE(access_edges)
|
||||
BOOST_CHECK(std::abs(static_cast<int>(to_col(graph.GetID(node))) -
|
||||
static_cast<int>(to_col(itr.target))) <= 1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,12 +94,12 @@ BOOST_AUTO_TEST_CASE(separate_top_bottom_copy)
|
||||
BOOST_CHECK(id < left.NumberOfNodes());
|
||||
BOOST_CHECK_EQUAL(bisection_state.GetBisectionID(node.original_id), 0);
|
||||
|
||||
for( const auto & edge : left.Edges(id) )
|
||||
for (const auto &edge : left.Edges(id))
|
||||
BOOST_CHECK(edge.target < left.NumberOfNodes());
|
||||
}
|
||||
|
||||
BOOST_CHECK_EQUAL(right.NumberOfNodes(), 4);
|
||||
for( NodeID id = 0; id < right.NumberOfNodes(); ++id )
|
||||
for (NodeID id = 0; id < right.NumberOfNodes(); ++id)
|
||||
{
|
||||
const auto &node = right.Node(id);
|
||||
BOOST_CHECK_EQUAL(bisection_state.GetBisectionID(node.original_id), 1);
|
||||
|
Loading…
Reference in New Issue
Block a user