Loading src/Benchmarks/BLAS/dense-mv.h +2 −6 Original line number Diff line number Diff line Loading @@ -50,13 +50,9 @@ benchmarkDenseMVSynthetic( Benchmark<> & benchmark, HostVector inHostVector, outHostVector; CudaVector inCudaVector, outCudaVector1, outCudaVector2; // create benchmark group // set metadata const std::vector< String > parsedType = parseObjectType( getType< HostMatrix >() ); #ifdef HAVE_CUDA benchmark.createHorizontalGroup( parsedType[ 0 ], 2 ); #else benchmark.createHorizontalGroup( parsedType[ 0 ], 1 ); #endif benchmark.setMetadataElement({ "format", parsedType[ 0 ] }); hostMatrix.setDimensions( size, size ); inHostVector.setSize( size ); Loading src/Benchmarks/BLAS/spmv.h +2 −6 Original line number Diff line number Diff line Loading @@ -113,13 +113,9 @@ benchmarkSpMV( Benchmark<> & benchmark, HostVector hostVector, hostVector2; CudaVector deviceVector, deviceVector2; // create benchmark group // set metadata const std::vector< String > parsedType = parseObjectType( getType< HostMatrix >() ); #ifdef HAVE_CUDA benchmark.createHorizontalGroup( parsedType[ 0 ], 2 ); #else benchmark.createHorizontalGroup( parsedType[ 0 ], 1 ); #endif benchmark.setMetadataElement({ "format", parsedType[ 0 ] }); hostRowLengths.setSize( size ); hostMatrix.setDimensions( size, size ); Loading src/Benchmarks/Benchmark.hpp +23 −26 Original line number Diff line number Diff line Loading @@ -105,6 +105,27 @@ setMetadataColumns( const MetadataColumns & metadata ) Logger::metadataColumns = metadata; } template< typename Logger > void Benchmark< Logger >:: setMetadataElement( const typename MetadataColumns::value_type & element ) { bool found = false; for( auto & it : Logger::metadataColumns ) if( it.first == element.first ) { if( it.second != element.second ) { it.second = element.second; Logger::header_changed = true; } found = true; break; } if( ! found ) { Logger::metadataColumns.push_back( element ); Logger::header_changed = true; } } template< typename Logger > void Benchmark< Logger >:: Loading Loading @@ -133,27 +154,6 @@ setOperation( const double datasetSize, this->baseTime = baseTime; } template< typename Logger > void Benchmark< Logger >:: createHorizontalGroup( const String & name, int subcolumns ) { if( Logger::horizontalGroups.size() == 0 ) { Logger::horizontalGroups.push_back( {name, subcolumns} ); } else { auto & last = Logger::horizontalGroups.back(); if( last.first != name && last.second > 0 ) { Logger::horizontalGroups.push_back( {name, subcolumns} ); } else { last.first = name; last.second = subcolumns; } } } template< typename Logger > template< typename Device, typename ResetFunction, Loading Loading @@ -266,12 +266,9 @@ time( const String & performer, template< typename Logger > void Benchmark< Logger >:: addErrorMessage( const char* msg, int numberOfComputations ) addErrorMessage( const char* msg ) { // each computation has 3 subcolumns const int colspan = 3 * numberOfComputations; Logger::writeErrorMessage( msg, colspan ); Logger::writeErrorMessage( msg ); std::cerr << msg << std::endl; } Loading src/Benchmarks/Benchmarks.h +7 −13 Original line number Diff line number Diff line Loading @@ -105,7 +105,10 @@ class Benchmark // the next call to this function. void setMetadataColumns( const MetadataColumns & metadata ); // TODO: maybe should be renamed to createVerticalGroup and ensured that vertical and horizontal groups are not used within the same "Benchmark" // Sets the value of one metadata column -- useful for iteratively // changing MetadataColumns that were set using the previous method. void setMetadataElement( const typename MetadataColumns::value_type & element ); // Sets current operation -- operations expand the table vertically // - baseTime should be reset to 0.0 for most operations, but sometimes // it is useful to override it Loading @@ -119,17 +122,9 @@ class Benchmark void setOperation( const double datasetSize = 0.0, const double baseTime = 0.0 ); // Creates new horizontal groups inside a benchmark -- increases the number // of columns in the "Benchmark", implies column spanning. // (Useful e.g. for SpMV formats, different configurations etc.) void createHorizontalGroup( const String & name, int subcolumns ); // Times a single ComputeFunction. Subsequent calls implicitly split // the current "horizontal group" into sub-columns identified by // "performer", which are further split into "bandwidth", "time" and // "speedup" columns. // the current operation into sub-columns identified by "performer", // which are further split into "bandwidth", "time" and "speedup" columns. // TODO: allow custom columns bound to lambda functions (e.g. for Gflops calculation) // Also terminates the recursion of the following variadic template. template< typename Device, Loading Loading @@ -167,8 +162,7 @@ class Benchmark // Adds an error message to the log. Should be called in places where the // "time" method could not be called (e.g. due to failed allocation). void addErrorMessage( const char* msg, int numberOfComputations = 1 ); void addErrorMessage( const char* msg ); using Logger::save; Loading src/Benchmarks/CustomLogging.h +1 −42 Original line number Diff line number Diff line Loading @@ -88,28 +88,10 @@ public: log << header_indent << " " << it.first << std::endl; } // dump stacked spanning columns if( horizontalGroups.size() > 0 ) while( horizontalGroups.back().second <= 0 ) { horizontalGroups.pop_back(); header_indent.pop_back(); } for( size_t i = 0; i < horizontalGroups.size(); i++ ) { if( horizontalGroups[ i ].second > 0 ) { log << header_indent << " " << horizontalGroups[ i ].first << std::endl; header_indent += "!"; } } log << header_indent << " " << spanningElement << std::endl; for( auto & it : subElements ) { log << header_indent << "! " << it << std::endl; } if( horizontalGroups.size() > 0 ) { horizontalGroups.back().second--; header_indent.pop_back(); } } virtual void Loading Loading @@ -142,8 +124,7 @@ public: } virtual void writeErrorMessage( const char* msg, int colspan = 1 ) override writeErrorMessage( const char* msg ) override { // initial indent string header_indent = "!"; Loading @@ -152,26 +133,6 @@ public: log << header_indent << " " << it.first << std::endl; } // make sure there is a header column for the message if( horizontalGroups.size() == 0 ) horizontalGroups.push_back( {"", 1} ); // dump stacked spanning columns while( horizontalGroups.back().second <= 0 ) { horizontalGroups.pop_back(); header_indent.pop_back(); } for( size_t i = 0; i < horizontalGroups.size(); i++ ) { if( horizontalGroups[ i ].second > 0 ) { log << header_indent << " " << horizontalGroups[ i ].first << std::endl; header_indent += "!"; } } if( horizontalGroups.size() > 0 ) { horizontalGroups.back().second -= colspan; header_indent.pop_back(); } // only when changed (the header has been already adjusted) // print each element on separate line for( auto & it : metadataColumns ) { Loading @@ -186,7 +147,6 @@ public: log << std::endl; header_indent = body_indent = ""; header_changed = true; horizontalGroups.clear(); } virtual bool save( std::ostream & logFile ) override Loading Loading @@ -220,7 +180,6 @@ protected: MetadataColumns metadataColumns; bool header_changed = true; std::vector< std::pair< String, int > > horizontalGroups; String outputMode; }; Loading Loading
src/Benchmarks/BLAS/dense-mv.h +2 −6 Original line number Diff line number Diff line Loading @@ -50,13 +50,9 @@ benchmarkDenseMVSynthetic( Benchmark<> & benchmark, HostVector inHostVector, outHostVector; CudaVector inCudaVector, outCudaVector1, outCudaVector2; // create benchmark group // set metadata const std::vector< String > parsedType = parseObjectType( getType< HostMatrix >() ); #ifdef HAVE_CUDA benchmark.createHorizontalGroup( parsedType[ 0 ], 2 ); #else benchmark.createHorizontalGroup( parsedType[ 0 ], 1 ); #endif benchmark.setMetadataElement({ "format", parsedType[ 0 ] }); hostMatrix.setDimensions( size, size ); inHostVector.setSize( size ); Loading
src/Benchmarks/BLAS/spmv.h +2 −6 Original line number Diff line number Diff line Loading @@ -113,13 +113,9 @@ benchmarkSpMV( Benchmark<> & benchmark, HostVector hostVector, hostVector2; CudaVector deviceVector, deviceVector2; // create benchmark group // set metadata const std::vector< String > parsedType = parseObjectType( getType< HostMatrix >() ); #ifdef HAVE_CUDA benchmark.createHorizontalGroup( parsedType[ 0 ], 2 ); #else benchmark.createHorizontalGroup( parsedType[ 0 ], 1 ); #endif benchmark.setMetadataElement({ "format", parsedType[ 0 ] }); hostRowLengths.setSize( size ); hostMatrix.setDimensions( size, size ); Loading
src/Benchmarks/Benchmark.hpp +23 −26 Original line number Diff line number Diff line Loading @@ -105,6 +105,27 @@ setMetadataColumns( const MetadataColumns & metadata ) Logger::metadataColumns = metadata; } template< typename Logger > void Benchmark< Logger >:: setMetadataElement( const typename MetadataColumns::value_type & element ) { bool found = false; for( auto & it : Logger::metadataColumns ) if( it.first == element.first ) { if( it.second != element.second ) { it.second = element.second; Logger::header_changed = true; } found = true; break; } if( ! found ) { Logger::metadataColumns.push_back( element ); Logger::header_changed = true; } } template< typename Logger > void Benchmark< Logger >:: Loading Loading @@ -133,27 +154,6 @@ setOperation( const double datasetSize, this->baseTime = baseTime; } template< typename Logger > void Benchmark< Logger >:: createHorizontalGroup( const String & name, int subcolumns ) { if( Logger::horizontalGroups.size() == 0 ) { Logger::horizontalGroups.push_back( {name, subcolumns} ); } else { auto & last = Logger::horizontalGroups.back(); if( last.first != name && last.second > 0 ) { Logger::horizontalGroups.push_back( {name, subcolumns} ); } else { last.first = name; last.second = subcolumns; } } } template< typename Logger > template< typename Device, typename ResetFunction, Loading Loading @@ -266,12 +266,9 @@ time( const String & performer, template< typename Logger > void Benchmark< Logger >:: addErrorMessage( const char* msg, int numberOfComputations ) addErrorMessage( const char* msg ) { // each computation has 3 subcolumns const int colspan = 3 * numberOfComputations; Logger::writeErrorMessage( msg, colspan ); Logger::writeErrorMessage( msg ); std::cerr << msg << std::endl; } Loading
src/Benchmarks/Benchmarks.h +7 −13 Original line number Diff line number Diff line Loading @@ -105,7 +105,10 @@ class Benchmark // the next call to this function. void setMetadataColumns( const MetadataColumns & metadata ); // TODO: maybe should be renamed to createVerticalGroup and ensured that vertical and horizontal groups are not used within the same "Benchmark" // Sets the value of one metadata column -- useful for iteratively // changing MetadataColumns that were set using the previous method. void setMetadataElement( const typename MetadataColumns::value_type & element ); // Sets current operation -- operations expand the table vertically // - baseTime should be reset to 0.0 for most operations, but sometimes // it is useful to override it Loading @@ -119,17 +122,9 @@ class Benchmark void setOperation( const double datasetSize = 0.0, const double baseTime = 0.0 ); // Creates new horizontal groups inside a benchmark -- increases the number // of columns in the "Benchmark", implies column spanning. // (Useful e.g. for SpMV formats, different configurations etc.) void createHorizontalGroup( const String & name, int subcolumns ); // Times a single ComputeFunction. Subsequent calls implicitly split // the current "horizontal group" into sub-columns identified by // "performer", which are further split into "bandwidth", "time" and // "speedup" columns. // the current operation into sub-columns identified by "performer", // which are further split into "bandwidth", "time" and "speedup" columns. // TODO: allow custom columns bound to lambda functions (e.g. for Gflops calculation) // Also terminates the recursion of the following variadic template. template< typename Device, Loading Loading @@ -167,8 +162,7 @@ class Benchmark // Adds an error message to the log. Should be called in places where the // "time" method could not be called (e.g. due to failed allocation). void addErrorMessage( const char* msg, int numberOfComputations = 1 ); void addErrorMessage( const char* msg ); using Logger::save; Loading
src/Benchmarks/CustomLogging.h +1 −42 Original line number Diff line number Diff line Loading @@ -88,28 +88,10 @@ public: log << header_indent << " " << it.first << std::endl; } // dump stacked spanning columns if( horizontalGroups.size() > 0 ) while( horizontalGroups.back().second <= 0 ) { horizontalGroups.pop_back(); header_indent.pop_back(); } for( size_t i = 0; i < horizontalGroups.size(); i++ ) { if( horizontalGroups[ i ].second > 0 ) { log << header_indent << " " << horizontalGroups[ i ].first << std::endl; header_indent += "!"; } } log << header_indent << " " << spanningElement << std::endl; for( auto & it : subElements ) { log << header_indent << "! " << it << std::endl; } if( horizontalGroups.size() > 0 ) { horizontalGroups.back().second--; header_indent.pop_back(); } } virtual void Loading Loading @@ -142,8 +124,7 @@ public: } virtual void writeErrorMessage( const char* msg, int colspan = 1 ) override writeErrorMessage( const char* msg ) override { // initial indent string header_indent = "!"; Loading @@ -152,26 +133,6 @@ public: log << header_indent << " " << it.first << std::endl; } // make sure there is a header column for the message if( horizontalGroups.size() == 0 ) horizontalGroups.push_back( {"", 1} ); // dump stacked spanning columns while( horizontalGroups.back().second <= 0 ) { horizontalGroups.pop_back(); header_indent.pop_back(); } for( size_t i = 0; i < horizontalGroups.size(); i++ ) { if( horizontalGroups[ i ].second > 0 ) { log << header_indent << " " << horizontalGroups[ i ].first << std::endl; header_indent += "!"; } } if( horizontalGroups.size() > 0 ) { horizontalGroups.back().second -= colspan; header_indent.pop_back(); } // only when changed (the header has been already adjusted) // print each element on separate line for( auto & it : metadataColumns ) { Loading @@ -186,7 +147,6 @@ public: log << std::endl; header_indent = body_indent = ""; header_changed = true; horizontalGroups.clear(); } virtual bool save( std::ostream & logFile ) override Loading Loading @@ -220,7 +180,6 @@ protected: MetadataColumns metadataColumns; bool header_changed = true; std::vector< std::pair< String, int > > horizontalGroups; String outputMode; }; Loading