Commit a1982e6b authored by Tomáš Oberhuber's avatar Tomáš Oberhuber Committed by Jakub Klinkovský
Browse files

Working on JSON SpMV benchmark - cout is working.

parent 0179d4a0
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -116,11 +116,14 @@ public:
   }

   void writeHeader()
   {
      if( verbose )
      {
         for( auto md : this->logsMetadata )
            std::cout << md << "\t";
         std::cout << std::endl;
      }
   }

   void writeRow( const RowElements& rowEls )
   {
@@ -132,6 +135,8 @@ public:
            std::cout << el << "\t";
         log << "    \"" << *md++ << "\" = \"" << el << "," << std::endl;
      }
      if( verbose )
         std::cout << std::endl;
   }

   void
@@ -161,7 +166,7 @@ public:
   writeTableHeader( const String & spanningElement,
                     const HeaderElements & subElements )
   {
      if( verbose && header_changed ) {
      /*if( verbose && header_changed ) {
         for( auto & it : metadataColumns ) {
            std::cout << std::setw( 20 ) << it.first;
         }
@@ -206,14 +211,15 @@ public:
      if( horizontalGroups.size() > 0 ) {
         horizontalGroups.back().second--;
         header_indent.pop_back();
      }
      }*/
   }

   void
   writeTableRow( const String & spanningElement,
                  const RowElements & subElements )
   {
      if( verbose ) {
      writeRow( subElements );
      /*if( verbose ) {
         for( auto & it : metadataColumns ) {
            std::cout << std::setw( 20 ) << it.second;
         }
@@ -235,7 +241,7 @@ public:
      const String indent = "    ";
      for( auto & it : subElements ) {
         log << indent << it << std::endl;
      }
      }*/
   }

   void
+1 −1
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ benchmarkSolver( Benchmark<>& benchmark,

   // subclass BenchmarkResult to add extra columns to the benchmark
   // (iterations, preconditioned residue, true residue)
   struct MyBenchmarkResult : public BenchmarkResult
   struct MyBenchmarkResult : public BenchmarkResult<>
   {
      using HeaderElements = BenchmarkResult::HeaderElements;
      using RowElements = BenchmarkResult::RowElements;
+3 −2
Original line number Diff line number Diff line
@@ -28,11 +28,12 @@ struct SpmvBenchmarkResult
   using HostVector = Containers::Vector< Real, Devices::Host, Index >;
   using BenchmarkVector = Containers::Vector< Real, Device, Index >;

   using typename Logger::HeaderElements;
   using typename Logger::RowElements;
   using typename BenchmarkResult< Logger >::HeaderElements;
   using typename BenchmarkResult< Logger >::RowElements;
   using BenchmarkResult< Logger >::stddev;
   using BenchmarkResult< Logger >::bandwidth;
   using BenchmarkResult< Logger >::speedup;
   using BenchmarkResult< Logger >::time;


   SpmvBenchmarkResult( const String& format,
+4 −4
Original line number Diff line number Diff line
@@ -295,7 +295,7 @@ benchmarkSpMVLegacy( BenchmarkType& benchmark,
   SpmvBenchmarkResult< Real, Devices::Cuda, int > cudaBenchmarkResults( MatrixInfo< HostMatrix >::getFormat(), csrResultVector, cudaOutVector, cudaMatrix.getNonzeroElementsCount() );
   benchmark.time< Devices::Cuda >( resetCudaVectors, "GPU", spmvCuda, cudaBenchmarkResults );
 #endif
    std::cout << std::endl;
   // std::cout << std::endl;
}

template< typename Real,
@@ -325,12 +325,12 @@ benchmarkSpMV( BenchmarkType& benchmark,
      return;
   }

   benchmark.setMetadataColumns( BenchmarkType::MetadataColumns({
   /*benchmark.setMetadataColumns( BenchmarkType::MetadataColumns({
         { "matrix name", convertToString( inputFileName ) },
         { "rows", convertToString( hostMatrix.getRows() ) },
         { "columns", convertToString( hostMatrix.getColumns() ) },
         { "matrix format", MatrixInfo< HostMatrix >::getFormat() }
      } ));
      } ));*/
   const int elements = hostMatrix.getNonzeroElementsCount();
   const double datasetSize = (double) elements * ( 2 * sizeof( Real ) + sizeof( int ) ) / oneGB;
   benchmark.setOperation( datasetSize );
@@ -371,7 +371,7 @@ benchmarkSpMV( BenchmarkType& benchmark,
   SpmvBenchmarkResult< Real, Devices::Cuda, int > cudaBenchmarkResults( MatrixInfo< HostMatrix >::getFormat(), csrResultVector, cudaOutVector, cudaMatrix.getNonzeroElementsCount() );
   benchmark.time< Devices::Cuda >( resetCudaVectors, "GPU", spmvCuda, cudaBenchmarkResults );
 #endif
    std::cout << std::endl;
   // std::cout << std::endl;
}

template< typename Real = double,