Commit 0a0c44ca authored by Lukas Cejka's avatar Lukas Cejka Committed by Tomáš Oberhuber
Browse files

Added useful functions to begind implementation. Commiting for backup purposes.

parent 33d17aab
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@
#include <TNL/Matrices/SlicedEllpack.h>
#include <TNL/Matrices/ChunkedEllpack.h>

//#include <TNL/Matrices/MatrixReader.h>

namespace TNL {
namespace Benchmarks {

@@ -27,6 +29,16 @@ namespace Benchmarks {
template< typename Real, typename Device, typename Index >
using SlicedEllpack = Matrices::SlicedEllpack< Real, Device, Index >;

//template< typename Matrix >
//void printMatrixInfo( const String& inputFileName,
//                      const Matrix& matrix,
//                      std::ostream& str )
//{
//   str << " Rows: " << std::setw( 8 ) << matrix.getRows();
//   str << " Columns: " << std::setw( 8 ) << matrix.getColumns();
//   str << " Nonzero Elements: " << std::setw( 10 ) << matrix.getNumberOfNonzeroMatrixElements();
//}

template< typename Matrix >
int setHostTestMatrix( Matrix& matrix,
                       const int elementsPerRow )
@@ -176,6 +188,21 @@ benchmarkSpmvSynthetic( Benchmark & benchmark,
                        const int & size,
                        const int & elementsPerRow )
{
//    typedef Matrices::CSR< Real, Devices::Host, int > CSRType;
//    CSRType csrMatrix;
//    try
//    {
//       if( ! MatrixReader< CSRType >::readMtxFile( inputFileName, csrMatrix ) )
//       {
//          std::cerr << "I am not able to read the matrix file " << inputFileName << "." << std::endl;
//          return false;
//       }
//    }
//    catch( std::bad_alloc )
//    {
//       std::cerr << "Not enough memory to read the matrix." << std::endl;
//       return false;
//    }
   bool result = true;
   // TODO: benchmark all formats from tnl-benchmark-spmv (different parameters of the base formats)
   result |= benchmarkSpMV< Real, Matrices::CSR >( benchmark, size, elementsPerRow );
+1 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ void
setupConfig( Config::ConfigDescription & config )
{
   config.addDelimiter( "Benchmark settings:" );
   config.addRequiredEntry< String >( "input-file", "Input file name." );
   config.addEntry< String >( "log-file", "Log file name.", "tnl-benchmark-blas.log");
   config.addEntry< String >( "output-mode", "Mode for opening the log file.", "overwrite" );
   config.addEntryEnum( "append" );