diff --git a/.github/scripts/boost.sh b/.github/scripts/boost.sh new file mode 100644 index 000000000..8b36a8f21 --- /dev/null +++ b/.github/scripts/boost.sh @@ -0,0 +1,18 @@ +### Script to install Boost +BOOST_FOLDER=boost_${BOOST_VERSION//./_} + +# Download Boost +wget https://dl.bintray.com/boostorg/release/${BOOST_VERSION}/source/${BOOST_FOLDER}.tar.gz + +# Unzip +tar -zxf ${BOOST_FOLDER}.tar.gz + +# Bootstrap +cd ${BOOST_FOLDER}/ +./bootstrap.sh + +# Build and install +sudo ./b2 install + +# Rebuild ld cache +sudo ldconfig diff --git a/.github/scripts/python.sh b/.github/scripts/python.sh index a71e14c97..b9c8a25f5 100644 --- a/.github/scripts/python.sh +++ b/.github/scripts/python.sh @@ -65,21 +65,23 @@ sudo $PYTHON -m pip install -r $GITHUB_WORKSPACE/python/requirements.txt mkdir $GITHUB_WORKSPACE/build cd $GITHUB_WORKSPACE/build -cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release \ - -DGTSAM_BUILD_TESTS=OFF -DGTSAM_BUILD_UNSTABLE=ON \ +cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ + -DGTSAM_BUILD_TESTS=OFF \ + -DGTSAM_BUILD_UNSTABLE=${GTSAM_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_BUILD_PYTHON=${BUILD_PYBIND} \ - -DGTSAM_TYPEDEF_POINTS_TO_VECTORS=${TYPEDEF_POINTS_TO_VECTORS} \ + -DGTSAM_UNSTABLE_BUILD_PYTHON=${GTSAM_BUILD_UNSTABLE:-ON} \ -DGTSAM_PYTHON_VERSION=$PYTHON_VERSION \ -DPYTHON_EXECUTABLE:FILEPATH=$(which $PYTHON) \ -DGTSAM_ALLOW_DEPRECATED_SINCE_V41=OFF \ -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/gtsam_install -make -j$(nproc) install +# Set to 2 cores so that Actions does not error out during resource provisioning. +make -j2 install cd $GITHUB_WORKSPACE/build/python $PYTHON setup.py install --user --prefix= diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index be1da35bb..9ca3a8fe5 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -12,6 +12,7 @@ jobs: CTEST_PARALLEL_LEVEL: 2 CMAKE_BUILD_TYPE: ${{ matrix.build_type }} GTSAM_BUILD_UNSTABLE: ${{ matrix.build_unstable }} + BOOST_VERSION: 1.67.0 strategy: fail-fast: false @@ -44,7 +45,8 @@ jobs: steps: - name: Checkout - uses: actions/checkout@master + uses: actions/checkout@v2 + - name: Install (Linux) if: runner.os == 'Linux' run: | @@ -61,11 +63,8 @@ jobs: fi sudo apt-get -y update - sudo apt install cmake build-essential pkg-config libpython-dev python-numpy - - echo "BOOST_ROOT=$(echo $BOOST_ROOT_1_72_0)" >> $GITHUB_ENV - echo "LD_LIBRARY_PATH=$(echo $BOOST_ROOT_1_72_0/lib)" >> $GITHUB_ENV - + sudo apt-get install cmake build-essential pkg-config libpython-dev python-numpy libicu-dev + if [ "${{ matrix.compiler }}" = "gcc" ]; then sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV @@ -75,10 +74,11 @@ jobs: echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV fi - - name: Check Boost version - if: runner.os == 'Linux' + + - name: Install Boost run: | - echo "BOOST_ROOT = $BOOST_ROOT" + bash .github/scripts/boost.sh + - name: Build and Test (Linux) if: runner.os == 'Linux' run: | diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 435936bdf..ed8f8563b 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -12,6 +12,7 @@ jobs: CTEST_PARALLEL_LEVEL: 2 CMAKE_BUILD_TYPE: ${{ matrix.build_type }} GTSAM_BUILD_UNSTABLE: ${{ matrix.build_unstable }} + strategy: fail-fast: false matrix: @@ -31,7 +32,8 @@ jobs: steps: - name: Checkout - uses: actions/checkout@master + uses: actions/checkout@v2 + - name: Install (macOS) if: runner.os == 'macOS' run: | diff --git a/.github/workflows/build-python.yml b/.github/workflows/build-python.yml index 1b5293b16..089ee3246 100644 --- a/.github/workflows/build-python.yml +++ b/.github/workflows/build-python.yml @@ -12,6 +12,7 @@ jobs: CTEST_PARALLEL_LEVEL: 2 CMAKE_BUILD_TYPE: ${{ matrix.build_type }} PYTHON_VERSION: ${{ matrix.python_version }} + strategy: fail-fast: false matrix: @@ -22,10 +23,12 @@ jobs: ubuntu-18.04-gcc-9, ubuntu-18.04-clang-9, macOS-10.15-xcode-11.3.1, - #ubuntu-18.04-gcc-5-tbb, + # ubuntu-18.04-gcc-5-tbb, ] - build_type: [Debug, Release] + #TODO update wrapper to prevent OOM + # build_type: [Debug, Release] + build_type: [Release] python_version: [3] include: - name: ubuntu-18.04-gcc-5 @@ -43,20 +46,28 @@ jobs: compiler: clang version: "9" + #NOTE temporarily added this as it is a required check. + - name: ubuntu-18.04-clang-9 + os: ubuntu-18.04 + compiler: clang + version: "9" + build_type: Debug + python_version: "3" + - name: macOS-10.15-xcode-11.3.1 os: macOS-10.15 compiler: xcode version: "11.3.1" -# - name: ubuntu-18.04-gcc-5-tbb -# os: ubuntu-18.04 -# compiler: gcc -# version: "5" -# flag: tbb + # - name: ubuntu-18.04-gcc-5-tbb + # os: ubuntu-18.04 + # compiler: gcc + # version: "5" + # flag: tbb steps: - name: Checkout - uses: actions/checkout@master + uses: actions/checkout@v2 - name: Install (Linux) if: runner.os == 'Linux' run: | diff --git a/.github/workflows/build-special.yml b/.github/workflows/build-special.yml index 532f917c1..3ac88bdc8 100644 --- a/.github/workflows/build-special.yml +++ b/.github/workflows/build-special.yml @@ -12,6 +12,7 @@ jobs: CTEST_PARALLEL_LEVEL: 2 CMAKE_BUILD_TYPE: ${{ matrix.build_type }} GTSAM_BUILD_UNSTABLE: ON + BOOST_VERSION: 1.67.0 strategy: fail-fast: false @@ -56,7 +57,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@master + uses: actions/checkout@v2 - name: Install (Linux) if: runner.os == 'Linux' @@ -69,10 +70,7 @@ jobs: fi sudo apt-get -y update - sudo apt install cmake build-essential pkg-config libpython-dev python-numpy - - echo "BOOST_ROOT=$(echo $BOOST_ROOT_1_72_0)" >> $GITHUB_ENV - echo "LD_LIBRARY_PATH=$(echo $BOOST_ROOT_1_72_0/lib)" >> $GITHUB_ENV + sudo apt install cmake build-essential pkg-config libpython-dev python-numpy libicu-dev if [ "${{ matrix.compiler }}" = "gcc" ]; then sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib @@ -84,6 +82,11 @@ jobs: echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV fi + - name: Install Boost + if: runner.os == 'Linux' + run: | + bash .github/scripts/boost.sh + - name: Install (macOS) if: runner.os == 'macOS' run: | diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 887d41972..a564dade9 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -38,7 +38,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@master + uses: actions/checkout@v2 - name: Install (Windows) if: runner.os == 'Windows' shell: powershell @@ -64,12 +64,21 @@ jobs: } # Scoop modifies the PATH so we make the modified PATH global. echo "$env:PATH" >> $GITHUB_PATH + + - name: Download and install Boost + uses: MarkusJx/install-boost@v1.0.1 + id: install-boost + with: + boost_version: 1.72.0 + toolset: msvc14.2 + - name: Build (Windows) if: runner.os == 'Windows' + env: + BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} run: | cmake -E remove_directory build - echo "BOOST_ROOT_1_72_0: ${env:BOOST_ROOT_1_72_0}" - cmake -B build -S . -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF -DBOOST_ROOT="${env:BOOST_ROOT_1_72_0}" -DBOOST_INCLUDEDIR="${env:BOOST_ROOT_1_72_0}\boost\include" -DBOOST_LIBRARYDIR="${env:BOOST_ROOT_1_72_0}\lib" + cmake -B build -S . -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF -DBOOST_ROOT="${env:BOOST_ROOT}" -DBOOST_INCLUDEDIR="${env:BOOST_ROOT}\boost\include" -DBOOST_LIBRARYDIR="${env:BOOST_ROOT}\lib" cmake --build build --config ${{ matrix.build_type }} --target gtsam cmake --build build --config ${{ matrix.build_type }} --target gtsam_unstable cmake --build build --config ${{ matrix.build_type }} --target wrap diff --git a/gtsam/geometry/Similarity3.h b/gtsam/geometry/Similarity3.h index d4a478310..0ef787b05 100644 --- a/gtsam/geometry/Similarity3.h +++ b/gtsam/geometry/Similarity3.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include namespace gtsam { @@ -53,54 +53,54 @@ public: /// @{ /// Default constructor - GTSAM_UNSTABLE_EXPORT Similarity3(); + GTSAM_EXPORT Similarity3(); /// Construct pure scaling - GTSAM_UNSTABLE_EXPORT Similarity3(double s); + GTSAM_EXPORT Similarity3(double s); /// Construct from GTSAM types - GTSAM_UNSTABLE_EXPORT Similarity3(const Rot3& R, const Point3& t, double s); + GTSAM_EXPORT Similarity3(const Rot3& R, const Point3& t, double s); /// Construct from Eigen types - GTSAM_UNSTABLE_EXPORT Similarity3(const Matrix3& R, const Vector3& t, double s); + GTSAM_EXPORT Similarity3(const Matrix3& R, const Vector3& t, double s); /// Construct from matrix [R t; 0 s^-1] - GTSAM_UNSTABLE_EXPORT Similarity3(const Matrix4& T); + GTSAM_EXPORT Similarity3(const Matrix4& T); /// @} /// @name Testable /// @{ /// Compare with tolerance - GTSAM_UNSTABLE_EXPORT bool equals(const Similarity3& sim, double tol) const; + GTSAM_EXPORT bool equals(const Similarity3& sim, double tol) const; /// Exact equality - GTSAM_UNSTABLE_EXPORT bool operator==(const Similarity3& other) const; + GTSAM_EXPORT bool operator==(const Similarity3& other) const; /// Print with optional string - GTSAM_UNSTABLE_EXPORT void print(const std::string& s) const; + GTSAM_EXPORT void print(const std::string& s) const; - GTSAM_UNSTABLE_EXPORT friend std::ostream &operator<<(std::ostream &os, const Similarity3& p); + GTSAM_EXPORT friend std::ostream &operator<<(std::ostream &os, const Similarity3& p); /// @} /// @name Group /// @{ /// Return an identity transform - GTSAM_UNSTABLE_EXPORT static Similarity3 identity(); + GTSAM_EXPORT static Similarity3 identity(); /// Composition - GTSAM_UNSTABLE_EXPORT Similarity3 operator*(const Similarity3& S) const; + GTSAM_EXPORT Similarity3 operator*(const Similarity3& S) const; /// Return the inverse - GTSAM_UNSTABLE_EXPORT Similarity3 inverse() const; + GTSAM_EXPORT Similarity3 inverse() const; /// @} /// @name Group action on Point3 /// @{ /// Action on a point p is s*(R*p+t) - GTSAM_UNSTABLE_EXPORT Point3 transformFrom(const Point3& p, // + GTSAM_EXPORT Point3 transformFrom(const Point3& p, // OptionalJacobian<3, 7> H1 = boost::none, // OptionalJacobian<3, 3> H2 = boost::none) const; @@ -115,15 +115,15 @@ public: * This group action satisfies the compatibility condition. * For more details, refer to: https://en.wikipedia.org/wiki/Group_action */ - GTSAM_UNSTABLE_EXPORT Pose3 transformFrom(const Pose3& T) const; + GTSAM_EXPORT Pose3 transformFrom(const Pose3& T) const; /** syntactic sugar for transformFrom */ - GTSAM_UNSTABLE_EXPORT Point3 operator*(const Point3& p) const; + GTSAM_EXPORT Point3 operator*(const Point3& p) const; /** * Create Similarity3 by aligning at least three point pairs */ - GTSAM_UNSTABLE_EXPORT static Similarity3 Align(const std::vector& abPointPairs); + GTSAM_EXPORT static Similarity3 Align(const std::vector& abPointPairs); /** * Create the Similarity3 object that aligns at least two pose pairs. @@ -135,7 +135,7 @@ public: * using the algorithm described here: * http://www5.informatik.uni-erlangen.de/Forschung/Publikationen/2005/Zinsser05-PSR.pdf */ - GTSAM_UNSTABLE_EXPORT static Similarity3 Align(const std::vector& abPosePairs); + GTSAM_EXPORT static Similarity3 Align(const std::vector& abPosePairs); /// @} /// @name Lie Group @@ -144,12 +144,12 @@ public: /** Log map at the identity * \f$ [R_x,R_y,R_z, t_x, t_y, t_z, \lambda] \f$ */ - GTSAM_UNSTABLE_EXPORT static Vector7 Logmap(const Similarity3& s, // + GTSAM_EXPORT static Vector7 Logmap(const Similarity3& s, // OptionalJacobian<7, 7> Hm = boost::none); /** Exponential map at the identity */ - GTSAM_UNSTABLE_EXPORT static Similarity3 Expmap(const Vector7& v, // + GTSAM_EXPORT static Similarity3 Expmap(const Vector7& v, // OptionalJacobian<7, 7> Hm = boost::none); /// Chart at the origin @@ -170,17 +170,17 @@ public: * @return 4*4 element of Lie algebra that can be exponentiated * TODO(frank): rename to Hat, make part of traits */ - GTSAM_UNSTABLE_EXPORT static Matrix4 wedge(const Vector7& xi); + GTSAM_EXPORT static Matrix4 wedge(const Vector7& xi); /// Project from one tangent space to another - GTSAM_UNSTABLE_EXPORT Matrix7 AdjointMap() const; + GTSAM_EXPORT Matrix7 AdjointMap() const; /// @} /// @name Standard interface /// @{ /// Calculate 4*4 matrix group equivalent - GTSAM_UNSTABLE_EXPORT const Matrix4 matrix() const; + GTSAM_EXPORT const Matrix4 matrix() const; /// Return a GTSAM rotation const Rot3& rotation() const { @@ -199,7 +199,7 @@ public: /// Convert to a rigid body pose (R, s*t) /// TODO(frank): why is this here? Red flag! Definitely don't have it as a cast. - GTSAM_UNSTABLE_EXPORT operator Pose3() const; + GTSAM_EXPORT operator Pose3() const; /// Dimensionality of tangent space = 7 DOF - used to autodetect sizes inline static size_t Dim() { diff --git a/gtsam/gtsam.i b/gtsam/gtsam.i index 38653ea9c..ba06dcbf2 100644 --- a/gtsam/gtsam.i +++ b/gtsam/gtsam.i @@ -1037,8 +1037,8 @@ class Similarity3 { Similarity3(const Matrix& T); gtsam::Pose3 transformFrom(const gtsam::Pose3& T); - static Similarity3 Align(const gtsam::Point3Pairs & abPointPairs); - static Similarity3 Align(const gtsam::Pose3Pairs & abPosePairs); + static gtsam::Similarity3 Align(const gtsam::Point3Pairs & abPointPairs); + static gtsam::Similarity3 Align(const gtsam::Pose3Pairs & abPosePairs); // Standard Interface const Matrix matrix() const;