diff --git a/.cproject b/.cproject index 8d2bd0378..36f003997 100644 --- a/.cproject +++ b/.cproject @@ -24,22 +24,30 @@ + + + @@ -71,20 +79,31 @@ + + - + @@ -116,12 +135,18 @@ + + @@ -131,10 +156,14 @@ + + @@ -160,6 +189,8 @@ + + @@ -245,6 +276,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -288,9 +448,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - @@ -317,14 +518,6 @@ true true - - make - -j2 - testGaussianFactor.run - true - true - true - make -j2 @@ -351,6 +544,7 @@ make + tests/testBayesTree.run true false @@ -358,6 +552,7 @@ make + testBinaryBayesNet.run true false @@ -405,6 +600,7 @@ make + testSymbolicBayesNet.run true false @@ -412,6 +608,7 @@ make + tests/testSymbolicFactor.run true false @@ -419,6 +616,7 @@ make + testSymbolicFactorGraph.run true false @@ -434,11 +632,20 @@ make + tests/testBayesTree true false true + + make + -j2 + testGaussianFactor.run + true + true + true + make -j5 @@ -495,6 +702,14 @@ true true + + make + -j5 + timeDSFvariants.run + true + true + true + make -j2 @@ -535,22 +750,6 @@ false true - - make - -j2 - all - true - true - true - - - make - -j2 - clean - true - true - true - make -j2 @@ -567,6 +766,22 @@ true true + + make + -j2 + all + true + true + true + + + make + -j2 + clean + true + true + true + make -j2 @@ -591,42 +806,26 @@ true true - + make - -j5 - testValues.run + -j2 + all true true true - + make - -j5 - testOrdering.run + -j2 + check true true true - + make - -j5 - testKey.run - true - true - true - - - make - -j5 - testLinearContainerFactor.run - true - true - true - - - make - -j6 -j8 - testWhiteNoiseFactor.run + -j2 + clean true true true @@ -679,26 +878,42 @@ true true - + make - -j2 - all + -j5 + testValues.run true true true - + make - -j2 - check + -j5 + testOrdering.run true true true - + make - -j2 - clean + -j5 + testKey.run + true + true + true + + + make + -j5 + testLinearContainerFactor.run + true + true + true + + + make + -j6 -j8 + testWhiteNoiseFactor.run true true true @@ -1097,6 +1312,7 @@ make + testGraph.run true false @@ -1104,6 +1320,7 @@ make + testJunctionTree.run true false @@ -1111,6 +1328,7 @@ make + testSymbolicBayesNetB.run true false @@ -1278,6 +1496,7 @@ make + testErrors.run true false @@ -1323,14 +1542,6 @@ true true - - make - -j2 - testGaussianFactor.run - true - true - true - make -j2 @@ -1411,6 +1622,14 @@ true true + + make + -j2 + testGaussianFactor.run + true + true + true + make -j2 @@ -1717,7 +1936,6 @@ make - testSimulated2DOriented.run true false @@ -1757,7 +1975,6 @@ make - testSimulated2D.run true false @@ -1765,7 +1982,6 @@ make - testSimulated3D.run true false @@ -2053,7 +2269,6 @@ make - tests/testGaussianISAM2 true false @@ -2075,102 +2290,6 @@ true true - - make - -j2 - testRot3.run - true - true - true - - - make - -j2 - testRot2.run - true - true - true - - - make - -j2 - testPose3.run - true - true - true - - - make - -j2 - timeRot3.run - true - true - true - - - make - -j2 - testPose2.run - true - true - true - - - make - -j2 - testCal3_S2.run - true - true - true - - - make - -j2 - testSimpleCamera.run - true - true - true - - - make - -j2 - testHomography2.run - true - true - true - - - make - -j2 - testCalibratedCamera.run - true - true - true - - - make - -j2 - check - true - true - true - - - make - -j2 - clean - true - true - true - - - make - -j2 - testPoint2.run - true - true - true - make -j3 @@ -2372,6 +2491,7 @@ cpack + -G DEB true false @@ -2379,6 +2499,7 @@ cpack + -G RPM true false @@ -2386,6 +2507,7 @@ cpack + -G TGZ true false @@ -2393,6 +2515,7 @@ cpack + --config CPackSourceConfig.cmake true false @@ -2558,34 +2681,98 @@ true true - + make - -j5 - testSpirit.run + -j2 + testRot3.run true true true - + make - -j5 - testWrap.run + -j2 + testRot2.run true true true - + make - -j5 - check.wrap + -j2 + testPose3.run true true true - + make - -j5 - wrap + -j2 + timeRot3.run + true + true + true + + + make + -j2 + testPose2.run + true + true + true + + + make + -j2 + testCal3_S2.run + true + true + true + + + make + -j2 + testSimpleCamera.run + true + true + true + + + make + -j2 + testHomography2.run + true + true + true + + + make + -j2 + testCalibratedCamera.run + true + true + true + + + make + -j2 + check + true + true + true + + + make + -j2 + clean + true + true + true + + + make + -j2 + testPoint2.run true true true @@ -2629,6 +2816,38 @@ false true + + make + -j5 + testSpirit.run + true + true + true + + + make + -j5 + testWrap.run + true + true + true + + + make + -j5 + check.wrap + true + true + true + + + make + -j5 + wrap + true + true + true + diff --git a/gtsam_unstable/base/CMakeLists.txt b/gtsam_unstable/base/CMakeLists.txt index 2436c7c00..40337f6a6 100644 --- a/gtsam_unstable/base/CMakeLists.txt +++ b/gtsam_unstable/base/CMakeLists.txt @@ -12,3 +12,8 @@ set (base_excluded_tests "") # Add all tests gtsam_add_subdir_tests(base_unstable "${base_full_libs}" "${base_full_libs}" "${base_excluded_tests}") add_dependencies(check.unstable check.base_unstable) + +# Build timing scripts +if (GTSAM_BUILD_TIMING) + gtsam_add_subdir_timing(base_unstable "${base_full_libs}" "${base_full_libs}" "${base_excluded_files}") +endif(GTSAM_BUILD_TIMING) diff --git a/gtsam_unstable/base/tests/timeDSFvariants.cpp b/gtsam_unstable/base/tests/timeDSFvariants.cpp new file mode 100644 index 000000000..c2b9ebe2e --- /dev/null +++ b/gtsam_unstable/base/tests/timeDSFvariants.cpp @@ -0,0 +1,120 @@ +/* ---------------------------------------------------------------------------- + + * GTSAM Copyright 2010, Georgia Tech Research Corporation, + * Atlanta, Georgia 30332-0415 + * All Rights Reserved + * Authors: Frank Dellaert, et al. (see THANKS for the full author list) + + * See LICENSE for the license information + + * -------------------------------------------------------------------------- */ + +/** + * @file timeDSFvariants.cpp + * @brief Time different implementations of DSF + * @author Frank Dellaert + * @date Oct 26, 2013 + */ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +using namespace std; +using namespace gtsam; +using namespace boost::assign; +using boost::timer; +using boost::format; + +int main(int argc, char* argv[]) { + + // Create CSV file for results + ofstream os("dsf-timing.csv"); + os << "images,points,matches,Base,Map,BTree" << endl; + + // loop over number of images + vector ms; + ms += 10, 20, 30, 40, 50, 100, 200, 300, 400, 500; + BOOST_FOREACH(size_t m,ms) { + // We use volatile here to make these appear to the optimizing compiler as + // if their values are only known at run-time. + volatile size_t n = 500; // number of points per image + volatile size_t N = m * n; // number of points per image + + volatile double fm = 0.1; // fraction of image pairs matched + volatile size_t np = fm * m * m / 2; // number of image pairs + volatile double fpm = 0.5; // fraction of points matched + volatile size_t nm = fpm * n * np; // number of matches + + cout << format("\nTesting with %1% images, %2% points, %3% matches\n") % m % N % nm; + cout << "Generating " << nm << " matches" << endl; + boost::variate_generator > rn( + boost::mt19937(), boost::uniform_int(0, N - 1)); + typedef pair Match; + vector matches; + matches.reserve(nm); + for (size_t k = 0; k < nm; k++) + matches.push_back(Match(rn(), rn())); + + os << format("%1%,%2%,%3%,") % m % N % nm; + + { + // DSFBase version + timer tim; + DSFBase dsf(N); // Allow for N keys + BOOST_FOREACH(const Match& m, matches) + dsf.merge(m.first, m.second); + os << tim.elapsed() << ","; + cout << format("DSFBase: %1% s") % tim.elapsed() << endl; + } + + { + // DSFMap version + timer tim; + DSFMap dsf; + BOOST_FOREACH(const Match& m, matches) + dsf.merge(m.first, m.second); + os << tim.elapsed() << ","; + cout << format("DSFMap: %1% s") % tim.elapsed() << endl; + } + + { + // DSF version, functional + timer tim; + DSF dsf; + for (size_t j = 0; j < N; j++) + dsf = dsf.makeSet(j); + BOOST_FOREACH(const Match& m, matches) + dsf = dsf.makeUnion(m.first, m.second); + os << tim.elapsed() << endl; + cout << format("DSF functional: %1% s") % tim.elapsed() << endl; + } + + if (false) { + // DSF version, in place - always slower - use functional ! + timer tim; + DSF dsf; + for (size_t j = 0; j < N; j++) + dsf.makeSetInPlace(j); + BOOST_FOREACH(const Match& m, matches) + dsf.makeUnionInPlace(m.first, m.second); + os << tim.elapsed() << ","; + cout << format("DSF in-place: %1% s") % tim.elapsed() << endl; + } + + } + + return 0; + +} diff --git a/gtsam_unstable/base/tests/timeDSFvariants.xlsx b/gtsam_unstable/base/tests/timeDSFvariants.xlsx new file mode 100644 index 000000000..b9912247f Binary files /dev/null and b/gtsam_unstable/base/tests/timeDSFvariants.xlsx differ