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

Preparing Benchmark for logging into JSON.

parent 527ad5cc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ template< typename Real = double,
          template<typename> class HostAllocator = Allocators::Default< Devices::Host >::Allocator,
          template<typename> class CudaAllocator = Allocators::Default< Devices::Cuda >::Allocator >
void
benchmarkArrayOperations( Benchmark & benchmark,
benchmarkArrayOperations( Benchmark<> & benchmark,
                          const long & size )
{
   using HostArray = Containers::Array< Real, Devices::Host, Index, HostAllocator< Real > >;
+2 −2
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ void setCudaTestMatrix( Matrix& matrix,
template< typename Real,
          template< typename, typename, typename > class Matrix >
void
benchmarkSpMV( Benchmark & benchmark,
benchmarkSpMV( Benchmark<> & benchmark,
               const int & size,
               const int elementsPerRow = 5 )
{
@@ -173,7 +173,7 @@ benchmarkSpMV( Benchmark & benchmark,
template< typename Real = double,
          typename Index = int >
void
benchmarkSpmvSynthetic( Benchmark & benchmark,
benchmarkSpmvSynthetic( Benchmark<> & benchmark,
                        const int & size,
                        const int & elementsPerRow )
{
+8 −8
Original line number Diff line number Diff line
@@ -29,8 +29,8 @@ using namespace TNL::Benchmarks;

template< typename Real >
void
runBlasBenchmarks( Benchmark & benchmark,
                   Benchmark::MetadataMap metadata,
runBlasBenchmarks( Benchmark<> & benchmark,
                   Benchmark<>::MetadataMap metadata,
                   const std::size_t & minSize,
                   const std::size_t & maxSize,
                   const double & sizeStepFactor,
@@ -43,7 +43,7 @@ runBlasBenchmarks( Benchmark & benchmark,
   benchmark.newBenchmark( String("Array operations (") + precision + ", host allocator = Host)",
                           metadata );
   for( std::size_t size = minSize; size <= maxSize; size *= 2 ) {
      benchmark.setMetadataColumns( Benchmark::MetadataColumns({
      benchmark.setMetadataColumns( Benchmark<>::MetadataColumns({
         { "size", convertToString( size ) },
      } ));
      benchmarkArrayOperations< Real >( benchmark, size );
@@ -71,7 +71,7 @@ runBlasBenchmarks( Benchmark & benchmark,
   benchmark.newBenchmark( String("Vector operations (") + precision + ")",
                           metadata );
   for( std::size_t size = minSize; size <= maxSize; size *= sizeStepFactor ) {
      benchmark.setMetadataColumns( Benchmark::MetadataColumns({
      benchmark.setMetadataColumns( Benchmark<>::MetadataColumns({
         { "size", convertToString( size ) },
      } ));
      benchmarkVectorOperations< Real >( benchmark, size );
@@ -82,7 +82,7 @@ runBlasBenchmarks( Benchmark & benchmark,
   benchmark.newBenchmark( String("Triad benchmark (") + precision + ")",
                           metadata );
   for( std::size_t size = minSize; size <= maxSize; size *= 2 ) {
      benchmark.setMetadataColumns( Benchmark::MetadataColumns({
      benchmark.setMetadataColumns( Benchmark<>::MetadataColumns({
         { "size", convertToString( size ) },
      } ));
      benchmarkTriad< Real >( benchmark, size );
@@ -93,7 +93,7 @@ runBlasBenchmarks( Benchmark & benchmark,
   benchmark.newBenchmark( String("Sparse matrix-vector multiplication (") + precision + ")",
                           metadata );
   for( std::size_t size = minSize; size <= maxSize; size *= 2 ) {
      benchmark.setMetadataColumns( Benchmark::MetadataColumns({
      benchmark.setMetadataColumns( Benchmark<>::MetadataColumns({
         { "rows", convertToString( size ) },
         { "columns", convertToString( size ) },
         { "elements per row", convertToString( elementsPerRow ) },
@@ -168,10 +168,10 @@ main( int argc, char* argv[] )
   std::ofstream logFile( logFileName.getString(), mode );

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

   // prepare global metadata
   Benchmark::MetadataMap metadata = getHardwareMetadata();
   Benchmark<>::MetadataMap metadata = getHardwareMetadata< Logging >();

   if( precision == "all" || precision == "float" )
      runBlasBenchmarks< float >( benchmark, metadata, minSize, maxSize, sizeStepFactor, elementsPerRow );
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ namespace Benchmarks {
template< typename Real = double,
          typename Index = int >
void
benchmarkTriad( Benchmark & benchmark,
benchmarkTriad( Benchmark<> & benchmark,
                const long & size )
{
   using HostAllocator = Allocators::Host< Real >;
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ namespace Benchmarks {
template< typename Real = double,
          typename Index = int >
void
benchmarkVectorOperations( Benchmark & benchmark,
benchmarkVectorOperations( Benchmark<> & benchmark,
                           const long & size )
{
   using HostVector = Containers::Vector< Real, Devices::Host, Index >;
Loading