Commit 2b376ef4 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Benchmarks: refactored logging to write directly into a file instead of an...

Benchmarks: refactored logging to write directly into a file instead of an intermediate stringstream
parent 8d7f3330
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -166,10 +166,10 @@ main( int argc, char* argv[] )
   auto mode = std::ios::out;
   if( outputMode == "append" )
       mode |= std::ios::app;
   std::ofstream logFile( logFileName.getString(), mode );
   std::ofstream logFile( logFileName, mode );

   // init benchmark and common metadata
   Benchmark<> benchmark( loops, verbose );
   Benchmark<> benchmark( logFile, loops, verbose );

   // prepare global metadata
   Logging::MetadataMap metadata = getHardwareMetadata();
@@ -179,10 +179,5 @@ main( int argc, char* argv[] )
   if( precision == "all" || precision == "double" )
      runBlasBenchmarks< double >( benchmark, metadata, minSize, maxSize, sizeStepFactor );

   if( ! benchmark.save( logFile ) ) {
      std::cerr << "Failed to write the benchmark results to file '" << logFileName << "'." << std::endl;
      return EXIT_FAILURE;
   }

   return EXIT_SUCCESS;
}
+3 −11
Original line number Diff line number Diff line
@@ -331,10 +331,10 @@ main( int argc, char* argv[] )
       mode |= std::ios::app;
   std::ofstream logFile;
   if( rank == 0 )
      logFile.open( logFileName.getString(), mode );
      logFile.open( logFileName, mode );

   // init benchmark and common metadata
   Benchmark<> benchmark( loops, verbose );
   Benchmark<> benchmark( logFile, loops, verbose );

   // prepare global metadata
   Logging::MetadataMap metadata = getHardwareMetadata();
@@ -349,13 +349,5 @@ main( int argc, char* argv[] )
                                                   TNL::Matrices::GeneralMatrix,
                                                   SegmentsType
                                                 >;
   const bool status = SpmvBenchmark< MatrixType >::run( benchmark, metadata, parameters );

   if( rank == 0 )
      if( ! benchmark.save( logFile ) ) {
         std::cerr << "Failed to write the benchmark results to file '" << parameters.getParameter< String >( "log-file" ) << "'." << std::endl;
         return EXIT_FAILURE;
      }

   return ! status;
   return ! SpmvBenchmark< MatrixType >::run( benchmark, metadata, parameters );
}
+3 −11
Original line number Diff line number Diff line
@@ -611,10 +611,10 @@ main( int argc, char* argv[] )
       mode |= std::ios::app;
   std::ofstream logFile;
   if( rank == 0 )
      logFile.open( logFileName.getString(), mode );
      logFile.open( logFileName, mode );

   // init benchmark and common metadata
   Benchmark<> benchmark( loops, verbose );
   Benchmark<> benchmark( logFile, loops, verbose );

   // prepare global metadata
   Logging::MetadataMap metadata = getHardwareMetadata();
@@ -629,13 +629,5 @@ main( int argc, char* argv[] )
                                                   TNL::Matrices::GeneralMatrix,
                                                   SegmentsType
                                                 >;
   const bool status = LinearSolversBenchmark< MatrixType >::run( benchmark, metadata, parameters );

   if( rank == 0 )
      if( ! benchmark.save( logFile ) ) {
         std::cerr << "Failed to write the benchmark results to file '" << parameters.getParameter< String >( "log-file" ) << "'." << std::endl;
         return EXIT_FAILURE;
      }

   return ! status;
   return ! LinearSolversBenchmark< MatrixType >::run( benchmark, metadata, parameters );
}
+2 −7
Original line number Diff line number Diff line
@@ -440,10 +440,10 @@ int main( int argc, char* argv[] )
   auto mode = std::ios::out;
   if( outputMode == "append" )
       mode |= std::ios::app;
   std::ofstream logFile( logFileName.getString(), mode );
   std::ofstream logFile( logFileName, mode );

   // init benchmark and common metadata
   Benchmark<> benchmark( loops, verbose );
   Benchmark<> benchmark( logFile, loops, verbose );

   // prepare global metadata
   Logging::MetadataMap metadata = getHardwareMetadata();
@@ -456,10 +456,5 @@ int main( int argc, char* argv[] )
      run_benchmarks< Devices::Cuda >( benchmark );
#endif

   if( ! benchmark.save( logFile ) ) {
      std::cerr << "Failed to write the benchmark results to file '" << parameters.getParameter< String >( "log-file" ) << "'." << std::endl;
      return EXIT_FAILURE;
   }

   return EXIT_SUCCESS;
}
+2 −7
Original line number Diff line number Diff line
@@ -428,10 +428,10 @@ int main( int argc, char* argv[] )
   auto mode = std::ios::out;
   if( outputMode == "append" )
       mode |= std::ios::app;
   std::ofstream logFile( logFileName.getString(), mode );
   std::ofstream logFile( logFileName, mode );

   // init benchmark and common metadata
   Benchmark<> benchmark( loops, verbose );
   Benchmark<> benchmark( logFile, loops, verbose );

   // prepare global metadata
   Logging::MetadataMap metadata = getHardwareMetadata();
@@ -444,10 +444,5 @@ int main( int argc, char* argv[] )
      run_benchmarks< Devices::Cuda >( benchmark );
#endif

   if( ! benchmark.save( logFile ) ) {
      std::cerr << "Failed to write the benchmark results to file '" << parameters.getParameter< String >( "log-file" ) << "'." << std::endl;
      return EXIT_FAILURE;
   }

   return EXIT_SUCCESS;
}
Loading