Commit Graph

375 Commits

Author SHA1 Message Date
Michael Krasnyk
c8b75c9046 Use thread-safe lock-free assignment in PackedVector::set_value
PR uses TBB internal atomic's for atomic CAS on non-atomic data

Corresponding PR https://github.com/Project-OSRM/osrm-backend/pull/4199

Other options:

* use sequential update

* use an internal packed vector lock -> makes packed vector non-movable

* use boost.interprocess atomics implementation -> outdated and only 32 bit version

* use glib atomic's -> requires new dependency

*  wait for https://isocpp.org/blog/2014/05/n4013 as_atomic

*  use c11 _Atomic and atomic_compare_exchange_weak -> not possible to mix c++11 and c11

* use builtin functions gcc __sync_bool_compare_and_swap and msvc _InterlockedCompareExchange64 -> possible, but requires proper testing

boolean CompareAndSwapPointer(volatile * void * ptr,
                              void * new_value,
                              void * old_value) {
if defined(_MSC_VER)
   if (InterlockedCompareExchange(ptr, new_value, old_value) == old_value) return false;
   else return true;
elif (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100
   return __sync_bool_compare_and_swap(ptr, old_value, new_value);
else
  error No implementation
endif
}

* use Boost.Atomic -> requires new dependency

        WordT local_lower_word = lower_word, new_lower_word;
        do
        {
            new_lower_word = set_lower_value<WordT, T>(local_lower_word,
                                                       lower_mask[internal_index.element],
                                                       lower_offset[internal_index.element],
                                                       value);
        } while (!boost::atomics::detail::operations<sizeof(WordT), false>::compare_exchange_weak(
            lower_word,
            local_lower_word,
            new_lower_word,
            boost::memory_order_release,
            boost::memory_order_relaxed));
2017-06-27 13:02:53 +02:00
Patrick Niklaus
dd8f5ac01d Make EMPTY_ENTRY_CLASS constexpr 2017-06-27 09:58:19 +00:00
Patrick Niklaus
22479ff5d8 Avoid dead-lock if other = this 2017-06-27 09:58:19 +00:00
Patrick Niklaus
e5464526c8 Port isc file 2017-06-27 09:58:19 +00:00
Patrick Niklaus
37b8d3acd4 Refactor turn lane passing 2017-06-27 09:58:19 +00:00
Patrick Niklaus
7fb57c924f Explicitly implement move constructor for DeallocationVector 2017-06-23 09:22:30 +00:00
Patrick Niklaus
97592e5bc3 Refactor file writing in OSRM contract 2017-06-23 09:22:30 +00:00
Daniel Patterson
35550d8c0a Parallelize generation of the edge-expanded-edges. 2017-06-15 09:05:45 +00:00
Daniel J. Hofmann
b68d79407e Takes fn by forwarding ref. in for_each_pair, resolves #4148 2017-06-14 15:17:26 +00:00
Daniel Patterson
3d77714c36 Make most command-line tools return useful error codes on well-known exceptions. 2017-06-08 15:03:24 +00:00
Patrick Niklaus
0d12d2fd28 Merge pull request #4094 from Project-OSRM/refactor/rapidash
Replace timezone shapefile parsing with geojson parsing
2017-06-02 20:01:04 +00:00
Patrick Niklaus
10460fc2fb Fix PR comments 2017-06-02 18:46:21 +00:00
Patrick Niklaus
0266c9d969 Renumber nodes after running osrm-partition
The new numbering uses the partition information
to sort border nodes first to compactify storages
that need access indexed by border node ID.

We also get an optimized cache performance for free
sincr we can also recursively sort the nodes by cell ID.

This implements issue #3779.
2017-06-02 18:12:13 +00:00
Patrick Niklaus
a195d7dfd3 Remove compiler errors and use 32bit for segment_index 2017-06-02 12:15:06 +00:00
Daniel Patterson
1c3cb897c1 Refactor RTree so that .fileIndex only contains EdgeDataT, and all r-tree structure is in the .ramIndex file.
Also tunes the BRANCHING_FACTOR a bit to speed up access with this new layout.
2017-06-02 12:15:06 +00:00
karenzshea
65746edd2d deps and lint 2017-06-02 10:00:07 +02:00
karenzshea
63ea75612b by default restrictions are off if timezone is not found 2017-06-02 10:00:07 +02:00
karenzshea
564a29141e add testing geojson files 2017-06-02 10:00:07 +02:00
karenzshea
c937d20e48 unit tests for geojson validation 2017-06-02 10:00:07 +02:00
karenzshea
ca353eb7db refactor timezoner a bit for unit tests, add initial unit tests 2017-06-02 10:00:07 +02:00
karenzshea
f268163ea0 remove shapefile dependency from build 2017-06-02 10:00:07 +02:00
karenzshea
6f41e3faf1 fixes to get compiling 2017-06-02 10:00:07 +02:00
karenzshea
aed2c0124a rapidjson steppin in 2017-06-02 10:00:07 +02:00
Moritz Kobitzsch
ceaf065d0e don't collapse highway ramps into uturns (#4074) 2017-06-01 12:39:10 +02:00
Daniel Patterson
7eab227ab1 Use FileWriter for better error handling when writing name data. 2017-05-29 15:09:36 +00:00
Daniel Patterson
382a5cebab Use FileWriter for writing LeafNode data to improve error handling. 2017-05-29 15:09:36 +00:00
Daniel Patterson
570d81c6dd Bypass boost::numeric_cast checks for coordinate values that have already been validated (#4059)
(i.e. stuff that's stored in our datafiles).  Keep those checks for user-supplied values
(i.e. coordinates coming from files during preprocessing, or coordinates supplied by users
 during requests)
2017-05-19 10:52:44 -07:00
Patrick Niklaus
3599d1db8e Switch code to use packed vector for segment weights/durations 2017-05-19 08:25:03 +00:00
Michael Krasnyk
7a4c5a64fa Simplify angleBetween to avoid cancellation losses 2017-05-17 15:52:11 +00:00
Michael Krasnyk
14db5f8d1f Fix OSRM_ASSERT_MSG compilation fail in Release mode 2017-05-17 15:52:11 +00:00
Michael Krasnyk
26702920b4 Move ComponentID to EdgeBasedNodeDataContainer 2017-05-17 15:21:51 +00:00
Patrick Niklaus
6bd724fe24 Rewrite packed vector to also allow random access
This fixes issues #3952. The new approach pre-computes masks for fast
access. Since elements can potentially span multiple words we need masks
and offsets for each upper and lower word.

Due to a bug in the C++14 standart the mask computation is not
recognized as constexpr, but would work on C++17.
2017-05-16 10:25:29 +00:00
Karen Shea
799a677e7a Conditional turn restriction support (#3841)
* optionally include condition and via node coords in InputRestrictionContainer

* only write conditionals to disk, custom serialization for restrictions

* conditional turn lookup, reuse timezone validation from
extract-conditionals

* adapt updater to use coordinates/osm ids, remove internal to external map

* add utc time now parameter to contraction

* only compile timezone code where libshp is found, adapt test running

* slight refactor, more tests

* catch invalid via nodes in restriction parsing, set default cucumber
origin to guinée

* add another run to test mld routed paths

* cosmetic review changes

* Simplify Timezoner for windows build

* Split declaration and parsing parts for opening hours

* adjust conditional tests to run without shapefiles

* always include parse conditionals option

* Adjust travis timeout

* Added dummy TZ shapefile with test timezone polygons

* [skip ci] update changelog
2017-05-11 12:13:52 +02:00
Michael Krasnyk
07c7cb3c6c Rename BinaryHeap to QueryHeap 2017-05-02 15:54:25 +00:00
Michael Krasnyk
358aebec4d Decrease memory footprint of HeapHandle from 32 to 24 bytes 2017-05-02 15:54:25 +00:00
Michael Krasnyk
05826150f6 Use boost::heap::d_ary_heap 2017-05-02 15:54:25 +00:00
Patrick Niklaus
0e39aa9488 Address PR comments 2017-04-24 16:04:41 +00:00
Patrick Niklaus
8ec0745883 Add benchmark 2017-04-24 16:04:41 +00:00
Patrick Niklaus
c446b017ef Switch from macro based StrongTypedef to template version 2017-04-24 16:04:41 +00:00
Patrick Niklaus
814324146b signed -> unsigned 2017-04-20 14:58:26 +00:00
Patrick Niklaus
11d8b2ba5a Add clipping for 20 bits to SegmentWeight/SegmentDuration 2017-04-20 14:58:26 +00:00
Patrick Niklaus
d6c6a262d8 Use 16bit for SegmentWeight and SegmentDuration 2017-04-20 14:58:26 +00:00
Patrick Niklaus
e96545be2e Disable is_integral check because it fails for strong-type-def 2017-04-18 17:24:46 +00:00
Patrick Niklaus
609801ae99 Fix PR comments 2017-04-18 17:24:46 +00:00
Patrick Niklaus
a66918a303 Make PackedVector generic 2017-04-18 17:24:46 +00:00
Pepijn Schoen
b830a8f942 Replace Count32 with Count64 2017-04-18 12:01:06 +00:00
Pepijn Schoen
85ec50552d fingerprint .ramIndex / tree nodes 2017-04-18 12:01:06 +00:00
Patrick Niklaus
da474a16a9 Fix formating 2017-04-10 17:25:02 +00:00
Patrick Niklaus
59bbfeb67f Buffer turn data on disk to save memory 2017-04-10 17:25:02 +00:00
Patrick Niklaus
85454857d3 Use default move function 2017-04-06 15:42:38 +00:00