diff --git a/src/TNL/Containers/Segments/CSRView.hpp b/src/TNL/Containers/Segments/CSRView.hpp index cc4d16fe6efd9ab2deb99285233d0a528e34400a..d8ea9b06ed71df4ff5acdc93657bf7cc886ba23b 100644 --- a/src/TNL/Containers/Segments/CSRView.hpp +++ b/src/TNL/Containers/Segments/CSRView.hpp @@ -156,6 +156,7 @@ auto CSRView< Device, Index >:: getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType { + printf( "----> size %d \n", offsets[ segmentIdx + 1 ] ); return SegmentViewType( offsets[ segmentIdx ], offsets[ segmentIdx + 1 ] - offsets[ segmentIdx ], 1 ); } diff --git a/src/TNL/Containers/Segments/SegmentView.h b/src/TNL/Containers/Segments/SegmentView.h index 29f2e778132ebe304c85298bee7aad3a283edce8..edfe31df43b19ab8669feec6d9ec87f914aa4340 100644 --- a/src/TNL/Containers/Segments/SegmentView.h +++ b/src/TNL/Containers/Segments/SegmentView.h @@ -29,8 +29,16 @@ class SegmentView< Index, false > SegmentView( const IndexType offset, const IndexType size, const IndexType step ) - : segmentOffset( offset ), segmentSize( size ), step( step ){}; + : segmentOffset( offset ), segmentSize( size ), step( step ) + { + printf( "--- size = %d \n", size ); + }; + __cuda_callable__ + SegmentView( const SegmentView& view ) + : segmentOffset( view.segmentOffset ), segmentSize( view.segmentSize ), step( view.step ) + { + }; __cuda_callable__ IndexType getSize() const { diff --git a/src/TNL/Matrices/SparseMatrix.hpp b/src/TNL/Matrices/SparseMatrix.hpp index 66813a732c6cf709a0800a735a1a70c466c71e06..447d8d250909423c88b607d15c9d8130cc6f0c98 100644 --- a/src/TNL/Matrices/SparseMatrix.hpp +++ b/src/TNL/Matrices/SparseMatrix.hpp @@ -673,7 +673,6 @@ operator=( const RHSMatrix& matrix ) using RHSRealType = typename RHSMatrix::RealType; using RHSDeviceType = typename RHSMatrix::DeviceType; using RHSRealAllocatorType = typename RHSMatrix::RealAllocatorType; - using RHSIndexAllocatorType = typename Allocators::Default< RHSDeviceType >::template Allocator< RHSIndexType >; Containers::Vector< RHSIndexType, RHSDeviceType, RHSIndexType > rowLengths; matrix.getCompressedRowLengths( rowLengths ); @@ -712,9 +711,9 @@ operator=( const RHSMatrix& matrix ) const IndexType bufferRowsCount( 128 ); const size_t bufferSize = bufferRowsCount * maxRowLength; Containers::Vector< RHSRealType, RHSDeviceType, RHSIndexType, RHSRealAllocatorType > matrixValuesBuffer( bufferSize ); - Containers::Vector< RHSIndexType, RHSDeviceType, RHSIndexType, RHSIndexAllocatorType > matrixColumnsBuffer( bufferSize ); + Containers::Vector< RHSIndexType, RHSDeviceType, RHSIndexType > matrixColumnsBuffer( bufferSize ); Containers::Vector< RealType, DeviceType, IndexType, RealAllocatorType > thisValuesBuffer( bufferSize ); - Containers::Vector< IndexType, DeviceType, IndexType, IndexAllocatorType > thisColumnsBuffer( bufferSize ); + Containers::Vector< IndexType, DeviceType, IndexType > thisColumnsBuffer( bufferSize ); auto matrixValuesBuffer_view = matrixValuesBuffer.getView(); auto matrixColumnsBuffer_view = matrixColumnsBuffer.getView(); auto thisValuesBuffer_view = thisValuesBuffer.getView(); @@ -754,12 +753,15 @@ operator=( const RHSMatrix& matrix ) RealType inValue( 0.0 ); IndexType bufferIdx, localIdx( rowLocalIndexes_view[ rowIdx ] ); auto matrixRow = matrix_view.getRow( rowIdx ); - while( inValue == 0.0 && localIdx < matrixRow.getSize() ) //matrix_columns ) + IndexType s = matrixRow.getSize(); + //printf( " row %d size %d \n", rowIdx, s ); + while( inValue == 0.0 && localIdx < 0 ) { bufferIdx = ( rowIdx - baseRow ) * maxRowLength + localIdx++; - inValue = thisValuesBuffer_view[ bufferIdx ]; + TNL_ASSERT_LT( bufferIdx, bufferSize, "" ); + //inValue = thisValuesBuffer_view[ bufferIdx ]; } - rowLocalIndexes_view[ rowIdx ] = localIdx; + /*rowLocalIndexes_view[ rowIdx ] = localIdx; if( inValue == 0.0 ) { columnIndex = paddingIndex; @@ -769,7 +771,7 @@ operator=( const RHSMatrix& matrix ) { columnIndex = thisColumnsBuffer_view[ bufferIdx ];//column - 1; value = inValue; - } + }*/ }; this->forRows( baseRow, lastRow, f2 ); baseRow += bufferRowsCount; diff --git a/src/UnitTests/Matrices/SparseMatrixCopyTest.h b/src/UnitTests/Matrices/SparseMatrixCopyTest.h index 6e1427ad1b376f71c7f989d2da6d9c0577dcf6ac..46777f6c006373c63b257d193259d9d42ded5817 100644 --- a/src/UnitTests/Matrices/SparseMatrixCopyTest.h +++ b/src/UnitTests/Matrices/SparseMatrixCopyTest.h @@ -64,7 +64,6 @@ void setupUnevenRowSizeMatrix( Matrix& m ) { const int rows = 10; const int cols = 6; - m.reset(); m.setDimensions( rows, cols ); typename Matrix::CompressedRowLengthsVector rowLengths; rowLengths.setSize( rows );