-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Refactor update routines #3809
Conversation
943f3fb
to
f8a1cf6
Compare
395c51c
to
bc8a4c5
Compare
@@ -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 |
There was a problem hiding this comment.
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] || ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm unrelated changes?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful.
src/updater/updater.cpp
Outdated
new_weight += weight; | ||
} | ||
const auto durations = segment_data.GetForwardDurations(geometry_id.id); | ||
new_duration = std::accumulate(durations.begin(), durations.end(), 0); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
src/updater/updater.cpp
Outdated
new_weight += weight; | ||
} | ||
const auto durations = segment_data.GetReverseDurations(geometry_id.id); | ||
new_duration = std::accumulate(durations.begin(), durations.end(), 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
src/updater/updater.cpp
Outdated
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto
src/updater/updater.cpp
Outdated
|
||
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto
@daniel-j-h should have addressed all your comments, let me know if this works for you. |
There was a problem hiding this 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?)
src/updater/updater.cpp
Outdated
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())) |
There was a problem hiding this comment.
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()))
src/updater/updater.cpp
Outdated
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())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
e7b937b
to
0d33e3e
Compare
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
Relations
Implements #3737