Commit 8b80f8f3 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Implementing the SPMV benchmark.

parent fdc38e75
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -156,6 +156,16 @@ bool tnlEllpackMatrix< Real, Device, Index >::operator != ( const tnlEllpackMatr
   return ! ( ( *this ) == matrix );
}

/*template< typename Real,
          typename Device,
          typename Index >
   template< typename Matrix >
bool tnlEllpackMatrix< Real, Device, Index >::copyFrom( const Matrix& matrix,
                                                        const RowLengthsVector& rowLengths )
{
   return tnlMatrix< RealType, DeviceType, IndexType >::copyFrom( matrix, rowLengths );
}*/

template< typename Real,
          typename Device,
          typename Index >
+4 −0
Original line number Diff line number Diff line
@@ -63,6 +63,10 @@ class tnlEllpackMatrix : public tnlSparseMatrix< Real, Device, Index >
   template< typename Real2, typename Device2, typename Index2 >
   bool operator != ( const tnlEllpackMatrix< Real2, Device2, Index2 >& matrix ) const;

   /*template< typename Matrix >
   bool copyFrom( const Matrix& matrix,
                  const RowLengthsVector& rowLengths );*/

#ifdef HAVE_CUDA
   __device__ __host__
#endif
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ INSTALL( FILES matrix-market
               run-tnl-benchmark-spmv
               cuda-profiler.conf
               process-cuda-profile.pl 
               tnl-log-to-html.py
               DESTINATION share/tnl-${tnlVersion}/benchmark-scripts )

INSTALL( FILES tnl-run-spmv-benchmark
+13 −3
Original line number Diff line number Diff line
@@ -206,9 +206,12 @@ bool setupBenchmark( const tnlParameterContainer& parameters )
#ifdef HAVE_CUDA
      typedef tnlVector< Real, tnlCuda, int > CudaVector;
      CudaVector cudaX, cudaB;
      tnlVector< int, tnlCuda, int > rowLengthsCuda;
      cudaX.setSize( csrMatrix.getColumns() );
      cudaX.setValue( 1.0 );
      cudaB.setSize( csrMatrix.getRows() );
      rowLengthsCuda.setSize( csrMatrix.getRows() );
      rowLengthsCuda = rowLengthsHost;
#endif
      benchmarkHostMatrix( csrMatrix,
                           hostX,
@@ -232,8 +235,15 @@ bool setupBenchmark( const tnlParameterContainer& parameters )
                           verbose,
                           logFile );
#ifdef HAVE_CUDA
      /*typedef tnlEllpackMatrix< Real, tnlCuda, int > EllpackMatrixCudaType;
      EllpackMatrixCudaType cudaEllpackMatrix( ellpackMatrix);
      typedef tnlEllpackMatrix< Real, tnlCuda, int > EllpackMatrixCudaType;
      EllpackMatrixCudaType cudaEllpackMatrix;
      cout << "Copying matrix to GPU... ";
      if( ! cudaEllpackMatrix.copyFrom( ellpackMatrix, rowLengthsCuda ) )
      {
         cerr << "I am not able to transfer the matrix on GPU." << endl;
         return false;
      }
      cout << " done." << endl;
      benchmarkHostMatrix( cudaEllpackMatrix,
                           cudaX,
                           cudaB,
@@ -242,7 +252,7 @@ bool setupBenchmark( const tnlParameterContainer& parameters )
                           stopTime,
                           verbose,
                           logFile );
      cudaEllpackMatrix.reset();*/
      cudaEllpackMatrix.reset();
#endif
      ellpackMatrix.reset();