timing VectorConfig to speed up iterative
parent
eb88a149a1
commit
65bc90bf15
13
.cproject
13
.cproject
|
@ -469,6 +469,7 @@
|
||||||
</target>
|
</target>
|
||||||
<target name="testBayesTree.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="testBayesTree.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments/>
|
||||||
<buildTarget>testBayesTree.run</buildTarget>
|
<buildTarget>testBayesTree.run</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>false</useDefaultCommand>
|
<useDefaultCommand>false</useDefaultCommand>
|
||||||
|
@ -476,7 +477,6 @@
|
||||||
</target>
|
</target>
|
||||||
<target name="testSymbolicBayesNet.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="testSymbolicBayesNet.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments/>
|
|
||||||
<buildTarget>testSymbolicBayesNet.run</buildTarget>
|
<buildTarget>testSymbolicBayesNet.run</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>false</useDefaultCommand>
|
<useDefaultCommand>false</useDefaultCommand>
|
||||||
|
@ -484,6 +484,7 @@
|
||||||
</target>
|
</target>
|
||||||
<target name="testSymbolicFactorGraph.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="testSymbolicFactorGraph.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments/>
|
||||||
<buildTarget>testSymbolicFactorGraph.run</buildTarget>
|
<buildTarget>testSymbolicFactorGraph.run</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>false</useDefaultCommand>
|
<useDefaultCommand>false</useDefaultCommand>
|
||||||
|
@ -707,6 +708,7 @@
|
||||||
</target>
|
</target>
|
||||||
<target name="testGraph.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="testGraph.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments/>
|
||||||
<buildTarget>testGraph.run</buildTarget>
|
<buildTarget>testGraph.run</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>false</useDefaultCommand>
|
<useDefaultCommand>false</useDefaultCommand>
|
||||||
|
@ -762,7 +764,6 @@
|
||||||
</target>
|
</target>
|
||||||
<target name="testSimulated2D.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="testSimulated2D.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments/>
|
|
||||||
<buildTarget>testSimulated2D.run</buildTarget>
|
<buildTarget>testSimulated2D.run</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>false</useDefaultCommand>
|
<useDefaultCommand>false</useDefaultCommand>
|
||||||
|
@ -784,6 +785,14 @@
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
<runAllBuilders>true</runAllBuilders>
|
<runAllBuilders>true</runAllBuilders>
|
||||||
</target>
|
</target>
|
||||||
|
<target name="timeVectorConfig.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments>-j2</buildArguments>
|
||||||
|
<buildTarget>timeVectorConfig.run</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>true</runAllBuilders>
|
||||||
|
</target>
|
||||||
<target name="install" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="install" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments>-j2</buildArguments>
|
<buildArguments>-j2</buildArguments>
|
||||||
|
|
|
@ -238,7 +238,7 @@ testVSLAMConfig_LDADD = libgtsam.la
|
||||||
headers += $(sources:.cpp=.h)
|
headers += $(sources:.cpp=.h)
|
||||||
|
|
||||||
# Timing tests
|
# Timing tests
|
||||||
noinst_PROGRAMS = timeGaussianFactor timeGaussianFactorGraph timeRot3 timeMatrix timeSymbolMaps
|
noinst_PROGRAMS = timeGaussianFactor timeGaussianFactorGraph timeRot3 timeMatrix timeSymbolMaps timeVectorConfig
|
||||||
timeRot3_SOURCES = timeRot3.cpp
|
timeRot3_SOURCES = timeRot3.cpp
|
||||||
timeRot3_LDADD = libgtsam.la
|
timeRot3_LDADD = libgtsam.la
|
||||||
timeGaussianFactor_SOURCES = timeGaussianFactor.cpp
|
timeGaussianFactor_SOURCES = timeGaussianFactor.cpp
|
||||||
|
@ -249,6 +249,8 @@ timeMatrix_SOURCES = timeMatrix.cpp
|
||||||
timeMatrix_LDADD = libgtsam.la
|
timeMatrix_LDADD = libgtsam.la
|
||||||
timeSymbolMaps_SOURCES = timeSymbolMaps.cpp
|
timeSymbolMaps_SOURCES = timeSymbolMaps.cpp
|
||||||
timeSymbolMaps_LDADD = libgtsam.la
|
timeSymbolMaps_LDADD = libgtsam.la
|
||||||
|
timeVectorConfig_SOURCES = timeVectorConfig.cpp
|
||||||
|
timeVectorConfig_LDADD = libgtsam.la
|
||||||
|
|
||||||
# create both dynamic and static libraries
|
# create both dynamic and static libraries
|
||||||
AM_CXXFLAGS = -I$(boost) -fPIC
|
AM_CXXFLAGS = -I$(boost) -fPIC
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* @file timeVectorConfig.cpp
|
||||||
|
* @brief Performs timing and profiling for VectorConfig operations
|
||||||
|
* @author Frank Dellaert
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <boost/timer.hpp>
|
||||||
|
#include "VectorConfig.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace gtsam;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Results:
|
||||||
|
* Frank's machine:
|
||||||
|
*/
|
||||||
|
double timeAssignment(size_t n, size_t m, size_t r) {
|
||||||
|
// assign a large VectorConfig
|
||||||
|
// n = number of times to loop
|
||||||
|
// m = number of vectors
|
||||||
|
// r = rows per vector
|
||||||
|
|
||||||
|
// Create 2 VectorConfigs
|
||||||
|
VectorConfig a, b;
|
||||||
|
for (int i = 0; i < m; ++i) {
|
||||||
|
Vector v = zero(r);
|
||||||
|
Symbol key('x', i);
|
||||||
|
a.add(key, v);
|
||||||
|
b.add(key, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
// start timing
|
||||||
|
double elapsed;
|
||||||
|
{
|
||||||
|
boost::timer t;
|
||||||
|
|
||||||
|
for (int j = 0; j < n; ++j)
|
||||||
|
a = b;
|
||||||
|
|
||||||
|
elapsed = t.elapsed();
|
||||||
|
}
|
||||||
|
|
||||||
|
return elapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char ** argv) {
|
||||||
|
|
||||||
|
// Time assignment operator
|
||||||
|
cout << "Starting operator=() Timing" << endl;
|
||||||
|
size_t n = 1000, m = 10000, r = 3;
|
||||||
|
double time = timeAssignment(n, m, r);
|
||||||
|
cout << "Average Elapsed time for assigning " << m << "*" << r
|
||||||
|
<< " VectorConfigs: " << 10e3 * time / n << "ms." << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue