From 86763e620c0c7fc919a96eb2362a928dac3812b6 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Fri, 21 Aug 2020 10:43:39 -0400 Subject: [PATCH] Add TBB test for Python and GTSAM C++ --- .github/scripts/python.sh | 35 +++++++++++++++++++++++++++++ .github/scripts/unix.sh | 1 - .github/workflows/build-python.yml | 7 ++++++ .github/workflows/build-special.yml | 14 ++++++------ 4 files changed, 49 insertions(+), 8 deletions(-) diff --git a/.github/scripts/python.sh b/.github/scripts/python.sh index 38359e87d..6948cc385 100644 --- a/.github/scripts/python.sh +++ b/.github/scripts/python.sh @@ -6,6 +6,38 @@ set -x -e +# install TBB with _debug.so files +function install_tbb() +{ + TBB_BASEURL=https://github.com/oneapi-src/oneTBB/releases/download + TBB_VERSION=4.4.5 + TBB_DIR=tbb44_20160526oss + TBB_SAVEPATH="/tmp/tbb.tgz" + + if [ "$(uname)" == "Linux" ]; then + OS_SHORT="lin" + TBB_LIB_DIR="intel64/gcc4.4" + SUDO="sudo" + + elif [ "$(uname)" == "Darwin" ]; then + OS_SHORT="osx" + TBB_LIB_DIR="" + SUDO="" + + fi + + 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 CI 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/ + +} + if [ -z ${PYTHON_VERSION+x} ]; then echo "Please provide the Python version to build against!" exit 127 @@ -27,6 +59,8 @@ fi PATH=$PATH:$($PYTHON -c "import site; print(site.USER_BASE)")/bin +[ "${GTSAM_WITH_TBB:-OFF}" = "ON" ] && install_tbb + case $WRAPPER in "cython") BUILD_CYTHON="ON" @@ -53,6 +87,7 @@ cd $GITHUB_WORKSPACE/build cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release \ -DGTSAM_BUILD_TESTS=OFF -DGTSAM_BUILD_UNSTABLE=ON \ -DGTSAM_USE_QUATERNIONS=OFF \ + -DGTSAM_WITH_TBB=${GTSAM_WITH_TBB:-OFF} \ -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF \ -DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \ -DGTSAM_INSTALL_CYTHON_TOOLBOX=${BUILD_CYTHON} \ diff --git a/.github/scripts/unix.sh b/.github/scripts/unix.sh index f04100d0a..f85e67dc1 100644 --- a/.github/scripts/unix.sh +++ b/.github/scripts/unix.sh @@ -66,7 +66,6 @@ function configure() -DGTSAM_BUILD_EXAMPLES_ALWAYS=${GTSAM_BUILD_EXAMPLES_ALWAYS:-ON} \ -DGTSAM_ALLOW_DEPRECATED_SINCE_V41=${GTSAM_ALLOW_DEPRECATED_SINCE_V41:-OFF} \ -DGTSAM_USE_QUATERNIONS=${GTSAM_USE_QUATERNIONS:-OFF} \ - -DGTSAM_TYPEDEF_POINTS_TO_VECTOR=${GTSAM_TYPEDEF_POINTS_TO_VECTOR:-OFF} \ -DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \ -DBOOST_ROOT=$BOOST_ROOT \ -DBoost_NO_SYSTEM_PATHS=ON \ diff --git a/.github/workflows/build-python.yml b/.github/workflows/build-python.yml index 7a09c13d1..602d0980e 100644 --- a/.github/workflows/build-python.yml +++ b/.github/workflows/build-python.yml @@ -50,6 +50,13 @@ jobs: compiler: xcode version: "11.3.1" + - name: ubuntu-18.04-gcc-5 + os: ubuntu-18.04 + compiler: gcc + version: "5" + env: + GTSAM_WITH_TBB: ON + steps: - name: Checkout uses: actions/checkout@master diff --git a/.github/workflows/build-special.yml b/.github/workflows/build-special.yml index 21984311b..f561526c6 100644 --- a/.github/workflows/build-special.yml +++ b/.github/workflows/build-special.yml @@ -23,7 +23,7 @@ jobs: [ ubuntu-gcc-deprecated, ubuntu-gcc-quaternions, - ubuntu-gcc-points-vector, + ubuntu-gcc-tbb, ] build_type: [Debug, Release] @@ -41,11 +41,11 @@ jobs: version: "9" flag: quaternions - - name: ubuntu-gcc-points-vector + - name: ubuntu-gcc-tbb os: ubuntu-18.04 compiler: gcc version: "9" - flag: points-vector + flag: tbb steps: - name: Checkout @@ -101,11 +101,11 @@ jobs: GTSAM_USE_QUATERNIONS: ON run: echo "Use Quaternions for rotations" - - name: Set Typedef Points to Vector Flag - if: matrix.flag == 'points-vector' + - name: Set GTSAM_WITH_TBB Flag + if: matrix.flag == 'tbb' env: - GTSAM_TYPEDEF_POINTS_TO_VECTOR: ON - run: echo "Typedef Points to Vector" + GTSAM_WITH_TBB: ON + run: echo "GTSAM Uses TBB" - name: Build & Test run: |