Merge remote-tracking branch 'borglab/develop' into develop
commit
34e429af9e
49
.travis.sh
49
.travis.sh
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# common tasks before either build or test
|
||||
function prepare ()
|
||||
function configure()
|
||||
{
|
||||
set -e # Make sure any error makes the script to return an error code
|
||||
set -x # echo
|
||||
|
|
@ -14,21 +14,23 @@ function prepare ()
|
|||
rm -fr $BUILD_DIR || true
|
||||
mkdir $BUILD_DIR && cd $BUILD_DIR
|
||||
|
||||
if [ -z "$CMAKE_BUILD_TYPE" ]; then
|
||||
CMAKE_BUILD_TYPE=Debug
|
||||
fi
|
||||
|
||||
if [ -z "$GTSAM_ALLOW_DEPRECATED_SINCE_V4" ]; then
|
||||
GTSAM_ALLOW_DEPRECATED_SINCE_V4=OFF
|
||||
fi
|
||||
|
||||
if [ ! -z "$GCC_VERSION" ]; then
|
||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$GCC_VERSION 60 \
|
||||
--slave /usr/bin/g++ g++ /usr/bin/g++-$GCC_VERSION
|
||||
sudo update-alternatives --set gcc /usr/bin/gcc-$GCC_VERSION
|
||||
export CC=gcc-$GCC_VERSION
|
||||
export CXX=g++-$GCC_VERSION
|
||||
fi
|
||||
|
||||
# GTSAM_BUILD_WITH_MARCH_NATIVE=OFF: to avoid crashes in builder VMs
|
||||
cmake $SOURCE_DIR \
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Debug} \
|
||||
-DGTSAM_BUILD_TESTS=${GTSAM_BUILD_TESTS:-OFF} \
|
||||
-DGTSAM_BUILD_UNSTABLE=${GTSAM_BUILD_UNSTABLE:-ON} \
|
||||
-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
|
||||
}
|
||||
|
||||
|
||||
# common tasks after either build or test
|
||||
function finish ()
|
||||
{
|
||||
|
|
@ -41,17 +43,12 @@ function finish ()
|
|||
# compile the code with the intent of populating the cache
|
||||
function build ()
|
||||
{
|
||||
prepare
|
||||
export GTSAM_BUILD_EXAMPLES_ALWAYS=ON
|
||||
export GTSAM_BUILD_TESTS=OFF
|
||||
|
||||
cmake $SOURCE_DIR \
|
||||
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
|
||||
-DGTSAM_BUILD_TESTS=OFF \
|
||||
-DGTSAM_BUILD_UNSTABLE=$GTSAM_BUILD_UNSTABLE \
|
||||
-DGTSAM_BUILD_EXAMPLES_ALWAYS=ON \
|
||||
-DGTSAM_ALLOW_DEPRECATED_SINCE_V4=$GTSAM_ALLOW_DEPRECATED_SINCE_V4
|
||||
configure
|
||||
|
||||
# Actual build:
|
||||
VERBOSE=1 make -j2
|
||||
make -j2
|
||||
|
||||
finish
|
||||
}
|
||||
|
|
@ -59,14 +56,10 @@ function build ()
|
|||
# run the tests
|
||||
function test ()
|
||||
{
|
||||
prepare
|
||||
export GTSAM_BUILD_EXAMPLES_ALWAYS=OFF
|
||||
export GTSAM_BUILD_TESTS=ON
|
||||
|
||||
cmake $SOURCE_DIR \
|
||||
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
|
||||
-DGTSAM_BUILD_TESTS=ON \
|
||||
-DGTSAM_BUILD_UNSTABLE=$GTSAM_BUILD_UNSTABLE \
|
||||
-DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF \
|
||||
-DGTSAM_ALLOW_DEPRECATED_SINCE_V4=OFF
|
||||
configure
|
||||
|
||||
# Actual build:
|
||||
make -j2 check
|
||||
|
|
|
|||
78
.travis.yml
78
.travis.yml
|
|
@ -7,11 +7,12 @@ addons:
|
|||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- sourceline: 'deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
|
||||
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
||||
packages:
|
||||
- g++-8
|
||||
- clang-3.8
|
||||
- build-essential
|
||||
- pkg-config
|
||||
- g++-9
|
||||
- clang-9
|
||||
- build-essential pkg-config
|
||||
- cmake
|
||||
- libpython-dev python-numpy
|
||||
- libboost-all-dev
|
||||
|
|
@ -28,8 +29,14 @@ stages:
|
|||
- compile
|
||||
- test
|
||||
|
||||
env:
|
||||
global:
|
||||
- MAKEFLAGS="-j2"
|
||||
- CCACHE_SLOPPINESS=pch_defines,time_macros
|
||||
|
||||
# Compile stage without building examples/tests to populate the caches.
|
||||
jobs:
|
||||
# -------- STAGE 1: COMPILE -----------
|
||||
include:
|
||||
# on Mac, GCC
|
||||
- stage: compile
|
||||
|
|
@ -68,46 +75,45 @@ jobs:
|
|||
- stage: compile
|
||||
os: linux
|
||||
compiler: clang
|
||||
env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=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
|
||||
compiler: clang
|
||||
env: CMAKE_BUILD_TYPE=Release
|
||||
env: CC=clang-9 CXX=clang++-9 CMAKE_BUILD_TYPE=Release
|
||||
script: bash .travis.sh -b
|
||||
# on Linux, with deprecated ON to make sure that path still compiles
|
||||
- stage: compile
|
||||
os: linux
|
||||
compiler: clang
|
||||
env: 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
|
||||
script: bash .travis.sh -b
|
||||
|
||||
# Matrix configuration:
|
||||
os:
|
||||
- osx
|
||||
- linux
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
env:
|
||||
global:
|
||||
- MAKEFLAGS="-j2"
|
||||
- CCACHE_SLOPPINESS=pch_defines,time_macros
|
||||
- GTSAM_ALLOW_DEPRECATED_SINCE_V4=OFF
|
||||
- GTSAM_BUILD_UNSTABLE=ON
|
||||
matrix:
|
||||
- CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF
|
||||
- CMAKE_BUILD_TYPE=Release
|
||||
script:
|
||||
- bash .travis.sh -t
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
# Exclude g++ debug on Linux as it consistently times out
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env : CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF
|
||||
# Exclude clang on Linux/clang in release until issue #57 is solved
|
||||
- os: linux
|
||||
# -------- STAGE 2: TESTS -----------
|
||||
# on Mac, GCC
|
||||
- stage: test
|
||||
os: osx
|
||||
compiler: clang
|
||||
env : CMAKE_BUILD_TYPE=Release
|
||||
env: CMAKE_BUILD_TYPE=Release
|
||||
script: bash .travis.sh -t
|
||||
- stage: test
|
||||
os: osx
|
||||
compiler: clang
|
||||
env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF
|
||||
script: bash .travis.sh -t
|
||||
- stage: test
|
||||
os: linux
|
||||
compiler: gcc
|
||||
env: CMAKE_BUILD_TYPE=Release
|
||||
script: bash .travis.sh -t
|
||||
# Exclude g++ debug on Linux as it consistently times out
|
||||
# - stage: test
|
||||
# os: linux
|
||||
# compiler: gcc
|
||||
# env: CMAKE_BUILD_TYPE=Debug GTSAM_BUILD_UNSTABLE=OFF
|
||||
# script: bash .travis.sh -t
|
||||
# Exclude clang on Linux/clang in release until issue #57 is solved
|
||||
# - stage: test
|
||||
# os: linux
|
||||
# compiler: clang
|
||||
# env: CC=clang-9 CXX=clang++-9 CMAKE_BUILD_TYPE=Release
|
||||
# script: bash .travis.sh -t
|
||||
|
|
|
|||
|
|
@ -434,7 +434,7 @@ add_subdirectory(timing)
|
|||
# Build gtsam_unstable
|
||||
if (GTSAM_BUILD_UNSTABLE)
|
||||
add_subdirectory(gtsam_unstable)
|
||||
endif(GTSAM_BUILD_UNSTABLE)
|
||||
endif()
|
||||
|
||||
# Matlab toolbox
|
||||
if (GTSAM_INSTALL_MATLAB_TOOLBOX)
|
||||
|
|
|
|||
|
|
@ -29,14 +29,22 @@
|
|||
# undef max
|
||||
# undef ERROR
|
||||
|
||||
#include <functional> // std::hash()
|
||||
|
||||
// Use TBB concurrent_unordered_map for ConcurrentMap
|
||||
# define CONCURRENT_MAP_BASE tbb::concurrent_unordered_map<KEY, VALUE>
|
||||
template <typename KEY, typename VALUE>
|
||||
using ConcurrentMapBase = tbb::concurrent_unordered_map<
|
||||
KEY,
|
||||
VALUE,
|
||||
std::hash<KEY>
|
||||
>;
|
||||
|
||||
#else
|
||||
|
||||
// If we're not using TBB, use a FastMap for ConcurrentMap
|
||||
# include <gtsam/base/FastMap.h>
|
||||
# define CONCURRENT_MAP_BASE gtsam::FastMap<KEY, VALUE>
|
||||
#include <gtsam/base/FastMap.h>
|
||||
template <typename KEY, typename VALUE>
|
||||
using ConcurrentMapBase = gtsam::FastMap<KEY, VALUE>;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -57,11 +65,11 @@ namespace gtsam {
|
|||
* @addtogroup base
|
||||
*/
|
||||
template<typename KEY, typename VALUE>
|
||||
class ConcurrentMap : public CONCURRENT_MAP_BASE {
|
||||
class ConcurrentMap : public ConcurrentMapBase<KEY,VALUE> {
|
||||
|
||||
public:
|
||||
|
||||
typedef CONCURRENT_MAP_BASE Base;
|
||||
typedef ConcurrentMapBase<KEY,VALUE> Base;
|
||||
|
||||
/** Default constructor */
|
||||
ConcurrentMap() {}
|
||||
|
|
|
|||
|
|
@ -115,8 +115,8 @@ class DSFMap {
|
|||
/// Small utility class for representing a wrappable pairs of ints.
|
||||
class IndexPair : public std::pair<size_t,size_t> {
|
||||
public:
|
||||
IndexPair(): std::pair<size_t,size_t>(0,0) {}
|
||||
IndexPair(size_t i, size_t j) : std::pair<size_t,size_t>(i,j) {}
|
||||
inline IndexPair(): std::pair<size_t,size_t>(0,0) {}
|
||||
inline IndexPair(size_t i, size_t j) : std::pair<size_t,size_t>(i,j) {}
|
||||
inline size_t i() const { return first; };
|
||||
inline size_t j() const { return second; };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -89,12 +89,9 @@ public:
|
|||
|
||||
/**
|
||||
* Create a duplicate object returned as a pointer to the generic Value interface.
|
||||
* For the sake of performance, this function use singleton pool allocator instead of the normal heap allocator.
|
||||
* The result must be deleted with Value::deallocate_, not with the 'delete' operator.
|
||||
*/
|
||||
virtual Value* clone_() const {
|
||||
void *place = boost::singleton_pool<PoolTag, sizeof(GenericValue)>::malloc();
|
||||
GenericValue* ptr = new (place) GenericValue(*this); // calls copy constructor to fill in
|
||||
GenericValue* ptr = new GenericValue(*this); // calls copy constructor to fill in
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
|
@ -102,8 +99,7 @@ public:
|
|||
* Destroy and deallocate this object, only if it was originally allocated using clone_().
|
||||
*/
|
||||
virtual void deallocate_() const {
|
||||
this->~GenericValue(); // Virtual destructor cleans up the derived object
|
||||
boost::singleton_pool<PoolTag, sizeof(GenericValue)>::free((void*) this); // Release memory from pool
|
||||
delete this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -118,10 +114,7 @@ public:
|
|||
// Call retract on the derived class using the retract trait function
|
||||
const T retractResult = traits<T>::Retract(GenericValue<T>::value(), delta);
|
||||
|
||||
// Create a Value pointer copy of the result
|
||||
void* resultAsValuePlace =
|
||||
boost::singleton_pool<PoolTag, sizeof(GenericValue)>::malloc();
|
||||
Value* resultAsValue = new (resultAsValuePlace) GenericValue(retractResult);
|
||||
Value* resultAsValue = new GenericValue(retractResult);
|
||||
|
||||
// Return the pointer to the Value base class
|
||||
return resultAsValue;
|
||||
|
|
@ -172,12 +165,6 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/// Fake Tag struct for singleton pool allocator. In fact, it is never used!
|
||||
struct PoolTag {
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
/** Serialization function */
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <gtsam/config.h> // for GTSAM_USE_TBB
|
||||
|
||||
#include <boost/optional/optional.hpp>
|
||||
#include <gtsam/dllexport.h>
|
||||
#include <string>
|
||||
#include <typeinfo>
|
||||
|
||||
|
|
@ -117,7 +118,7 @@ public:
|
|||
};
|
||||
|
||||
/// Thread-safe runtime error exception
|
||||
class RuntimeErrorThreadsafe: public ThreadsafeException<RuntimeErrorThreadsafe> {
|
||||
class GTSAM_EXPORT RuntimeErrorThreadsafe: public ThreadsafeException<RuntimeErrorThreadsafe> {
|
||||
public:
|
||||
/// Construct with a string describing the exception
|
||||
RuntimeErrorThreadsafe(const std::string& description) :
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ namespace gtsam {
|
|||
/**
|
||||
* Small class that calls internal::tic at construction, and internol::toc when destroyed
|
||||
*/
|
||||
class AutoTicToc {
|
||||
class GTSAM_EXPORT AutoTicToc {
|
||||
private:
|
||||
size_t id_;
|
||||
const char* label_;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace gtsam {
|
|||
/** The common parameters for Nonlinear optimizers. Most optimizers
|
||||
* deriving from NonlinearOptimizer also subclass the parameters.
|
||||
*/
|
||||
class NonlinearOptimizerParams {
|
||||
class GTSAM_EXPORT NonlinearOptimizerParams {
|
||||
public:
|
||||
/** See NonlinearOptimizerParams::verbosity */
|
||||
enum Verbosity {
|
||||
|
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
virtual ~NonlinearOptimizerParams() {
|
||||
}
|
||||
GTSAM_EXPORT virtual void print(const std::string& str = "") const;
|
||||
virtual void print(const std::string& str = "") const;
|
||||
|
||||
size_t getMaxIterations() const { return maxIterations; }
|
||||
double getRelativeErrorTol() const { return relativeErrorTol; }
|
||||
|
|
@ -68,8 +68,8 @@ public:
|
|||
verbosity = verbosityTranslator(src);
|
||||
}
|
||||
|
||||
GTSAM_EXPORT static Verbosity verbosityTranslator(const std::string &s) ;
|
||||
GTSAM_EXPORT static std::string verbosityTranslator(Verbosity value) ;
|
||||
static Verbosity verbosityTranslator(const std::string &s) ;
|
||||
static std::string verbosityTranslator(Verbosity value) ;
|
||||
|
||||
/** See NonlinearOptimizerParams::linearSolverType */
|
||||
enum LinearSolverType {
|
||||
|
|
@ -144,10 +144,10 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
GTSAM_EXPORT std::string linearSolverTranslator(LinearSolverType linearSolverType) const;
|
||||
GTSAM_EXPORT LinearSolverType linearSolverTranslator(const std::string& linearSolverType) const;
|
||||
GTSAM_EXPORT std::string orderingTypeTranslator(Ordering::OrderingType type) const;
|
||||
GTSAM_EXPORT Ordering::OrderingType orderingTypeTranslator(const std::string& type) const;
|
||||
std::string linearSolverTranslator(LinearSolverType linearSolverType) const;
|
||||
LinearSolverType linearSolverTranslator(const std::string& linearSolverType) const;
|
||||
std::string orderingTypeTranslator(Ordering::OrderingType type) const;
|
||||
Ordering::OrderingType orderingTypeTranslator(const std::string& type) const;
|
||||
};
|
||||
|
||||
// For backward compatibility:
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace gtsam {
|
|||
|
||||
/* ************************************************************************* */
|
||||
/// A clique in a SymbolicBayesTree
|
||||
class SymbolicBayesTreeClique :
|
||||
class GTSAM_EXPORT SymbolicBayesTreeClique :
|
||||
public BayesTreeCliqueBase<SymbolicBayesTreeClique, SymbolicFactorGraph>
|
||||
{
|
||||
public:
|
||||
|
|
@ -45,7 +45,7 @@ namespace gtsam {
|
|||
/* ************************************************************************* */
|
||||
/// A Bayes tree that represents the connectivity between variables but is not associated with any
|
||||
/// probability functions.
|
||||
class SymbolicBayesTree :
|
||||
class GTSAM_EXPORT SymbolicBayesTree :
|
||||
public BayesTree<SymbolicBayesTreeClique>
|
||||
{
|
||||
private:
|
||||
|
|
@ -59,7 +59,7 @@ namespace gtsam {
|
|||
SymbolicBayesTree() {}
|
||||
|
||||
/** check equality */
|
||||
GTSAM_EXPORT bool equals(const This& other, double tol = 1e-9) const;
|
||||
bool equals(const This& other, double tol = 1e-9) const;
|
||||
|
||||
private:
|
||||
/** Serialization function */
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include <list>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "PartitionWorkSpace.h"
|
||||
|
|
|
|||
Loading…
Reference in New Issue