Loading src/Benchmarks/JsonLogging.h +12 −67 Original line number Diff line number Diff line Loading @@ -102,23 +102,15 @@ public: void addCommonLogs( const CommonLogs& logs ) { //if( this->lineStarted ) // log << "," << std::endl; //log << " \"benchmarks\" : [" << std::endl; this->commonLogs = logs; //int idx( 0 ); for( auto lg : logs ) { if( verbose ) std::cout << lg.first << " = " << lg.second << std::endl; //if( idx++ > 0 ) // log << "," << std::endl; //log << " \"" << lg.first << "\" : \"" << lg.second << "\""; //this->lineStarted = true; } }; void resetLogsMetadat() { this->logsMetadata.clear(); }; void resetLogsMetada() { this->logsMetadata.clear(); }; void addLogsMetadata( const std::vector< String >& md ) { Loading Loading @@ -147,8 +139,6 @@ public: int idx( 0 ); for( auto lg : this->commonLogs ) { //if( verbose ) // std::cout << lg.first << " = " << lg.second << std::endl; if( idx++ > 0 ) log << "," << std::endl; log << " \"" << lg.first << "\" : \"" << lg.second << "\""; Loading Loading @@ -177,18 +167,13 @@ public: if( verbose ) std::cout << std::endl << "== " << title << " ==" << std::endl << std::endl; log << " \"title\" : \"" << title << "\""; this->lineStarted = true; } void writeMetadata( const MetadataMap & metadata ) { if( outputMode == "append" ) { this->lineStarted = true; return; } if( verbose ) std::cout << "properties:" << std::endl; Loading @@ -197,13 +182,7 @@ public: for( auto & it : metadata ) { if( verbose ) std::cout << " " << it.first << " = " << it.second << std::endl; if( idx++ > 0 ) log << "," << std::endl; log << " \"" << it.first << "\" : \"" << it.second << "\""; //this->lineStarted = true; } log << "," << std::endl << " \"results\" : [ " << std::endl; this->lineStarted = false; if( verbose ) std::cout << std::endl; Loading @@ -227,55 +206,21 @@ public: int colspan = 1 ) { log << "\"error\" : \"" << msg << "\"" << std::endl; // initial indent string /*header_indent = "!"; log << std::endl; for( auto & it : metadataColumns ) { 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 ) { log << it.second << std::endl; } log << msg << std::endl; */ } void closeTable() { //log << std::endl << " ]" << std::endl; //log << "," << std::endl; //header_indent = body_indent = ""; //header_changed = true; //horizontalGroups.clear(); } bool save( std::ostream & logFile ) { closeTable(); if( ! this->logFileAppend ) { logFile << "{" << std::endl; logFile << " \"results\" : [ " << std::endl; } else logFile << log.str(); if( logFile.good() ) { log.str() = ""; Loading src/Benchmarks/SpMV/spmv.h +2 −2 Original line number Diff line number Diff line Loading @@ -41,8 +41,8 @@ // Comment the following to turn off some groups of SpMV benchmarks and speed-up the compilation #define WITH_TNL_BENCHMARK_SPMV_GENERAL_MATRICES #define WITH_TNL_BENCHMARK_SPMV_SYMMETRIC_MATRICES #define WITH_TNL_BENCHMARK_SPMV_LEGACY_FORMATS //#define WITH_TNL_BENCHMARK_SPMV_SYMMETRIC_MATRICES //#define WITH_TNL_BENCHMARK_SPMV_LEGACY_FORMATS // Uncomment the following line to enable benchmarking the sandbox sparse matrix. //#define WITH_TNL_BENCHMARK_SPMV_SANDBOX_MATRIX Loading src/Benchmarks/SpMV/tnl-benchmark-spmv.h +16 −3 Original line number Diff line number Diff line Loading @@ -70,13 +70,14 @@ void setupConfig( Config::ConfigDescription & config ) { config.addDelimiter( "Benchmark settings:" ); config.addRequiredEntry< String >( "input-file", "Input file name." ); config.addEntry< String >( "input-file", "Input file name.", "" ); config.addEntry< bool >( "with-symmetric-matrices", "Perform benchmark even for symmetric matrix formats.", true ); config.addEntry< bool >( "with-legacy-matrices", "Perform benchmark even for legacy TNL matrix formats.", true ); config.addEntry< String >( "log-file", "Log file name.", "tnl-benchmark-spmv::" + getCurrDateTime() + ".log"); config.addEntry< String >( "output-mode", "Mode for opening the log file.", "append" ); config.addEntry< String >( "output-mode", "Mode for opening the log file - 'close' will only finalize the log file.", "append" ); config.addEntryEnum( "append" ); config.addEntryEnum( "overwrite" ); config.addEntryEnum( "close" ); config.addEntry< String >( "precision", "Precision of the arithmetics.", "double" ); config.addEntryEnum( "float" ); config.addEntryEnum( "double" ); Loading Loading @@ -124,6 +125,18 @@ main( int argc, char* argv[] ) const int verboseMR = parameters.getParameter< int >( "verbose-MReader" ); // open log file if( outputMode == "close" ) { std::fstream file; file.open( logFileName.getString(), std::ios::out | std::ios::app ); file << std::endl << " ]" << std::endl << "}"; return EXIT_SUCCESS; } if( inputFileName == "" ) { std::cerr << "ERROR: Input file name is required." << std::endl; return EXIT_FAILURE; } bool logFileAppend( false ); if( std::experimental::filesystem::exists(logFileName.getString()) ) { Loading src/Benchmarks/scripts/run-tnl-benchmark-spmv +1 −1 Original line number Diff line number Diff line Loading @@ -73,4 +73,4 @@ do done fi done $BENCHMARK --log-file log-files/sparse-matrix-benchmark.log --output-mode close --verbose 1 Loading
src/Benchmarks/JsonLogging.h +12 −67 Original line number Diff line number Diff line Loading @@ -102,23 +102,15 @@ public: void addCommonLogs( const CommonLogs& logs ) { //if( this->lineStarted ) // log << "," << std::endl; //log << " \"benchmarks\" : [" << std::endl; this->commonLogs = logs; //int idx( 0 ); for( auto lg : logs ) { if( verbose ) std::cout << lg.first << " = " << lg.second << std::endl; //if( idx++ > 0 ) // log << "," << std::endl; //log << " \"" << lg.first << "\" : \"" << lg.second << "\""; //this->lineStarted = true; } }; void resetLogsMetadat() { this->logsMetadata.clear(); }; void resetLogsMetada() { this->logsMetadata.clear(); }; void addLogsMetadata( const std::vector< String >& md ) { Loading Loading @@ -147,8 +139,6 @@ public: int idx( 0 ); for( auto lg : this->commonLogs ) { //if( verbose ) // std::cout << lg.first << " = " << lg.second << std::endl; if( idx++ > 0 ) log << "," << std::endl; log << " \"" << lg.first << "\" : \"" << lg.second << "\""; Loading Loading @@ -177,18 +167,13 @@ public: if( verbose ) std::cout << std::endl << "== " << title << " ==" << std::endl << std::endl; log << " \"title\" : \"" << title << "\""; this->lineStarted = true; } void writeMetadata( const MetadataMap & metadata ) { if( outputMode == "append" ) { this->lineStarted = true; return; } if( verbose ) std::cout << "properties:" << std::endl; Loading @@ -197,13 +182,7 @@ public: for( auto & it : metadata ) { if( verbose ) std::cout << " " << it.first << " = " << it.second << std::endl; if( idx++ > 0 ) log << "," << std::endl; log << " \"" << it.first << "\" : \"" << it.second << "\""; //this->lineStarted = true; } log << "," << std::endl << " \"results\" : [ " << std::endl; this->lineStarted = false; if( verbose ) std::cout << std::endl; Loading @@ -227,55 +206,21 @@ public: int colspan = 1 ) { log << "\"error\" : \"" << msg << "\"" << std::endl; // initial indent string /*header_indent = "!"; log << std::endl; for( auto & it : metadataColumns ) { 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 ) { log << it.second << std::endl; } log << msg << std::endl; */ } void closeTable() { //log << std::endl << " ]" << std::endl; //log << "," << std::endl; //header_indent = body_indent = ""; //header_changed = true; //horizontalGroups.clear(); } bool save( std::ostream & logFile ) { closeTable(); if( ! this->logFileAppend ) { logFile << "{" << std::endl; logFile << " \"results\" : [ " << std::endl; } else logFile << log.str(); if( logFile.good() ) { log.str() = ""; Loading
src/Benchmarks/SpMV/spmv.h +2 −2 Original line number Diff line number Diff line Loading @@ -41,8 +41,8 @@ // Comment the following to turn off some groups of SpMV benchmarks and speed-up the compilation #define WITH_TNL_BENCHMARK_SPMV_GENERAL_MATRICES #define WITH_TNL_BENCHMARK_SPMV_SYMMETRIC_MATRICES #define WITH_TNL_BENCHMARK_SPMV_LEGACY_FORMATS //#define WITH_TNL_BENCHMARK_SPMV_SYMMETRIC_MATRICES //#define WITH_TNL_BENCHMARK_SPMV_LEGACY_FORMATS // Uncomment the following line to enable benchmarking the sandbox sparse matrix. //#define WITH_TNL_BENCHMARK_SPMV_SANDBOX_MATRIX Loading
src/Benchmarks/SpMV/tnl-benchmark-spmv.h +16 −3 Original line number Diff line number Diff line Loading @@ -70,13 +70,14 @@ void setupConfig( Config::ConfigDescription & config ) { config.addDelimiter( "Benchmark settings:" ); config.addRequiredEntry< String >( "input-file", "Input file name." ); config.addEntry< String >( "input-file", "Input file name.", "" ); config.addEntry< bool >( "with-symmetric-matrices", "Perform benchmark even for symmetric matrix formats.", true ); config.addEntry< bool >( "with-legacy-matrices", "Perform benchmark even for legacy TNL matrix formats.", true ); config.addEntry< String >( "log-file", "Log file name.", "tnl-benchmark-spmv::" + getCurrDateTime() + ".log"); config.addEntry< String >( "output-mode", "Mode for opening the log file.", "append" ); config.addEntry< String >( "output-mode", "Mode for opening the log file - 'close' will only finalize the log file.", "append" ); config.addEntryEnum( "append" ); config.addEntryEnum( "overwrite" ); config.addEntryEnum( "close" ); config.addEntry< String >( "precision", "Precision of the arithmetics.", "double" ); config.addEntryEnum( "float" ); config.addEntryEnum( "double" ); Loading Loading @@ -124,6 +125,18 @@ main( int argc, char* argv[] ) const int verboseMR = parameters.getParameter< int >( "verbose-MReader" ); // open log file if( outputMode == "close" ) { std::fstream file; file.open( logFileName.getString(), std::ios::out | std::ios::app ); file << std::endl << " ]" << std::endl << "}"; return EXIT_SUCCESS; } if( inputFileName == "" ) { std::cerr << "ERROR: Input file name is required." << std::endl; return EXIT_FAILURE; } bool logFileAppend( false ); if( std::experimental::filesystem::exists(logFileName.getString()) ) { Loading
src/Benchmarks/scripts/run-tnl-benchmark-spmv +1 −1 Original line number Diff line number Diff line Loading @@ -73,4 +73,4 @@ do done fi done $BENCHMARK --log-file log-files/sparse-matrix-benchmark.log --output-mode close --verbose 1