From d473acb56deff07cebbbe95453a501c51135e35a Mon Sep 17 00:00:00 2001 From: Moritz Kobitzsch Date: Wed, 15 Feb 2017 10:19:33 +0100 Subject: [PATCH] fix edge duration truncation in partition, pending global fix fix windows compilation no multi line warnings sanitze on mason with newer TBB --- .travis.yml | 21 +++++++++++++------ include/partition/annotated_partition.hpp | 10 ++++----- .../compressed_node_based_graph_reader.hpp | 1 + include/partition/dinic_max_flow.hpp | 2 +- include/partition/edge_based_graph_reader.hpp | 3 ++- include/util/static_graph.hpp | 2 +- include/util/typedefs.hpp | 7 +++++++ 7 files changed, 32 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 56dee6132..a2b54f1df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,7 +42,7 @@ matrix: apt: sources: ['ubuntu-toolchain-r-test'] packages: ['g++-6', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev'] - env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_COVERAGE=ON ENABLE_SANITIZER=ON BUILD_COMPONENTS=ON + env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_COVERAGE=ON BUILD_COMPONENTS=ON - os: linux compiler: "clang-3.9-debug" @@ -52,11 +52,13 @@ matrix: packages: ['libstdc++-5-dev', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev'] env: CLANG_VERSION='3.9.1' BUILD_TYPE='Debug' BUILD_COMPONENTS=ON CUCUMBER_TIMEOUT=60000 - - os: osx - osx_image: xcode8.2 - compiler: "mason-osx-release" - # we use the xcode provides clang and don't install our own - env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON + - os: linux + compiler: "mason-linux-debug-santize" + addons: + apt: + sources: ['ubuntu-toolchain-r-test'] + packages: ['libstdc++-5-dev'] + env: CLANG_VERSION='3.9.1' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_SANITIZER=ON # Release Builds - os: linux @@ -89,6 +91,12 @@ matrix: packages: ['g++-4.9', 'libbz2-dev', 'libstxxl-dev', 'libstxxl1', 'libxml2-dev', 'libzip-dev', 'lua5.1', 'liblua5.1-0-dev', 'libtbb-dev', 'libgdal-dev', 'libluabind-dev', 'libboost-all-dev', 'ccache'] env: CCOMPILER='gcc-4.9' CXXCOMPILER='g++-4.9' BUILD_TYPE='Release' + - os: osx + osx_image: xcode8.2 + compiler: "mason-osx-release" + # we use the xcode provides clang and don't install our own + env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON + # Disabled because of CI slowness #- os: linux #- compiler: clang @@ -141,6 +149,7 @@ before_install: - mkdir -p ${CMAKE_DIR} - travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR} || exit 1 - export PATH=${CMAKE_DIR}/bin:${PATH} + - ${MASON} install tbb 2017_20161128 && export LD_LIBRARY_PATH=$(${MASON} prefix tbb 2017_20161128)/lib/:${LD_LIBRARY_PATH} - ${MASON} install ccache ${CCACHE_VERSION} && export PATH=$(${MASON} prefix ccache ${CCACHE_VERSION})/bin:${PATH} - | if [[ ! -z ${CLANG_VERSION} ]]; then diff --git a/include/partition/annotated_partition.hpp b/include/partition/annotated_partition.hpp index 127192168..b7d82d482 100644 --- a/include/partition/annotated_partition.hpp +++ b/include/partition/annotated_partition.hpp @@ -31,13 +31,13 @@ namespace partition // layout into: // // _____o__________ -// / | \ -// o | \ -// / \ | \ +// / | \  +// o | \  +// / \ | \  // a b o _o_ -// / \ / \ +// / \ / \  // c d o o -// / \ / \ +// / \ / \  // e f g h class AnnotatedPartition { diff --git a/include/partition/compressed_node_based_graph_reader.hpp b/include/partition/compressed_node_based_graph_reader.hpp index 03a5e551d..8ceda92a1 100644 --- a/include/partition/compressed_node_based_graph_reader.hpp +++ b/include/partition/compressed_node_based_graph_reader.hpp @@ -3,6 +3,7 @@ #include "storage/io.hpp" #include "util/coordinate.hpp" +#include "util/typedefs.hpp" #include #include diff --git a/include/partition/dinic_max_flow.hpp b/include/partition/dinic_max_flow.hpp index 1e576fe9a..14ba216d3 100644 --- a/include/partition/dinic_max_flow.hpp +++ b/include/partition/dinic_max_flow.hpp @@ -52,7 +52,7 @@ class DinicMaxFlow // (starting with 0 for all source nodes) and assign the hop distance in the residual graph as // the level of the node. // a - // / \ + // / \  // s t // \ / // b diff --git a/include/partition/edge_based_graph_reader.hpp b/include/partition/edge_based_graph_reader.hpp index 1b20a4026..7640f9cef 100644 --- a/include/partition/edge_based_graph_reader.hpp +++ b/include/partition/edge_based_graph_reader.hpp @@ -1,6 +1,7 @@ #ifndef OSRM_EDGE_BASED_GRAPH_READER_HPP #define OSRM_EDGE_BASED_GRAPH_READER_HPP +#include "extractor/edge_based_edge.hpp" #include "storage/io.hpp" #include "util/coordinate.hpp" #include "util/dynamic_graph.hpp" @@ -130,7 +131,7 @@ struct EdgeBasedGraphReader forward_edge.target = reverse_edge.target = target; forward_edge.data.edge_id = reverse_edge.data.edge_id = edges[i].edge_id; forward_edge.data.weight = reverse_edge.data.weight = INVALID_EDGE_WEIGHT; - forward_edge.data.duration = reverse_edge.data.duration = MAXIMAL_EDGE_DURATION; + forward_edge.data.duration = reverse_edge.data.duration = MAXIMAL_EDGE_DURATION_INT_30; forward_edge.data.forward = reverse_edge.data.backward = true; forward_edge.data.backward = reverse_edge.data.forward = false; diff --git a/include/util/static_graph.hpp b/include/util/static_graph.hpp index 8dee24a23..3b3af310c 100644 --- a/include/util/static_graph.hpp +++ b/include/util/static_graph.hpp @@ -74,7 +74,7 @@ template struct SortableEdgeWithData : SortableEdgeWithData template SortableEdgeWithData(NodeIterator source, NodeIterator target, Ts &&... data) - : Base{source, target}, data{std::forward(data)...} + : Base{source, target}, data(std::forward(data)...) { } }; diff --git a/include/util/typedefs.hpp b/include/util/typedefs.hpp index 8518ab2d7..d27716040 100644 --- a/include/util/typedefs.hpp +++ b/include/util/typedefs.hpp @@ -90,6 +90,13 @@ static const EdgeWeight INVALID_EDGE_WEIGHT = std::numeric_limits::m static const EdgeWeight MAXIMAL_EDGE_DURATION = std::numeric_limits::max(); static const TurnPenalty INVALID_TURN_PENALTY = std::numeric_limits::max(); +// FIXME the bitfields we use require a reduced maximal duration, this should be kept consistent +// within the code base. For now we have to ensure that we don't case 30 bit to -1 and break any +// min() / operator< checks due to the invalid truncation. In addition, using signed and unsigned +// weights produces problems. As a result we can only store 1 << 29 since the MSB is still reserved +// for the sign bit. See https://github.com/Project-OSRM/osrm-backend/issues/3677 +static const EdgeWeight MAXIMAL_EDGE_DURATION_INT_30 = (1 << 29) - 1; + using DatasourceID = std::uint8_t; struct SegmentID