Added timeMatrix.cpp to test specific matrix operations
							parent
							
								
									3cdbaf81c7
								
							
						
					
					
						commit
						67878830a6
					
				
							
								
								
									
										13
									
								
								.cproject
								
								
								
								
							
							
						
						
									
										13
									
								
								.cproject
								
								
								
								
							|  | @ -468,7 +468,6 @@ | ||||||
| </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,6 +475,7 @@ | ||||||
| </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> | ||||||
|  | @ -483,7 +483,6 @@ | ||||||
| </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> | ||||||
|  | @ -715,7 +714,6 @@ | ||||||
| </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> | ||||||
|  | @ -771,11 +769,20 @@ | ||||||
| </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> | ||||||
| <runAllBuilders>true</runAllBuilders> | <runAllBuilders>true</runAllBuilders> | ||||||
| </target> | </target> | ||||||
|  | <target name="timeMatrix.run" path="cpp" targetID="org.eclipse.cdt.build.MakeTargetBuilder"> | ||||||
|  | <buildCommand>make</buildCommand> | ||||||
|  | <buildArguments>-j2</buildArguments> | ||||||
|  | <buildTarget>timeMatrix.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> | ||||||
|  |  | ||||||
|  | @ -249,13 +249,15 @@ testVSLAMConfig_LDADD = libgtsam.la | ||||||
| headers += $(sources:.cpp=.h) | headers += $(sources:.cpp=.h) | ||||||
| 
 | 
 | ||||||
| # Timing tests
 | # Timing tests
 | ||||||
| noinst_PROGRAMS = timeGaussianFactor timeGaussianFactorGraph timeRot3 | noinst_PROGRAMS = timeGaussianFactor timeGaussianFactorGraph timeRot3 timeMatrix | ||||||
| timeRot3_SOURCES = timeRot3.cpp | timeRot3_SOURCES = timeRot3.cpp | ||||||
| timeRot3_LDADD = libgtsam.la | timeRot3_LDADD = libgtsam.la | ||||||
| timeGaussianFactor_SOURCES = timeGaussianFactor.cpp | timeGaussianFactor_SOURCES = timeGaussianFactor.cpp | ||||||
| timeGaussianFactor_LDADD = libgtsam.la  | timeGaussianFactor_LDADD = libgtsam.la  | ||||||
| timeGaussianFactorGraph_SOURCES = timeGaussianFactorGraph.cpp | timeGaussianFactorGraph_SOURCES = timeGaussianFactorGraph.cpp | ||||||
| timeGaussianFactorGraph_LDADD = libgtsam.la | timeGaussianFactorGraph_LDADD = libgtsam.la | ||||||
|  | timeMatrix_SOURCES 			  = timeMatrix.cpp  | ||||||
|  | timeMatrix_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,44 @@ | ||||||
|  | /*
 | ||||||
|  |  * @file timeMatrix.cpp | ||||||
|  |  * @brief Performs timing and profiling for Matrix operations | ||||||
|  |  * @author Alex Cunningham | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #include <iostream> | ||||||
|  | #include <boost/progress.hpp> | ||||||
|  | #include "Matrix.h" | ||||||
|  | 
 | ||||||
|  | using namespace std; | ||||||
|  | using namespace gtsam; | ||||||
|  | 
 | ||||||
|  | int main(int argc, char ** argv) { | ||||||
|  | 	cout << "Starting Matrix::collect() Timing" << endl; | ||||||
|  | 
 | ||||||
|  | 	// create a large number of matrices
 | ||||||
|  | 	size_t n, m, p; | ||||||
|  | 	p = 100000; // number of matrices
 | ||||||
|  | 	n = 10;  // rows per matrix
 | ||||||
|  | 	m = 12;  // columns per matrix
 | ||||||
|  | 
 | ||||||
|  | 	// fill the matrices with identities
 | ||||||
|  | 	vector<const Matrix *> matrices; | ||||||
|  | 	for (int i=0; i<p;++i) { | ||||||
|  | 		Matrix * M = new Matrix; | ||||||
|  | 		(*M) = eye(m,n); | ||||||
|  | 		matrices.push_back(M); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	// start timing
 | ||||||
|  | 	Matrix result; | ||||||
|  | 	{ | ||||||
|  | 		boost::progress_timer t; | ||||||
|  | 		result = collect(matrices); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	// delete the matrices
 | ||||||
|  | 	for (int i=0; i<p;++i) { | ||||||
|  | 		delete matrices[i]; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue