diff --git a/src/TNL/Containers/Segments/SlicedEllpackView.hpp b/src/TNL/Containers/Segments/SlicedEllpackView.hpp index f2e03bd38aab3de36e32feb929202b2ede2b8c34..66cfce19527e8453112d881b489c90b693488119 100644 --- a/src/TNL/Containers/Segments/SlicedEllpackView.hpp +++ b/src/TNL/Containers/Segments/SlicedEllpackView.hpp @@ -171,7 +171,7 @@ getGlobalIndex( const Index segmentIdx, const Index localIdx ) const } else { -#ifdef __CUDA__ARCH__ +#ifdef __CUDA_ARCH__ sliceOffset = this->sliceOffsets[ sliceIdx ]; segmentSize = this->sliceSegmentSizes[ sliceIdx ]; #else diff --git a/src/TNL/Matrices/SparseMatrix.h b/src/TNL/Matrices/SparseMatrix.h index 44ded93a65c469dbfec8d8099d923854976dc8db..a5effce936d4294ed70089dd10919278ef92d7b6 100644 --- a/src/TNL/Matrices/SparseMatrix.h +++ b/src/TNL/Matrices/SparseMatrix.h @@ -34,7 +34,7 @@ class SparseMatrix : public Matrix< Real, Device, Index, RealAllocator > using IndexType = Index; using RealAllocatorType = RealAllocator; using IndexAllocatorType = IndexAllocator; - using RowsCapacitiesType = Containers::Vector< IndexType, DeviceType, IndexType >; + using RowsCapacitiesType = Containers::Vector< IndexType, DeviceType, IndexType, IndexAllocatorType >; using RowsCapacitiesView = Containers::VectorView< IndexType, DeviceType, IndexType >; using ConstRowsCapacitiesView = typename RowsCapacitiesView::ConstViewType; using ValuesVectorType = typename Matrix< Real, Device, Index, RealAllocator >::ValuesVector; diff --git a/src/TNL/Matrices/SparseMatrix.hpp b/src/TNL/Matrices/SparseMatrix.hpp index 964e9eb221e98979a05f72e42666422823bfc524..75f505f5f454a057a352c80e708d97412083beea 100644 --- a/src/TNL/Matrices/SparseMatrix.hpp +++ b/src/TNL/Matrices/SparseMatrix.hpp @@ -739,8 +739,9 @@ operator=( const SparseMatrix< Real2, Segments2, Device2, Index2, RealAllocator2 } else { + //std::cerr << "Matrix = " << std::endl << matrix << std::endl; const IndexType maxRowLength = max( rowLengths ); - const IndexType bufferRowsCount( 128 ); + const IndexType bufferRowsCount( 8 ); const size_t bufferSize = bufferRowsCount * maxRowLength; Containers::Vector< Real2, Device2, Index2, RealAllocator2 > matrixValuesBuffer( bufferSize ); Containers::Vector< Index2, Device2, Index2, IndexAllocator2 > matrixColumnsBuffer( bufferSize ); @@ -757,6 +758,7 @@ operator=( const SparseMatrix< Real2, Segments2, Device2, Index2, RealAllocator2 { const IndexType lastRow = min( baseRow + bufferRowsCount, rowsCount ); thisColumnsBuffer = paddingIndex; + matrixColumnsBuffer_view = paddingIndex; //// // Copy matrix elements into buffer @@ -765,12 +767,15 @@ operator=( const SparseMatrix< Real2, Segments2, Device2, Index2, RealAllocator2 if( column != paddingIndex ) { const IndexType bufferIdx = ( rowIdx - baseRow ) * maxRowLength + localIdx; + //printf( ">>>RowIdx = %d GlobalIdx = %d column = %d bufferIdx = %d \n", rowIdx, globalIdx, column, bufferIdx ); matrixValuesBuffer_view[ bufferIdx ] = matrix_values_view[ globalIdx ]; matrixColumnsBuffer_view[ bufferIdx ] = column; } }; matrix.forRows( baseRow, lastRow, f1 ); + //std::cerr << "Values = " << matrixValuesBuffer_view << std::endl; + //std::cerr << "Columns = " << matrixColumnsBuffer_view << std::endl; //// // Copy the source matrix buffer to this matrix buffer thisValuesBuffer_view = matrixValuesBuffer_view; @@ -790,6 +795,7 @@ operator=( const SparseMatrix< Real2, Segments2, Device2, Index2, RealAllocator2 this->forRows( baseRow, lastRow, f2 ); baseRow += bufferRowsCount; } + //std::cerr << "This matrix = " << std::endl << *this << std::endl; } } diff --git a/src/UnitTests/Matrices/SparseMatrixCopyTest.h b/src/UnitTests/Matrices/SparseMatrixCopyTest.h index 684a6a8713b534edb02c89778008332f54095795..e3fb505d30fcc312cc12bd0e39dc824b6ed7a101 100644 --- a/src/UnitTests/Matrices/SparseMatrixCopyTest.h +++ b/src/UnitTests/Matrices/SparseMatrixCopyTest.h @@ -438,7 +438,6 @@ void testConversion() } } - TEST( SparseMatrixCopyTest, CSR_HostToHost ) { testCopyAssignment< CSR_host, CSR_host >();