Commit 914aff45 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Merge branch 'JK/fixes' into 'develop'

Refactoring: small fixes and improvements

Closes #71

See merge request !79
parents 54c1655a 73d94bb5
Loading
Loading
Loading
Loading
+5 −21
Original line number Diff line number Diff line
@@ -122,14 +122,6 @@ parse_comma_list( const Config::ParameterContainer& parameters,
   return set;
}

// TODO: implement this in TNL::String
bool ends_with( const std::string& value, const std::string& ending )
{
   if (ending.size() > value.size())
      return false;
   return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
}

// initialize all vector entries with a unioformly distributed random value from the interval [a, b]
template< typename Vector >
void set_random_vector( Vector& v, typename Vector::RealType a, typename Vector::RealType b )
@@ -161,9 +153,7 @@ void set_random_vector( Vector& v, typename Vector::RealType a, typename Vector:
template< typename Matrix, typename Vector >
void
benchmarkIterativeSolvers( Benchmark& benchmark,
// FIXME: ParameterContainer should be copyable, but that leads to double-free
//                           Config::ParameterContainer parameters,
                           Config::ParameterContainer& parameters,
                           Config::ParameterContainer parameters,
                           const SharedPointer< Matrix >& matrixPointer,
                           const Vector& x0,
                           const Vector& b )
@@ -356,9 +346,7 @@ struct LinearSolversBenchmark
   static bool
   run( Benchmark& benchmark,
        Benchmark::MetadataMap metadata,
// FIXME: ParameterContainer should be copyable, but that leads to double-free
//        const Config::ParameterContainer& parameters )
        Config::ParameterContainer& parameters )
        const Config::ParameterContainer& parameters )
   {
      const String file_matrix = parameters.getParameter< String >( "input-matrix" );
      const String file_dof = parameters.getParameter< String >( "input-dof" );
@@ -368,7 +356,7 @@ struct LinearSolversBenchmark
      VectorType x0, b;

      // load the matrix
      if( ends_with( file_matrix, ".mtx" ) ) {
      if( file_matrix.endsWith( ".mtx" ) ) {
         Matrices::MatrixReader< MatrixType > reader;
         reader.readMtxFile( file_matrix, *matrixPointer );
      }
@@ -443,9 +431,7 @@ struct LinearSolversBenchmark
   static void
   runDistributed( Benchmark& benchmark,
                   Benchmark::MetadataMap metadata,
// FIXME: ParameterContainer should be copyable, but that leads to double-free
//                   const Config::ParameterContainer& parameters,
                   Config::ParameterContainer& parameters,
                   const Config::ParameterContainer& parameters,
                   const SharedPointer< MatrixType >& matrixPointer,
                   const VectorType& x0,
                   const VectorType& b )
@@ -489,9 +475,7 @@ struct LinearSolversBenchmark
   static void
   runNonDistributed( Benchmark& benchmark,
                      Benchmark::MetadataMap metadata,
// FIXME: ParameterContainer should be copyable, but that leads to double-free
//                      const Config::ParameterContainer& parameters,
                      Config::ParameterContainer& parameters,
                      const Config::ParameterContainer& parameters,
                      const SharedPointer< MatrixType >& matrixPointer,
                      const VectorType& x0,
                      const VectorType& b )
+2 −0
Original line number Diff line number Diff line
@@ -64,6 +64,8 @@ public:

   void setCompressedRowLengths( ConstCompressedRowLengthsVectorView rowLengths );

   void setRowCapacities( ConstCompressedRowLengthsVectorView rowLengths );

   void getCompressedRowLengths( CompressedRowLengthsVectorView rowLengths ) const;

	IndexType getRowLength( const IndexType row ) const;
+10 −0
Original line number Diff line number Diff line
@@ -104,6 +104,16 @@ setCompressedRowLengths( ConstCompressedRowLengthsVectorView constRowLengths )
    return this->allocateMatrixElements( this->warpSize * this->groupPointers.getElement( strips * ( this->logWarpSize + 1 ) ) );
}

template< typename Real,
	  typename Device,
	  typename Index >
void
BiEllpack< Real, Device, Index >::
setRowCapacities( ConstCompressedRowLengthsVectorView constRowLengths )
{
   setCompressedRowLengths( constRowLengths );
}

template< typename Real,
          typename Device,
          typename Index >
+2 −0
Original line number Diff line number Diff line
@@ -101,6 +101,8 @@ public:

   void setCompressedRowLengths( ConstCompressedRowLengthsVectorView rowLengths );

   void setRowCapacities( ConstCompressedRowLengthsVectorView rowLengths );

   IndexType getRowLength( const IndexType row ) const;

   __cuda_callable__
+8 −0
Original line number Diff line number Diff line
@@ -245,6 +245,14 @@ void ChunkedEllpack< Real, Device, Index >::setCompressedRowLengths( ConstCompre
   Sparse< Real, Device, Index >::allocateMatrixElements( elementsToAllocation );
}

template< typename Real,
          typename Device,
          typename Index >
void ChunkedEllpack< Real, Device, Index >::setRowCapacities( ConstCompressedRowLengthsVectorView rowLengths )
{
   setCompressedRowLengths( rowLengths );
}

template< typename Real,
          typename Device,
          typename Index >
Loading