Loading src/TNL/Matrices/Matrix.h +13 −6 Original line number Diff line number Diff line Loading @@ -55,9 +55,6 @@ public: __cuda_callable__ IndexType getColumns() const; __cuda_callable__ const IndexType& getNumberOfColors() const; /**** * TODO: The fast variants of the following methods cannot be virtual. * If they were, they could not be used in the CUDA kernels. If CUDA allows it Loading Loading @@ -97,18 +94,28 @@ public: template< typename Matrix > bool operator != ( const Matrix& matrix ) const; void computeColorsVector(Containers::Vector<Index, Device, Index> &colorsVector); virtual bool save( File& file ) const; virtual bool load( File& file ); virtual void print( std::ostream& str ) const; // TODO: method for symmetric matrices, should not be in general Matrix interface __cuda_callable__ const IndexType& getNumberOfColors() const; // TODO: method for symmetric matrices, should not be in general Matrix interface void computeColorsVector(Containers::Vector<Index, Device, Index> &colorsVector); // TODO: what is this supposed to do?!? There are redefinitions only in the // EllpackSymmetricGraph and SlicedEllpackSymmetricGraph classes... bool help( bool verbose = false ) { return true;}; // TODO: copy should be done in the operator= and it should work the other way too void copyFromHostToCuda( Matrices::Matrix< Real, Devices::Host, Index >& matrix ); // TODO: missing implementation! __cuda_callable__ Index getValuesSize() const; Loading src/TNL/Matrices/Matrix_impl.h +43 −43 Original line number Diff line number Diff line Loading @@ -96,16 +96,6 @@ getValues() return this->values; } template< typename Real, typename Device, typename Index > const Index& Matrix< Real, Device, Index >:: getNumberOfColors() const { return this->numberOfColors; } template< typename Real, typename Device, typename Index > Loading Loading @@ -143,15 +133,44 @@ bool Matrix< Real, Device, Index >::operator != ( const MatrixT& matrix ) const template< typename Real, typename Device, typename Index > void Matrix< Real, Device, Index >:: copyFromHostToCuda( Matrix< Real, Devices::Host, Index >& matrix ) bool Matrix< Real, Device, Index >::save( File& file ) const { this->numberOfColors = matrix.getNumberOfColors(); this->columns = matrix.getColumns(); this->rows = matrix.getRows(); if( ! Object::save( file ) || ! file.write( &this->rows ) || ! file.write( &this->columns ) || ! this->values.save( file ) ) return false; return true; } this->values.setSize( matrix.getValuesSize() ); template< typename Real, typename Device, typename Index > bool Matrix< Real, Device, Index >::load( File& file ) { if( ! Object::load( file ) || ! file.read( &this->rows ) || ! file.read( &this->columns ) || ! this->values.load( file ) ) return false; return true; } template< typename Real, typename Device, typename Index > void Matrix< Real, Device, Index >::print( std::ostream& str ) const { } template< typename Real, typename Device, typename Index > const Index& Matrix< Real, Device, Index >:: getNumberOfColors() const { return this->numberOfColors; } template< typename Real, Loading Loading @@ -191,39 +210,20 @@ computeColorsVector(Containers::Vector<Index, Device, Index> &colorsVector) } } template< typename Real, typename Device, typename Index > bool Matrix< Real, Device, Index >::save( File& file ) const void Matrix< Real, Device, Index >:: copyFromHostToCuda( Matrix< Real, Devices::Host, Index >& matrix ) { if( ! Object::save( file ) || ! file.write( &this->rows ) || ! file.write( &this->columns ) || ! this->values.save( file ) ) return false; return true; } this->numberOfColors = matrix.getNumberOfColors(); this->columns = matrix.getColumns(); this->rows = matrix.getRows(); template< typename Real, typename Device, typename Index > bool Matrix< Real, Device, Index >::load( File& file ) { if( ! Object::load( file ) || ! file.read( &this->rows ) || ! file.read( &this->columns ) || ! this->values.load( file ) ) return false; return true; this->values.setSize( matrix.getValuesSize() ); } template< typename Real, typename Device, typename Index > void Matrix< Real, Device, Index >::print( std::ostream& str ) const { } #ifdef HAVE_CUDA template< typename Matrix, Loading Loading
src/TNL/Matrices/Matrix.h +13 −6 Original line number Diff line number Diff line Loading @@ -55,9 +55,6 @@ public: __cuda_callable__ IndexType getColumns() const; __cuda_callable__ const IndexType& getNumberOfColors() const; /**** * TODO: The fast variants of the following methods cannot be virtual. * If they were, they could not be used in the CUDA kernels. If CUDA allows it Loading Loading @@ -97,18 +94,28 @@ public: template< typename Matrix > bool operator != ( const Matrix& matrix ) const; void computeColorsVector(Containers::Vector<Index, Device, Index> &colorsVector); virtual bool save( File& file ) const; virtual bool load( File& file ); virtual void print( std::ostream& str ) const; // TODO: method for symmetric matrices, should not be in general Matrix interface __cuda_callable__ const IndexType& getNumberOfColors() const; // TODO: method for symmetric matrices, should not be in general Matrix interface void computeColorsVector(Containers::Vector<Index, Device, Index> &colorsVector); // TODO: what is this supposed to do?!? There are redefinitions only in the // EllpackSymmetricGraph and SlicedEllpackSymmetricGraph classes... bool help( bool verbose = false ) { return true;}; // TODO: copy should be done in the operator= and it should work the other way too void copyFromHostToCuda( Matrices::Matrix< Real, Devices::Host, Index >& matrix ); // TODO: missing implementation! __cuda_callable__ Index getValuesSize() const; Loading
src/TNL/Matrices/Matrix_impl.h +43 −43 Original line number Diff line number Diff line Loading @@ -96,16 +96,6 @@ getValues() return this->values; } template< typename Real, typename Device, typename Index > const Index& Matrix< Real, Device, Index >:: getNumberOfColors() const { return this->numberOfColors; } template< typename Real, typename Device, typename Index > Loading Loading @@ -143,15 +133,44 @@ bool Matrix< Real, Device, Index >::operator != ( const MatrixT& matrix ) const template< typename Real, typename Device, typename Index > void Matrix< Real, Device, Index >:: copyFromHostToCuda( Matrix< Real, Devices::Host, Index >& matrix ) bool Matrix< Real, Device, Index >::save( File& file ) const { this->numberOfColors = matrix.getNumberOfColors(); this->columns = matrix.getColumns(); this->rows = matrix.getRows(); if( ! Object::save( file ) || ! file.write( &this->rows ) || ! file.write( &this->columns ) || ! this->values.save( file ) ) return false; return true; } this->values.setSize( matrix.getValuesSize() ); template< typename Real, typename Device, typename Index > bool Matrix< Real, Device, Index >::load( File& file ) { if( ! Object::load( file ) || ! file.read( &this->rows ) || ! file.read( &this->columns ) || ! this->values.load( file ) ) return false; return true; } template< typename Real, typename Device, typename Index > void Matrix< Real, Device, Index >::print( std::ostream& str ) const { } template< typename Real, typename Device, typename Index > const Index& Matrix< Real, Device, Index >:: getNumberOfColors() const { return this->numberOfColors; } template< typename Real, Loading Loading @@ -191,39 +210,20 @@ computeColorsVector(Containers::Vector<Index, Device, Index> &colorsVector) } } template< typename Real, typename Device, typename Index > bool Matrix< Real, Device, Index >::save( File& file ) const void Matrix< Real, Device, Index >:: copyFromHostToCuda( Matrix< Real, Devices::Host, Index >& matrix ) { if( ! Object::save( file ) || ! file.write( &this->rows ) || ! file.write( &this->columns ) || ! this->values.save( file ) ) return false; return true; } this->numberOfColors = matrix.getNumberOfColors(); this->columns = matrix.getColumns(); this->rows = matrix.getRows(); template< typename Real, typename Device, typename Index > bool Matrix< Real, Device, Index >::load( File& file ) { if( ! Object::load( file ) || ! file.read( &this->rows ) || ! file.read( &this->columns ) || ! this->values.load( file ) ) return false; return true; this->values.setSize( matrix.getValuesSize() ); } template< typename Real, typename Device, typename Index > void Matrix< Real, Device, Index >::print( std::ostream& str ) const { } #ifdef HAVE_CUDA template< typename Matrix, Loading