From c9bcceef2f01e9eb5e22fa172c6d4cbb6171124e Mon Sep 17 00:00:00 2001 From: acxz <17132214+acxz@users.noreply.github.com> Date: Sun, 12 Jan 2020 11:34:02 -0500 Subject: [PATCH 01/17] add tbb to travis-ci --- .travis.yml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 14fe66ac1..e4e1a3440 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ addons: - cmake - libpython-dev python-numpy - libboost-all-dev + - libtbb-dev # before_install: # - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update ; fi @@ -43,7 +44,7 @@ jobs: - stage: compile os: osx compiler: gcc - env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF + env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_WITH_TBB=OFF script: bash .travis.sh -b - stage: compile os: osx @@ -54,7 +55,7 @@ jobs: - stage: compile os: osx compiler: clang - env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF + env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_WITH_TBB=OFF script: bash .travis.sh -b - stage: compile os: osx @@ -65,7 +66,7 @@ jobs: - stage: compile os: linux compiler: gcc - env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF + env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_WITH_TBB=OFF script: bash .travis.sh -b - stage: compile os: linux @@ -76,7 +77,7 @@ jobs: - stage: compile os: linux compiler: clang - env: CC=clang-9 CXX=clang++-9 CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF + env: CC=clang-9 CXX=clang++-9 CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_WITH_TBB=OFF script: bash .travis.sh -b - stage: compile os: linux @@ -87,7 +88,13 @@ jobs: - stage: special os: linux compiler: clang - env: CC=clang-9 CXX=clang++-9 CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_ALLOW_DEPRECATED_SINCE_V4=ON + env: CC=clang-9 CXX=clang++-9 CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_ALLOW_DEPRECATED_SINCE_V4=ON GTSAM_WITH_TBB=OFF + script: bash .travis.sh -b +# on Linux, with GTSAM_WITH_TBB not off to make sure GTSAM still compiles/tests + - stage: special + os: linux + compiler: gcc + env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF script: bash .travis.sh -b # -------- STAGE 2: TESTS ----------- # on Mac, GCC @@ -99,7 +106,7 @@ jobs: - stage: test os: osx compiler: clang - env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF + env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_WITH_TBB=OFF script: bash .travis.sh -t - stage: test os: linux @@ -109,7 +116,7 @@ jobs: - stage: test os: linux compiler: gcc - env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF + env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_WITH_TBB=OFF script: bash .travis.sh -t - stage: test os: linux From 6ec13bdcd5370fbe4022a37ec61d6b9c18710662 Mon Sep 17 00:00:00 2001 From: acxz <17132214+acxz@users.noreply.github.com> Date: Sun, 12 Jan 2020 14:19:40 -0500 Subject: [PATCH 02/17] add tbb version guard to fix clang build (cherry picked from commit 9b912f6b14d2cf715d17208df35b8253d5e648e7) --- CMakeLists.txt | 5 +++++ gtsam/linear/VectorValues.cpp | 28 ++++++++++++++++++++++++++++ gtsam/linear/VectorValues.h | 6 +++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c84835d82..56250a12c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -200,6 +200,11 @@ find_package(TBB 4.4 COMPONENTS tbb tbbmalloc) # Set up variables if we're using TBB if(TBB_FOUND AND GTSAM_WITH_TBB) set(GTSAM_USE_TBB 1) # This will go into config.h + if (${TBB_VERSION_MAJOR} GREATER_EQUAL 2020) + set(TBB_GREATER_EQUAL_2020 1) + else() + set(TBB_GREATER_EQUAL_2020 0) + endif() # all definitions and link requisites will go via imported targets: # tbb & tbbmalloc list(APPEND GTSAM_ADDITIONAL_LIBRARIES tbb tbbmalloc) diff --git a/gtsam/linear/VectorValues.cpp b/gtsam/linear/VectorValues.cpp index f18ad9c5f..e74d3776d 100644 --- a/gtsam/linear/VectorValues.cpp +++ b/gtsam/linear/VectorValues.cpp @@ -51,7 +51,11 @@ namespace gtsam { Key key; size_t n; boost::tie(key, n) = v; +#ifdef TBB_GREATER_EQUAL_2020 values_.emplace(key, x.segment(j, n)); +#else + values_.insert(std::make_pair(key, x.segment(j, n))); +#endif j += n; } } @@ -60,7 +64,11 @@ namespace gtsam { VectorValues::VectorValues(const Vector& x, const Scatter& scatter) { size_t j = 0; for (const SlotEntry& v : scatter) { +#ifdef TBB_GREATER_EQUAL_2020 values_.emplace(v.key, x.segment(j, v.dimension)); +#else + values_.insert(std::make_pair(v.key, x.segment(j, v.dimension))); +#endif j += v.dimension; } } @@ -70,7 +78,11 @@ namespace gtsam { { VectorValues result; for(const KeyValuePair& v: other) +#ifdef TBB_GREATER_EQUAL_2020 result.values_.emplace(v.first, Vector::Zero(v.second.size())); +#else + result.values_.insert(std::make_pair(v.first, Vector::Zero(v.second.size()))); +#endif return result; } @@ -86,7 +98,11 @@ namespace gtsam { /* ************************************************************************* */ VectorValues::iterator VectorValues::emplace(Key j, const Vector& value) { +#ifdef TBB_GREATER_EQUAL_2020 std::pair result = values_.emplace(j, value); +#else + std::pair result = values_.insert(std::make_pair(j, value)); +#endif if(!result.second) throw std::invalid_argument( "Requested to emplace variable '" + DefaultKeyFormatter(j) @@ -266,7 +282,11 @@ namespace gtsam { VectorValues result; // The result.end() hint here should result in constant-time inserts for(const_iterator j1 = begin(), j2 = c.begin(); j1 != end(); ++j1, ++j2) +#ifdef TBB_GREATER_EQUAL_2020 result.values_.emplace(j1->first, j1->second + j2->second); +#else + result.values_.insert(std::make_pair(j1->first, j1->second + j2->second)); +#endif return result; } @@ -324,7 +344,11 @@ namespace gtsam { VectorValues result; // The result.end() hint here should result in constant-time inserts for(const_iterator j1 = begin(), j2 = c.begin(); j1 != end(); ++j1, ++j2) +#ifdef TBB_GREATER_EQUAL_2020 result.values_.emplace(j1->first, j1->second - j2->second); +#else + result.values_.insert(std::make_pair(j1->first, j1->second - j2->second)); +#endif return result; } @@ -340,7 +364,11 @@ namespace gtsam { { VectorValues result; for(const VectorValues::KeyValuePair& key_v: v) +#ifdef TBB_GREATER_EQUAL_2020 result.values_.emplace(key_v.first, a * key_v.second); +#else + result.values_.insert(std::make_pair(key_v.first, a * key_v.second)); +#endif return result; } diff --git a/gtsam/linear/VectorValues.h b/gtsam/linear/VectorValues.h index 46da2d5f9..eed212eda 100644 --- a/gtsam/linear/VectorValues.h +++ b/gtsam/linear/VectorValues.h @@ -198,7 +198,11 @@ namespace gtsam { * exist, it is inserted and an iterator pointing to the new element, along with 'true', is * returned. */ std::pair tryInsert(Key j, const Vector& value) { - return values_.emplace(j, value); +#ifdef TBB_GREATER_EQUAL_2020 + return values_.emplace(j, value); +#else + return values_.insert(std::make_pair(j, value)); +#endif } /** Erase the vector with the given key, or throw std::out_of_range if it does not exist */ From 6945845868bc3598ddcbb255e9e3bae2964af378 Mon Sep 17 00:00:00 2001 From: acxz <17132214+acxz@users.noreply.github.com> Date: Wed, 25 Mar 2020 20:03:03 -0400 Subject: [PATCH 03/17] add default value of GTSAM_WITH_TBB --- .travis.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.sh b/.travis.sh index bc9029595..d57b784df 100755 --- a/.travis.sh +++ b/.travis.sh @@ -24,6 +24,7 @@ function configure() -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Debug} \ -DGTSAM_BUILD_TESTS=${GTSAM_BUILD_TESTS:-OFF} \ -DGTSAM_BUILD_UNSTABLE=${GTSAM_BUILD_UNSTABLE:-ON} \ + -DGTSAM_WITH_TBB=${GTSAM_WITH_TBB:-ON} \ -DGTSAM_USE_QUATERNIONS=${GTSAM_USE_QUATERNIONS:-OFF} \ -DGTSAM_BUILD_EXAMPLES_ALWAYS=${GTSAM_BUILD_EXAMPLES_ALWAYS:-ON} \ -DGTSAM_ALLOW_DEPRECATED_SINCE_V4=${GTSAM_ALLOW_DEPRECATED_SINCE_V4:-OFF} \ From ea8f774f8d723f053e3c53170476673e2fbdad75 Mon Sep 17 00:00:00 2001 From: acxz <17132214+acxz@users.noreply.github.com> Date: Thu, 26 Mar 2020 13:38:17 -0400 Subject: [PATCH 04/17] make GTSAM_WITH_TBB=OFF default in ci --- .travis.sh | 2 +- .travis.yml | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.sh b/.travis.sh index d57b784df..78351f095 100755 --- a/.travis.sh +++ b/.travis.sh @@ -24,7 +24,7 @@ function configure() -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Debug} \ -DGTSAM_BUILD_TESTS=${GTSAM_BUILD_TESTS:-OFF} \ -DGTSAM_BUILD_UNSTABLE=${GTSAM_BUILD_UNSTABLE:-ON} \ - -DGTSAM_WITH_TBB=${GTSAM_WITH_TBB:-ON} \ + -DGTSAM_WITH_TBB=${GTSAM_WITH_TBB:-OFF} \ -DGTSAM_USE_QUATERNIONS=${GTSAM_USE_QUATERNIONS:-OFF} \ -DGTSAM_BUILD_EXAMPLES_ALWAYS=${GTSAM_BUILD_EXAMPLES_ALWAYS:-ON} \ -DGTSAM_ALLOW_DEPRECATED_SINCE_V4=${GTSAM_ALLOW_DEPRECATED_SINCE_V4:-OFF} \ diff --git a/.travis.yml b/.travis.yml index e4e1a3440..870a4bdb9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,7 +44,7 @@ jobs: - stage: compile os: osx compiler: gcc - env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_WITH_TBB=OFF + env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF script: bash .travis.sh -b - stage: compile os: osx @@ -55,7 +55,7 @@ jobs: - stage: compile os: osx compiler: clang - env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_WITH_TBB=OFF + env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF script: bash .travis.sh -b - stage: compile os: osx @@ -66,7 +66,7 @@ jobs: - stage: compile os: linux compiler: gcc - env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_WITH_TBB=OFF + env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF script: bash .travis.sh -b - stage: compile os: linux @@ -77,7 +77,7 @@ jobs: - stage: compile os: linux compiler: clang - env: CC=clang-9 CXX=clang++-9 CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_WITH_TBB=OFF + env: CC=clang-9 CXX=clang++-9 CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF script: bash .travis.sh -b - stage: compile os: linux @@ -88,13 +88,13 @@ jobs: - stage: special os: linux compiler: clang - env: CC=clang-9 CXX=clang++-9 CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_ALLOW_DEPRECATED_SINCE_V4=ON GTSAM_WITH_TBB=OFF + env: CC=clang-9 CXX=clang++-9 CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_ALLOW_DEPRECATED_SINCE_V4=ON script: bash .travis.sh -b -# on Linux, with GTSAM_WITH_TBB not off to make sure GTSAM still compiles/tests +# on Linux, with GTSAM_WITH_TBB on to make sure GTSAM still compiles/tests - stage: special os: linux compiler: gcc - env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF + env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_WITH_TBB=ON script: bash .travis.sh -b # -------- STAGE 2: TESTS ----------- # on Mac, GCC @@ -106,7 +106,7 @@ jobs: - stage: test os: osx compiler: clang - env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_WITH_TBB=OFF + env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF script: bash .travis.sh -t - stage: test os: linux @@ -116,7 +116,7 @@ jobs: - stage: test os: linux compiler: gcc - env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF GTSAM_WITH_TBB=OFF + env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF script: bash .travis.sh -t - stage: test os: linux From 88005a99a13dff3dacb726ebb9ae36b4be63df15 Mon Sep 17 00:00:00 2001 From: acxz <17132214+acxz@users.noreply.github.com> Date: Thu, 26 Mar 2020 13:46:30 -0400 Subject: [PATCH 05/17] fix tbb CMakeLists indentation --- CMakeLists.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 56250a12c..57c9d5f2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -199,17 +199,17 @@ find_package(TBB 4.4 COMPONENTS tbb tbbmalloc) # Set up variables if we're using TBB if(TBB_FOUND AND GTSAM_WITH_TBB) - set(GTSAM_USE_TBB 1) # This will go into config.h - if (${TBB_VERSION_MAJOR} GREATER_EQUAL 2020) - set(TBB_GREATER_EQUAL_2020 1) - else() - set(TBB_GREATER_EQUAL_2020 0) - endif() - # all definitions and link requisites will go via imported targets: - # tbb & tbbmalloc - list(APPEND GTSAM_ADDITIONAL_LIBRARIES tbb tbbmalloc) + set(GTSAM_USE_TBB 1) # This will go into config.h + if (${TBB_VERSION_MAJOR} GREATER_EQUAL 2020) + set(TBB_GREATER_EQUAL_2020 1) + else() + set(TBB_GREATER_EQUAL_2020 0) + endif() + # all definitions and link requisites will go via imported targets: + # tbb & tbbmalloc + list(APPEND GTSAM_ADDITIONAL_LIBRARIES tbb tbbmalloc) else() - set(GTSAM_USE_TBB 0) # This will go into config.h + set(GTSAM_USE_TBB 0) # This will go into config.h endif() ############################################################################### From 80fc06cad7fbb31089e4e11709fd7c81bc98327b Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 26 Mar 2020 16:03:51 -0400 Subject: [PATCH 06/17] function to add tbb with debug --- .travis.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.travis.sh b/.travis.sh index 78351f095..9ff1f22cd 100755 --- a/.travis.sh +++ b/.travis.sh @@ -1,5 +1,17 @@ #!/bin/bash +# install TBB with _debug.so files +function install_tbb() +{ + wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.5/tbb44_20160526oss_lin.tgz + if [ $(uname -s) == "Linux"]; then + tar -xvf tbb44_20160526oss_lin.tgz + elif [ $(uname -s) == "Linux" ]; then + tar -xvf tbb44_20160526oss_mac.tgz + fi + source tbb44_20160526oss/bin/tbbvars.sh intel64 linux auto_tbbroot +} + # common tasks before either build or test function configure() { @@ -19,6 +31,8 @@ function configure() export CXX=g++-$GCC_VERSION fi + install_tbb + # GTSAM_BUILD_WITH_MARCH_NATIVE=OFF: to avoid crashes in builder VMs cmake $SOURCE_DIR \ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Debug} \ From 026c794a9279b3b764f9101f4e410c25793c69c1 Mon Sep 17 00:00:00 2001 From: acxz <17132214+acxz@users.noreply.github.com> Date: Thu, 26 Mar 2020 16:32:05 -0400 Subject: [PATCH 07/17] use the same tbb as xenial --- .travis.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.travis.sh b/.travis.sh index 9ff1f22cd..5db84e1e5 100755 --- a/.travis.sh +++ b/.travis.sh @@ -3,13 +3,14 @@ # install TBB with _debug.so files function install_tbb() { - wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.5/tbb44_20160526oss_lin.tgz - if [ $(uname -s) == "Linux"]; then - tar -xvf tbb44_20160526oss_lin.tgz - elif [ $(uname -s) == "Linux" ]; then - tar -xvf tbb44_20160526oss_mac.tgz + if [ $(uname -s) == "Linux" ]; then + wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_lin.tgz + tar -xvf tbb44_20151115oss_lin.tgz + elif [ $(uname -s) == "Darwin" ]; then + wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_osx.tgz + tar -xvf tbb44_20151115oss_osx.tgz fi - source tbb44_20160526oss/bin/tbbvars.sh intel64 linux auto_tbbroot + source tbb44_20151115oss/bin/tbbvars.sh intel64 linux auto_tbbroot } # common tasks before either build or test From 4a356b9bd93ab4f7076a778b073c77b104a89c40 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 26 Mar 2020 18:00:47 -0400 Subject: [PATCH 08/17] improved install_tbb function --- .travis.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.travis.sh b/.travis.sh index 5db84e1e5..8fdf27bd3 100755 --- a/.travis.sh +++ b/.travis.sh @@ -5,12 +5,23 @@ function install_tbb() { if [ $(uname -s) == "Linux" ]; then wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_lin.tgz - tar -xvf tbb44_20151115oss_lin.tgz + tar -xf tbb44_20151115oss_lin.tgz elif [ $(uname -s) == "Darwin" ]; then wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_osx.tgz - tar -xvf tbb44_20151115oss_osx.tgz + tar -xf tbb44_20151115oss_osx.tgz fi - source tbb44_20151115oss/bin/tbbvars.sh intel64 linux auto_tbbroot + + # Variables needed for setting the correct library path + TBB_TARGET_ARCH="intel64" + TBBROOT=$(cd tbb44_20151115oss/bin && pwd -P)/.. + library_directory="${TBB_TARGET_ARCH}/gcc4.1" + + # Set library paths + MIC_LD_LIBRARY_PATH="$TBBROOT/lib/mic:${MIC_LD_LIBRARY_PATH}"; export MIC_LD_LIBRARY_PATH + MIC_LIBRARY_PATH="$TBBROOT/lib/mic:${MIC_LIBRARY_PATH}"; export MIC_LIBRARY_PATH + LD_LIBRARY_PATH="$TBBROOT/lib/$library_directory:${LD_LIBRARY_PATH}"; export LD_LIBRARY_PATH + LIBRARY_PATH="$TBBROOT/lib/$library_directory:${LIBRARY_PATH}"; export LIBRARY_PATH + CPATH="${TBBROOT}/include:$CPATH"; export CPATH } # common tasks before either build or test From 34069a60df3cb216f74a6faabdcc2ee54e7e2d90 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 26 Mar 2020 21:00:23 -0400 Subject: [PATCH 09/17] specific paths for Mac, removed libtbb from travis packages list --- .travis.sh | 28 ++++++++++++++++++---------- .travis.yml | 1 - 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.travis.sh b/.travis.sh index 8fdf27bd3..1f681043a 100755 --- a/.travis.sh +++ b/.travis.sh @@ -6,21 +6,29 @@ function install_tbb() if [ $(uname -s) == "Linux" ]; then wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_lin.tgz tar -xf tbb44_20151115oss_lin.tgz + + TBBROOT=$(cd tbb44_20151115oss/bin && pwd -P)/.. + + TBB_TARGET_ARCH="intel64" + library_directory="${TBB_TARGET_ARCH}/gcc4.1" + + # Set library paths + MIC_LD_LIBRARY_PATH="$TBBROOT/lib/mic:${MIC_LD_LIBRARY_PATH}"; export MIC_LD_LIBRARY_PATH + MIC_LIBRARY_PATH="$TBBROOT/lib/mic:${MIC_LIBRARY_PATH}"; export MIC_LIBRARY_PATH + LD_LIBRARY_PATH="$TBBROOT/lib/$library_directory:${LD_LIBRARY_PATH}"; export LD_LIBRARY_PATH + LIBRARY_PATH="$TBBROOT/lib/$library_directory:${LIBRARY_PATH}"; export LIBRARY_PATH + elif [ $(uname -s) == "Darwin" ]; then wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_osx.tgz tar -xf tbb44_20151115oss_osx.tgz + + TBBROOT=$(cd tbb44_20151115oss/bin && pwd -P)/.. + + # Set library paths + LIBRARY_PATH="${TBBROOT}/lib:$LIBRARY_PATH"; export LIBRARY_PATH + DYLD_LIBRARY_PATH="${TBBROOT}/lib:$DYLD_LIBRARY_PATH"; export DYLD_LIBRARY_PATH fi - # Variables needed for setting the correct library path - TBB_TARGET_ARCH="intel64" - TBBROOT=$(cd tbb44_20151115oss/bin && pwd -P)/.. - library_directory="${TBB_TARGET_ARCH}/gcc4.1" - - # Set library paths - MIC_LD_LIBRARY_PATH="$TBBROOT/lib/mic:${MIC_LD_LIBRARY_PATH}"; export MIC_LD_LIBRARY_PATH - MIC_LIBRARY_PATH="$TBBROOT/lib/mic:${MIC_LIBRARY_PATH}"; export MIC_LIBRARY_PATH - LD_LIBRARY_PATH="$TBBROOT/lib/$library_directory:${LD_LIBRARY_PATH}"; export LD_LIBRARY_PATH - LIBRARY_PATH="$TBBROOT/lib/$library_directory:${LIBRARY_PATH}"; export LIBRARY_PATH CPATH="${TBBROOT}/include:$CPATH"; export CPATH } diff --git a/.travis.yml b/.travis.yml index 870a4bdb9..2de325818 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,6 @@ addons: - cmake - libpython-dev python-numpy - libboost-all-dev - - libtbb-dev # before_install: # - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update ; fi From 2e34a175f7aca1bd0d8a1f11e83550b80bddfe57 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 26 Mar 2020 22:05:28 -0400 Subject: [PATCH 10/17] properly export variables --- .travis.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.sh b/.travis.sh index 1f681043a..708572ef2 100755 --- a/.travis.sh +++ b/.travis.sh @@ -13,10 +13,10 @@ function install_tbb() library_directory="${TBB_TARGET_ARCH}/gcc4.1" # Set library paths - MIC_LD_LIBRARY_PATH="$TBBROOT/lib/mic:${MIC_LD_LIBRARY_PATH}"; export MIC_LD_LIBRARY_PATH - MIC_LIBRARY_PATH="$TBBROOT/lib/mic:${MIC_LIBRARY_PATH}"; export MIC_LIBRARY_PATH - LD_LIBRARY_PATH="$TBBROOT/lib/$library_directory:${LD_LIBRARY_PATH}"; export LD_LIBRARY_PATH - LIBRARY_PATH="$TBBROOT/lib/$library_directory:${LIBRARY_PATH}"; export LIBRARY_PATH + export MIC_LD_LIBRARY_PATH="$TBBROOT/lib/mic:${MIC_LD_LIBRARY_PATH}" + export MIC_LIBRARY_PATH="$TBBROOT/lib/mic:${MIC_LIBRARY_PATH}" + export LD_LIBRARY_PATH="$TBBROOT/lib/$library_directory:${LD_LIBRARY_PATH}" + export LIBRARY_PATH="$TBBROOT/lib/$library_directory:${LIBRARY_PATH}" elif [ $(uname -s) == "Darwin" ]; then wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_osx.tgz @@ -25,8 +25,8 @@ function install_tbb() TBBROOT=$(cd tbb44_20151115oss/bin && pwd -P)/.. # Set library paths - LIBRARY_PATH="${TBBROOT}/lib:$LIBRARY_PATH"; export LIBRARY_PATH - DYLD_LIBRARY_PATH="${TBBROOT}/lib:$DYLD_LIBRARY_PATH"; export DYLD_LIBRARY_PATH + export LIBRARY_PATH="${TBBROOT}/lib:$LIBRARY_PATH" + export DYLD_LIBRARY_PATH="${TBBROOT}/lib:$DYLD_LIBRARY_PATH" fi CPATH="${TBBROOT}/include:$CPATH"; export CPATH From 7248b149fd0bbc7f077dc6bd5361bb280b4af6f3 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Fri, 27 Mar 2020 08:39:06 -0400 Subject: [PATCH 11/17] save tbb download to /tmp --- .travis.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.travis.sh b/.travis.sh index 708572ef2..e08ab5a30 100755 --- a/.travis.sh +++ b/.travis.sh @@ -3,11 +3,11 @@ # install TBB with _debug.so files function install_tbb() { - if [ $(uname -s) == "Linux" ]; then - wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_lin.tgz - tar -xf tbb44_20151115oss_lin.tgz + if [ "$(uname -s)" == "Linux" ]; then + wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_lin.tgz -O /tmp/tbb442.tgz + tar -C /tmp -xvf /tmp/tbb442.tgz - TBBROOT=$(cd tbb44_20151115oss/bin && pwd -P)/.. + TBBROOT=/tmp/tbb44_20151115oss TBB_TARGET_ARCH="intel64" library_directory="${TBB_TARGET_ARCH}/gcc4.1" @@ -18,18 +18,18 @@ function install_tbb() export LD_LIBRARY_PATH="$TBBROOT/lib/$library_directory:${LD_LIBRARY_PATH}" export LIBRARY_PATH="$TBBROOT/lib/$library_directory:${LIBRARY_PATH}" - elif [ $(uname -s) == "Darwin" ]; then - wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_osx.tgz - tar -xf tbb44_20151115oss_osx.tgz + elif [ "$(uname -s)" == "Darwin" ]; then + wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_osx.tgz -O /tmp/tbb442.tgz + tar -C /tmp -xvf /tmp/tbb442.tgz - TBBROOT=$(cd tbb44_20151115oss/bin && pwd -P)/.. + TBBROOT=/tmp/tbb44_20151115oss # Set library paths export LIBRARY_PATH="${TBBROOT}/lib:$LIBRARY_PATH" export DYLD_LIBRARY_PATH="${TBBROOT}/lib:$DYLD_LIBRARY_PATH" fi - CPATH="${TBBROOT}/include:$CPATH"; export CPATH + # CPATH="${TBBROOT}/include:$CPATH"; export CPATH } # common tasks before either build or test From 5dc19e074674ab3aa7cc23656491294ead0cbef8 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Fri, 27 Mar 2020 09:21:51 -0400 Subject: [PATCH 12/17] install tbb before install to allow propagation of env variables --- .travis.sh | 9 +++++---- .travis.yml | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.travis.sh b/.travis.sh index e08ab5a30..5f999e7a9 100755 --- a/.travis.sh +++ b/.travis.sh @@ -5,7 +5,7 @@ function install_tbb() { if [ "$(uname -s)" == "Linux" ]; then wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_lin.tgz -O /tmp/tbb442.tgz - tar -C /tmp -xvf /tmp/tbb442.tgz + tar -C /tmp -xf /tmp/tbb442.tgz TBBROOT=/tmp/tbb44_20151115oss @@ -20,7 +20,7 @@ function install_tbb() elif [ "$(uname -s)" == "Darwin" ]; then wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_osx.tgz -O /tmp/tbb442.tgz - tar -C /tmp -xvf /tmp/tbb442.tgz + tar -C /tmp -xf /tmp/tbb442.tgz TBBROOT=/tmp/tbb44_20151115oss @@ -51,8 +51,6 @@ function configure() export CXX=g++-$GCC_VERSION fi - install_tbb - # GTSAM_BUILD_WITH_MARCH_NATIVE=OFF: to avoid crashes in builder VMs cmake $SOURCE_DIR \ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Debug} \ @@ -111,4 +109,7 @@ case $1 in -t) test ;; + -tbb) + install_tbb + ;; esac diff --git a/.travis.yml b/.travis.yml index 2de325818..7e5b33ec4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,8 +17,9 @@ addons: - libpython-dev python-numpy - libboost-all-dev -# before_install: -# - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update ; fi +before_install: + - ./.travis.sh -tbb + # - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi install: - if [ "$TRAVIS_OS_NAME" == "osx" ]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache ; fi From 99e1c42282d2cde3bf5e42e33f38c14171820d6a Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Fri, 27 Mar 2020 10:53:22 -0400 Subject: [PATCH 13/17] update travis.yml to install tbb during install phase, source script to add variables to current shell --- .travis.sh | 8 +++----- .travis.yml | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.travis.sh b/.travis.sh index 5f999e7a9..2bf4f038c 100755 --- a/.travis.sh +++ b/.travis.sh @@ -3,12 +3,12 @@ # install TBB with _debug.so files function install_tbb() { + TBBROOT=/tmp/tbb44_20151115oss + if [ "$(uname -s)" == "Linux" ]; then wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_lin.tgz -O /tmp/tbb442.tgz tar -C /tmp -xf /tmp/tbb442.tgz - TBBROOT=/tmp/tbb44_20151115oss - TBB_TARGET_ARCH="intel64" library_directory="${TBB_TARGET_ARCH}/gcc4.1" @@ -22,14 +22,12 @@ function install_tbb() wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_osx.tgz -O /tmp/tbb442.tgz tar -C /tmp -xf /tmp/tbb442.tgz - TBBROOT=/tmp/tbb44_20151115oss - # Set library paths export LIBRARY_PATH="${TBBROOT}/lib:$LIBRARY_PATH" export DYLD_LIBRARY_PATH="${TBBROOT}/lib:$DYLD_LIBRARY_PATH" fi - # CPATH="${TBBROOT}/include:$CPATH"; export CPATH + CPATH="${TBBROOT}/include:$CPATH"; export CPATH } # common tasks before either build or test diff --git a/.travis.yml b/.travis.yml index 7e5b33ec4..893627df3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,13 +17,13 @@ addons: - libpython-dev python-numpy - libboost-all-dev -before_install: - - ./.travis.sh -tbb +# before_install: # - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi install: - if [ "$TRAVIS_OS_NAME" == "osx" ]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache ; fi - if [ "$TRAVIS_OS_NAME" == "osx" ]; then export PATH="/usr/local/opt/ccache/libexec:$PATH" ; fi + - source .travis.sh -tbb # We first do the compile stage specified below, then the matrix expansion specified after. stages: From ba5086f2717466f413796068c53fa337ecd73531 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Fri, 27 Mar 2020 13:15:59 -0400 Subject: [PATCH 14/17] vastly improved install_tbb function which copies files correctly --- .travis.sh | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/.travis.sh b/.travis.sh index 2bf4f038c..10d5fd545 100755 --- a/.travis.sh +++ b/.travis.sh @@ -3,31 +3,33 @@ # install TBB with _debug.so files function install_tbb() { - TBBROOT=/tmp/tbb44_20151115oss + TBB_BASEURL=https://github.com/oneapi-src/oneTBB/releases/download + TBB_VERSION=4.4.2 + TBB_DIR=tbb44_20151115oss + TBB_SAVEPATH="/tmp/tbb.tgz" - if [ "$(uname -s)" == "Linux" ]; then - wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_lin.tgz -O /tmp/tbb442.tgz - tar -C /tmp -xf /tmp/tbb442.tgz + if [ "$TRAVIS_OS_NAME" == "linux" ]; then + OS_SHORT="lin" + TBB_LIB_DIR="intel64/gcc4.4" + SUDO="sudo" - TBB_TARGET_ARCH="intel64" - library_directory="${TBB_TARGET_ARCH}/gcc4.1" + elif [ "$TRAVIS_OS_NAME" == "osx" ]; then + OS_SHORT="lin" + TBB_LIB_DIR="" + SUDO="" - # Set library paths - export MIC_LD_LIBRARY_PATH="$TBBROOT/lib/mic:${MIC_LD_LIBRARY_PATH}" - export MIC_LIBRARY_PATH="$TBBROOT/lib/mic:${MIC_LIBRARY_PATH}" - export LD_LIBRARY_PATH="$TBBROOT/lib/$library_directory:${LD_LIBRARY_PATH}" - export LIBRARY_PATH="$TBBROOT/lib/$library_directory:${LIBRARY_PATH}" - - elif [ "$(uname -s)" == "Darwin" ]; then - wget https://github.com/oneapi-src/oneTBB/releases/download/4.4.2/tbb44_20151115oss_osx.tgz -O /tmp/tbb442.tgz - tar -C /tmp -xf /tmp/tbb442.tgz - - # Set library paths - export LIBRARY_PATH="${TBBROOT}/lib:$LIBRARY_PATH" - export DYLD_LIBRARY_PATH="${TBBROOT}/lib:$DYLD_LIBRARY_PATH" fi - CPATH="${TBBROOT}/include:$CPATH"; export CPATH + wget "${TBB_BASEURL}/${TBB_VERSION}/${TBB_DIR}_${OS_SHORT}.tgz" -O $TBB_SAVEPATH + tar -C /tmp -xf $TBB_SAVEPATH + + TBBROOT=/tmp/$TBB_DIR + # Copy the needed files to the correct places. + # This works correctly for travis builds, instead of setting path variables. + # This is what Homebrew does to install TBB on Macs + $SUDO cp -R $TBBROOT/lib/$TBB_LIB_DIR/* /usr/local/lib/ + $SUDO cp -R $TBBROOT/include/ /usr/local/include/ + } # common tasks before either build or test From 8dc7359924176c0c575d8b1f014057ce99aaac03 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Fri, 27 Mar 2020 23:30:50 -0400 Subject: [PATCH 15/17] set makefile to not verbose to speed up travis and reduce log length --- .travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.sh b/.travis.sh index 10d5fd545..d1940db52 100755 --- a/.travis.sh +++ b/.travis.sh @@ -61,7 +61,7 @@ function configure() -DGTSAM_BUILD_EXAMPLES_ALWAYS=${GTSAM_BUILD_EXAMPLES_ALWAYS:-ON} \ -DGTSAM_ALLOW_DEPRECATED_SINCE_V4=${GTSAM_ALLOW_DEPRECATED_SINCE_V4:-OFF} \ -DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \ - -DCMAKE_VERBOSE_MAKEFILE=ON + -DCMAKE_VERBOSE_MAKEFILE=OFF } From d608611c871035269dcc702bd13377050c8757b9 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 28 Mar 2020 06:56:58 -0400 Subject: [PATCH 16/17] install tbb as part of configure --- .travis.sh | 5 ++--- .travis.yml | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.sh b/.travis.sh index d1940db52..535a72f4b 100755 --- a/.travis.sh +++ b/.travis.sh @@ -46,6 +46,8 @@ function configure() rm -fr $BUILD_DIR || true mkdir $BUILD_DIR && cd $BUILD_DIR + install_tbb + if [ ! -z "$GCC_VERSION" ]; then export CC=gcc-$GCC_VERSION export CXX=g++-$GCC_VERSION @@ -109,7 +111,4 @@ case $1 in -t) test ;; - -tbb) - install_tbb - ;; esac diff --git a/.travis.yml b/.travis.yml index 893627df3..c272cff07 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,6 @@ addons: install: - if [ "$TRAVIS_OS_NAME" == "osx" ]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache ; fi - if [ "$TRAVIS_OS_NAME" == "osx" ]; then export PATH="/usr/local/opt/ccache/libexec:$PATH" ; fi - - source .travis.sh -tbb # We first do the compile stage specified below, then the matrix expansion specified after. stages: From 35bfc8468485796e1de882c753a8777273c3682f Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 28 Mar 2020 10:05:38 -0400 Subject: [PATCH 17/17] make makefile verbose again --- .travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.sh b/.travis.sh index 535a72f4b..9fc09a3f8 100755 --- a/.travis.sh +++ b/.travis.sh @@ -63,7 +63,7 @@ function configure() -DGTSAM_BUILD_EXAMPLES_ALWAYS=${GTSAM_BUILD_EXAMPLES_ALWAYS:-ON} \ -DGTSAM_ALLOW_DEPRECATED_SINCE_V4=${GTSAM_ALLOW_DEPRECATED_SINCE_V4:-OFF} \ -DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \ - -DCMAKE_VERBOSE_MAKEFILE=OFF + -DCMAKE_VERBOSE_MAKEFILE=ON }