Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor update routines #3809

Merged
merged 18 commits into from
Mar 17, 2017
Merged

Refactor update routines #3809

merged 18 commits into from
Mar 17, 2017

Conversation

TheMarex
Copy link
Member

@TheMarex TheMarex commented Mar 11, 2017

Issue

This continue #3785 to make the update code easier to read and simplify logic.

On my test dataset the update speed was slightly faster then before, but the CSV parsing dominates almost all processing time.

Tasklist

  • review
  • Update wiki of changed files
  • adjust for comments

Relations

Implements #3737

@TheMarex TheMarex force-pushed the refactor/split-updater branch 6 times, most recently from 943f3fb to f8a1cf6 Compare March 14, 2017 21:26
@TheMarex TheMarex requested review from daniel-j-h and danpat March 15, 2017 22:29
@TheMarex TheMarex force-pushed the refactor/split-updater branch 2 times, most recently from 395c51c to bc8a4c5 Compare March 15, 2017 23:53
@@ -4,6 +4,8 @@
- Shared memory notification via conditional variables on Linux or semaphore queue on OS X and Windows with a limit of 128 OSRM Engine instances
- Files
- .osrm.datasource_index file was removed. Data is now part of .osrm.geometries.
- .osrm.edge_lookup was removed. The option `--generate-edge-lookup` does nothing now.
- `osrm-contract` does not depend on the `.osrm.fileIndex` file anymore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the wiki for these changes

return cb(new Error('Annotation not found in response', a_type));
got[k] = annotation[a_type];
got[k] = annotation && annotation[a_type] || '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm unrelated changes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed this while debugging a failing test. Cucumber crashes instead of just failing the test case.

@@ -20,6 +20,9 @@ std::vector<ContractorEdge> adaptToContractorInput(InputEdgeContainer input_edge

for (const auto &input_edge : input_edge_list)
{
if (input_edge.data.weight == INVALID_EDGE_WEIGHT)
continue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait this is a bug in master? Should this be backported to the 5.6 branch?

Copy link
Member Author

@TheMarex TheMarex Mar 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No previously we filtered these edges out the edge loading routine. We were loading one struct at a time, so we could just skip them.

{
return fwd_durations[index[id] + 1 + offset];
const auto begin = nodes.begin() + index.at(id);
const auto end = nodes.begin() + index.at(id + 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i[id] vs i.at(id) - seems like you changed all subscript operators to at?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, don't remember doing this change. oO

auto GetReverseGeometry(const DirectionalGeometryID id)
{
return boost::adaptors::reverse(GetForwardGeometry(id));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful.

new_weight += weight;
}
const auto durations = segment_data.GetForwardDurations(geometry_id.id);
new_duration = std::accumulate(durations.begin(), durations.end(), 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typed init

if (weight == INVALID_EDGE_WEIGHT)
{
new_weight = INVALID_EDGE_WEIGHT;
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

new_weight += weight;
}
const auto durations = segment_data.GetReverseDurations(geometry_id.id);
new_duration = std::accumulate(durations.begin(), durations.end(), 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

if (updated_segments.size() > 0)
{
tbb::parallel_for(tbb::blocked_range<std::size_t>(0, edge_based_edge_list.size()),
[&](const tbb::blocked_range<std::size_t> &range) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto


std::vector<WeightAndDuration> accumulated_segment_data(updated_segments.size());
tbb::parallel_for(tbb::blocked_range<std::size_t>(0, updated_segments.size()),
[&](const tbb::blocked_range<std::size_t> &range) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto

@TheMarex
Copy link
Member Author

@daniel-j-h should have addressed all your comments, let me know if this works for you.

Copy link
Contributor

@oxidase oxidase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One fix is required, also it fixes already #3831, but osrm-contract with sanitizer still can hang

EDIT: looks like sanitizer hangs at exit

(gdb) bt
#0  0x000000000068b06e in __sanitizer::BlockingMutex::Lock() ()
#1  0x00000000006763f3 in __asan::AppendToErrorMessageBuffer(char const*) ()
#2  0x000000000068d68a in __sanitizer::SharedPrintfCode(bool, char const*, __va_list_tag*) ()
#3  0x000000000068d804 in __sanitizer::Report(char const*, ...) ()
#4  0x000000000069ec20 in __lsan::CheckForLeaksCallback(__sanitizer::SuspendedThreadsList const&, void*) ()
#5  0x000000000069b57d in __sanitizer::TracerThread(void*) ()
#6  0x000000000068bb87 in __sanitizer::internal_clone(int (*)(void*), void*, int, void*, int*, void*, int*) ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

auto fwd_durations_range = segment_data.GetForwardDurations(geometry_id);
auto fwd_datasources_range = segment_data.GetForwardDatasources(geometry_id);
bool fwd_was_updated = false;
for (const auto segment_offset : util::irange(0, fwd_weights_range.size()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SFINAE fails for (int, size_t) -> util::irange<std::size_t>(0, fwd_weights_range.size()))

boost::adaptors::reverse(segment_data.GetReverseDatasources(geometry_id));
bool rev_was_updated = false;

for (const auto segment_offset : util::irange(0, rev_weights_range.size()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

@oxidase oxidase mentioned this pull request Mar 17, 2017
5 tasks
@TheMarex TheMarex force-pushed the refactor/split-updater branch from e7b937b to 0d33e3e Compare March 17, 2017 10:41
@TheMarex TheMarex merged commit bf6698f into master Mar 17, 2017
@TheMarex TheMarex deleted the refactor/split-updater branch March 17, 2017 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants