diff --git a/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_1.cpp b/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_1.cpp index 4c6e28575220b792d1fdeb6e18a879d0dc705b3a..0ceb7a6bd496932c7cb79bca153378f59d3911f0 100644 --- a/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_1.cpp +++ b/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_1.cpp @@ -26,7 +26,7 @@ void SegmentsExample() * Insert data into particular segments. */ auto data_view = data.getView(); - segments.forAllElements( [=] __cuda_callable__ ( int segmentIdx, int localIdx, int globalIdx, bool& compute ) mutable { + segments.forAllElements( [=] __cuda_callable__ ( int segmentIdx, int localIdx, int globalIdx ) mutable { if( localIdx <= segmentIdx ) data_view[ globalIdx ] = segmentIdx; } ); diff --git a/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_2.cpp b/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_2.cpp index c15f5791ee4aebe74d7a3087d07fc6e265f6afc9..9493758b4954d8056a5398c3134b46c072608ea9 100644 --- a/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_2.cpp +++ b/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_2.cpp @@ -25,7 +25,7 @@ void SegmentsExample() * Insert data into particular segments. */ auto data_view = data.getView(); - segments.forAllElements( [=] __cuda_callable__ ( int segmentIdx, int localIdx, int globalIdx, bool& compute ) mutable { + segments.forAllElements( [=] __cuda_callable__ ( int segmentIdx, int localIdx, int globalIdx ) mutable { if( localIdx <= segmentIdx ) data_view[ globalIdx ] = segmentIdx; } ); diff --git a/Documentation/Examples/Algorithms/Segments/SegmentsExample_General.cpp b/Documentation/Examples/Algorithms/Segments/SegmentsExample_General.cpp index e50c6d1edd0a4ed2b70ceaf0cacd78af915608e5..ade0263fbc590e96c3a27309c7c97737de5d708f 100644 --- a/Documentation/Examples/Algorithms/Segments/SegmentsExample_General.cpp +++ b/Documentation/Examples/Algorithms/Segments/SegmentsExample_General.cpp @@ -27,7 +27,7 @@ void SegmentsExample() * Insert data into particular segments. */ auto data_view = data.getView(); - segments.forAllElements( [=] __cuda_callable__ ( IndexType segmentIdx, IndexType localIdx, IndexType globalIdx, bool& compute ) mutable { + segments.forAllElements( [=] __cuda_callable__ ( IndexType segmentIdx, IndexType localIdx, IndexType globalIdx ) mutable { if( localIdx <= segmentIdx ) data_view[ globalIdx ] = segmentIdx; } ); diff --git a/Documentation/Examples/Matrices/DenseMatrix/DenseMatrixExample_forAllElements.cpp b/Documentation/Examples/Matrices/DenseMatrix/DenseMatrixExample_forAllElements.cpp index 4fd7d3b4727e8c4aca8d7c066a88038b80b4a887..f143164a25fd87c46abde31621fdc22552547256 100644 --- a/Documentation/Examples/Matrices/DenseMatrix/DenseMatrixExample_forAllElements.cpp +++ b/Documentation/Examples/Matrices/DenseMatrix/DenseMatrixExample_forAllElements.cpp @@ -8,10 +8,8 @@ void forAllElementsExample() { TNL::Matrices::DenseMatrix< double, Device > matrix( 5, 5 ); - auto f = [=] __cuda_callable__ ( int rowIdx, int columnIdx, int columnIdx_, double& value, bool& compute ) { - if( rowIdx < columnIdx ) - compute = false; - else + auto f = [=] __cuda_callable__ ( int rowIdx, int columnIdx, int columnIdx_, double& value ) { + if( rowIdx >= columnIdx ) value = rowIdx + columnIdx; }; diff --git a/Documentation/Examples/Matrices/DenseMatrix/DenseMatrixExample_forElements.cpp b/Documentation/Examples/Matrices/DenseMatrix/DenseMatrixExample_forElements.cpp index 0764eecdfc39c76ed05161ef7eee8512be3b08d6..b37470c43c6756f11e99eff932aea4200c48eb0c 100644 --- a/Documentation/Examples/Matrices/DenseMatrix/DenseMatrixExample_forElements.cpp +++ b/Documentation/Examples/Matrices/DenseMatrix/DenseMatrixExample_forElements.cpp @@ -8,10 +8,8 @@ void forElementsExample() { TNL::Matrices::DenseMatrix< double, Device > matrix( 5, 5 ); - auto f = [=] __cuda_callable__ ( int rowIdx, int columnIdx, int columnIdx_, double& value, bool& compute ) { - if( rowIdx < columnIdx ) - compute = false; - else + auto f = [=] __cuda_callable__ ( int rowIdx, int columnIdx, int columnIdx_, double& value ) { + if( rowIdx >= columnIdx ) value = rowIdx + columnIdx; }; diff --git a/Documentation/Examples/Matrices/DenseMatrix/DenseMatrixViewExample_forAllElements.cpp b/Documentation/Examples/Matrices/DenseMatrix/DenseMatrixViewExample_forAllElements.cpp index 66b39413017b41b98b67eb2a3ff48455110cd8ec..c5802a0e1f7415bb3f3b43627c3ae88d6010325c 100644 --- a/Documentation/Examples/Matrices/DenseMatrix/DenseMatrixViewExample_forAllElements.cpp +++ b/Documentation/Examples/Matrices/DenseMatrix/DenseMatrixViewExample_forAllElements.cpp @@ -9,10 +9,8 @@ void forAllElementsExample() TNL::Matrices::DenseMatrix< double, Device > matrix( 5, 5 ); auto matrixView = matrix.getView(); - auto f = [=] __cuda_callable__ ( int rowIdx, int columnIdx, int globalIdx, double& value, bool& compute ) { - if( rowIdx < columnIdx ) - compute = false; - else + auto f = [=] __cuda_callable__ ( int rowIdx, int columnIdx, int globalIdx, double& value ) { + if( rowIdx >= columnIdx ) value = rowIdx + columnIdx; }; diff --git a/Documentation/Examples/Matrices/DenseMatrix/DenseMatrixViewExample_forElements.cpp b/Documentation/Examples/Matrices/DenseMatrix/DenseMatrixViewExample_forElements.cpp index 6a980d23c148599835882425db3a03475612ccef..572c526f02554bd66baaa2f7e900426edd9118bb 100644 --- a/Documentation/Examples/Matrices/DenseMatrix/DenseMatrixViewExample_forElements.cpp +++ b/Documentation/Examples/Matrices/DenseMatrix/DenseMatrixViewExample_forElements.cpp @@ -9,10 +9,8 @@ void forElementsExample() TNL::Matrices::DenseMatrix< double, Device > matrix( 5, 5 ); auto matrixView = matrix.getView(); - auto f = [=] __cuda_callable__ ( int rowIdx, int columnIdx, int globalIdx, double& value, bool& compute ) { - if( columnIdx > rowIdx ) - compute = false; - else + auto f = [=] __cuda_callable__ ( int rowIdx, int columnIdx, int globalIdx, double& value ) { + if( columnIdx <= rowIdx ) value = rowIdx + columnIdx; }; diff --git a/Documentation/Examples/Matrices/LambdaMatrix/LambdaMatrixExample_forAllElements.cpp b/Documentation/Examples/Matrices/LambdaMatrix/LambdaMatrixExample_forAllElements.cpp index 293f173d2a0115ea46b03ac09018e399ad7c99f1..6b335f5f298f4d750a8f7ce22a42755bebfdbcef 100644 --- a/Documentation/Examples/Matrices/LambdaMatrix/LambdaMatrixExample_forAllElements.cpp +++ b/Documentation/Examples/Matrices/LambdaMatrix/LambdaMatrixExample_forAllElements.cpp @@ -22,7 +22,7 @@ void forAllElementsExample() TNL::Matrices::DenseMatrix< double, Device > denseMatrix( 5, 5 ); auto denseView = denseMatrix.getView(); - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double value, bool& compute ) mutable { + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double value ) mutable { denseView.setElement( rowIdx, columnIdx, value ); }; diff --git a/Documentation/Examples/Matrices/LambdaMatrix/LambdaMatrixExample_forElements.cpp b/Documentation/Examples/Matrices/LambdaMatrix/LambdaMatrixExample_forElements.cpp index f23f031b1ba3b4544ee1f20908d831c117879553..8472ef28d2a86955e03ade98929429b5ebadd0a6 100644 --- a/Documentation/Examples/Matrices/LambdaMatrix/LambdaMatrixExample_forElements.cpp +++ b/Documentation/Examples/Matrices/LambdaMatrix/LambdaMatrixExample_forElements.cpp @@ -22,7 +22,7 @@ void forElementsExample() TNL::Matrices::DenseMatrix< double, Device > denseMatrix( 5, 5 ); auto denseView = denseMatrix.getView(); - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double value, bool& compute ) mutable { + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double value ) mutable { denseView.setElement( rowIdx, columnIdx, value ); }; diff --git a/Documentation/Examples/Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forAllElements.cpp b/Documentation/Examples/Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forAllElements.cpp index b29543d9e0cb88da80f5ed0f9381d7be772c3f48..96a4668b9683ad577054673b94a2014f68387df9 100644 --- a/Documentation/Examples/Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forAllElements.cpp +++ b/Documentation/Examples/Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forAllElements.cpp @@ -23,7 +23,7 @@ void forAllElementsExample() 5, // number of matrix columns { -2, -1, 0 } ); // matrix diagonals offsets - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double& value, bool& compute ) { + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double& value ) { /*** * 'forElements' method iterates only over matrix elements lying on given subdiagonals * and so we do not need to check anything. The element value can be expressed diff --git a/Documentation/Examples/Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forElements.cpp b/Documentation/Examples/Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forElements.cpp index dd30694e6f1fcae01f948b5d896a00eed23df20e..1dc957af245717e59c0082c3eb8fa6ac2932eef7 100644 --- a/Documentation/Examples/Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forElements.cpp +++ b/Documentation/Examples/Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forElements.cpp @@ -23,7 +23,7 @@ void forElementsExample() 5, // number of matrix columns { -2, -1, 0 } ); // matrix diagonals offsets - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double& value, bool& compute ) { + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double& value ) { /*** * 'forElements' method iterates only over matrix elements lying on given subdiagonals * and so we do not need to check anything. The element value can be expressed diff --git a/Documentation/Examples/Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forAllElements.cpp b/Documentation/Examples/Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forAllElements.cpp index b05da1d8213143bc5ffd11625f3580c9185248e7..4ca0940cbedebc2e26ca628303f69841cdca3f3d 100644 --- a/Documentation/Examples/Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forAllElements.cpp +++ b/Documentation/Examples/Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forAllElements.cpp @@ -24,7 +24,7 @@ void forAllElementsExample() { -2, -1, 0 } ); // matrix diagonals offsets auto view = matrix.getView(); - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double& value, bool& compute ) { + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double& value ) { /*** * 'forElements' method iterates only over matrix elements lying on given subdiagonals * and so we do not need to check anything. The element value can be expressed diff --git a/Documentation/Examples/Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forElements.cpp b/Documentation/Examples/Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forElements.cpp index 9663a2c0d4648ef85c27d5a76f17454b7b6de55e..d941fc4a2039064d6e999dda5abef65df9d37a5e 100644 --- a/Documentation/Examples/Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forElements.cpp +++ b/Documentation/Examples/Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forElements.cpp @@ -24,7 +24,7 @@ void forElementsExample() { -2, -1, 0 } ); // matrix diagonals offsets auto view = matrix.getView(); - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double& value, bool& compute ) { + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double& value ) { /*** * 'forElements' method iterates only over matrix elements lying on given subdiagonals * and so we do not need to check anything. The element value can be expressed diff --git a/Documentation/Examples/Matrices/SparseMatrix/SparseMatrixExample_forAllElements.cpp b/Documentation/Examples/Matrices/SparseMatrix/SparseMatrixExample_forAllElements.cpp index c603fe32f9d345063975cbbae8ada8859c9285df..8c9fb368c15f85dfff6bcfca639ec59e0d0b9011 100644 --- a/Documentation/Examples/Matrices/SparseMatrix/SparseMatrixExample_forAllElements.cpp +++ b/Documentation/Examples/Matrices/SparseMatrix/SparseMatrixExample_forAllElements.cpp @@ -8,11 +8,9 @@ void forAllElementsExample() { TNL::Matrices::SparseMatrix< double, Device > matrix( { 1, 2, 3, 4, 5 }, 5 ); - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int& columnIdx, double& value, bool& compute ) { - if( rowIdx < localIdx ) // This is important, some matrix formats may allocate more matrix elements + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int& columnIdx, double& value ) { + if( rowIdx >= localIdx ) // This is important, some matrix formats may allocate more matrix elements // than we requested. These padding elements are processed here as well. - compute = false; - else { columnIdx = localIdx; value = rowIdx + localIdx + 1; diff --git a/Documentation/Examples/Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp b/Documentation/Examples/Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp index 216433b637bf4870b05ca160cc70bbb44bd00287..2d7bbeba55d62f0f18fa2f1402f4b159d57731a6 100644 --- a/Documentation/Examples/Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp +++ b/Documentation/Examples/Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp @@ -8,11 +8,9 @@ void forElementsExample() { TNL::Matrices::SparseMatrix< double, Device > matrix( { 1, 2, 3, 4, 5 }, 5 ); - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int& columnIdx, double& value, bool& compute ) { - if( rowIdx < localIdx ) // This is important, some matrix formats may allocate more matrix elements + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int& columnIdx, double& value ) { + if( rowIdx >= localIdx ) // This is important, some matrix formats may allocate more matrix elements // than we requested. These padding elements are processed here as well. - compute = false; - else { columnIdx = localIdx; value = rowIdx + localIdx + 1; diff --git a/Documentation/Examples/Matrices/SparseMatrix/SparseMatrixViewExample_forAllElements.cpp b/Documentation/Examples/Matrices/SparseMatrix/SparseMatrixViewExample_forAllElements.cpp index 4000107eb325c6abb8c8f79c379eecbdfd9f2386..79fb7890d5df862f79d2d65e60d88c6727c34748 100644 --- a/Documentation/Examples/Matrices/SparseMatrix/SparseMatrixViewExample_forAllElements.cpp +++ b/Documentation/Examples/Matrices/SparseMatrix/SparseMatrixViewExample_forAllElements.cpp @@ -9,11 +9,9 @@ void forAllElementsExample() TNL::Matrices::SparseMatrix< double, Device > matrix( { 1, 2, 3, 4, 5 }, 5 ); auto view = matrix.getView(); - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int& columnIdx, double& value, bool& compute ) { - if( rowIdx < localIdx ) // This is important, some matrix formats may allocate more matrix elements + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int& columnIdx, double& value ) { + if( rowIdx >= localIdx ) // This is important, some matrix formats may allocate more matrix elements // than we requested. These padding elements are processed here as well. - compute = false; - else { columnIdx = localIdx; value = rowIdx + localIdx + 1; diff --git a/Documentation/Examples/Matrices/SparseMatrix/SparseMatrixViewExample_forElements.cpp b/Documentation/Examples/Matrices/SparseMatrix/SparseMatrixViewExample_forElements.cpp index 4ffb2ee834d8b76a5b557f71a5f45a674aa17b1c..6e296d3dec1fb78b72b6e4b140217f9007b02c68 100644 --- a/Documentation/Examples/Matrices/SparseMatrix/SparseMatrixViewExample_forElements.cpp +++ b/Documentation/Examples/Matrices/SparseMatrix/SparseMatrixViewExample_forElements.cpp @@ -9,11 +9,9 @@ void forElementsExample() TNL::Matrices::SparseMatrix< double, Device > matrix( { 1, 2, 3, 4, 5 }, 5 ); auto view = matrix.getView(); - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int& columnIdx, double& value, bool& compute ) { - if( rowIdx < localIdx ) // This is important, some matrix formats may allocate more matrix elements + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int& columnIdx, double& value ) { + if( rowIdx >= localIdx ) // This is important, some matrix formats may allocate more matrix elements // than we requested. These padding elements are processed here as well. - compute = false; - else { columnIdx = localIdx; value = rowIdx + localIdx + 1; diff --git a/Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forAllElements.cpp b/Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forAllElements.cpp index c29b439a6b85274f863b110e80aea7ca8537fbb3..314cd6e4b8491b9f4ee482936100eaec432b9e84 100644 --- a/Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forAllElements.cpp +++ b/Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forAllElements.cpp @@ -20,7 +20,7 @@ void forAllElementsExample() 5, // number of matrix rows 5 ); // number of matrix columns - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double& value, bool& compute ) { + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double& value ) { /*** * 'forElements' method iterates only over matrix elements lying on given subdiagonals * and so we do not need to check anything. The element value can be expressed diff --git a/Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forElements.cpp b/Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forElements.cpp index 243e9468eb5fc6ea48fa521cd0a651f2f77798e4..b15a9f5818d16ad963a5ff8ab95d98a0f7da7f64 100644 --- a/Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forElements.cpp +++ b/Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forElements.cpp @@ -20,7 +20,7 @@ void forElementsExample() 5, // number of matrix rows 5 ); // number of matrix columns - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double& value, bool& compute ) { + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double& value ) { /*** * 'forElements' method iterates only over matrix elements lying on given subdiagonals * and so we do not need to check anything. The element value can be expressed diff --git a/Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forAllElements.cpp b/Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forAllElements.cpp index 0ef4304623f9d5e1a6330c04c46ef30332f9fd89..8d90c989ef08e7beceb3bc70842f93b88eaafa91 100644 --- a/Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forAllElements.cpp +++ b/Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forAllElements.cpp @@ -21,7 +21,7 @@ void forAllElementsExample() 5 ); // number of matrix columns auto view = matrix.getView(); - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double& value, bool& compute ) { + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double& value ) { /*** * 'forElements' method iterates only over matrix elements lying on given subdiagonals * and so we do not need to check anything. The element value can be expressed diff --git a/Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forElements.cpp b/Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forElements.cpp index 3045bc655ef1271d5d04d0c807bd979f9a996fcb..b077c008c70507f991abd29935980c54d08c072b 100644 --- a/Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forElements.cpp +++ b/Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forElements.cpp @@ -21,7 +21,7 @@ void forElementsExample() 5 ); // number of matrix columns auto view = matrix.getView(); - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double& value, bool& compute ) { + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, double& value ) { /*** * 'forElements' method iterates only over matrix elements lying on given subdiagonals * and so we do not need to check anything. The element value can be expressed diff --git a/Documentation/Tutorials/Matrices/DenseMatrixSetup_Benchmark.cpp b/Documentation/Tutorials/Matrices/DenseMatrixSetup_Benchmark.cpp index 7696e9d0d7e99e750b6f6d68e63d013c2938655e..64979b0d4162c9df5a69fbd527e5d667d4e9afb6 100644 --- a/Documentation/Tutorials/Matrices/DenseMatrixSetup_Benchmark.cpp +++ b/Documentation/Tutorials/Matrices/DenseMatrixSetup_Benchmark.cpp @@ -62,7 +62,7 @@ void forElements( const int matrixSize, Matrix& matrix ) { matrix.setDimensions( matrixSize, matrixSize ); - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int& columnIdx, float& value, bool& compute ) mutable { + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int& columnIdx, float& value ) mutable { value = rowIdx + columnIdx; }; matrix.forElements( 0, matrixSize, f ); diff --git a/Documentation/Tutorials/Matrices/MultidiagonalMatrixSetup_Benchmark.cpp b/Documentation/Tutorials/Matrices/MultidiagonalMatrixSetup_Benchmark.cpp index d323105cd08972c2ad4d3aba6bde982e38374948..75186957eaa6b469fcddf598645029d42626a3a0 100644 --- a/Documentation/Tutorials/Matrices/MultidiagonalMatrixSetup_Benchmark.cpp +++ b/Documentation/Tutorials/Matrices/MultidiagonalMatrixSetup_Benchmark.cpp @@ -143,7 +143,7 @@ void forElements( const int gridSize, Matrix& matrix ) const int matrixSize = gridSize * gridSize; matrix.setDimensions( matrixSize, matrixSize, getOffsets< typename Matrix::DeviceType >( gridSize ) ); - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, float& value, bool& compute ) mutable { + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int columnIdx, float& value ) mutable { const int i = rowIdx % gridSize; const int j = rowIdx / gridSize; if( ( i == 0 || j == 0 || i == gridSize - 1 || j == gridSize - 1 ) && localIdx == 0 ) diff --git a/Documentation/Tutorials/Matrices/SparseMatrixSetup_Benchmark.cpp b/Documentation/Tutorials/Matrices/SparseMatrixSetup_Benchmark.cpp index 7af7de1e1031545ededa7e1ca29d333deaa9cc94..31a2a039c09abd3c8466c16e8dbcc6a7e9cd15bd 100644 --- a/Documentation/Tutorials/Matrices/SparseMatrixSetup_Benchmark.cpp +++ b/Documentation/Tutorials/Matrices/SparseMatrixSetup_Benchmark.cpp @@ -168,7 +168,7 @@ void forElements( const int gridSize, Matrix& matrix ) matrix.setDimensions( matrixSize, matrixSize ); matrix.setRowCapacities( rowCapacities ); - auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int& columnIdx, float& value, bool& compute ) mutable { + auto f = [=] __cuda_callable__ ( int rowIdx, int localIdx, int& columnIdx, float& value ) mutable { const int i = rowIdx % gridSize; const int j = rowIdx / gridSize; if( ( i == 0 || j == 0 || i == gridSize - 1 || j == gridSize - 1 ) && localIdx == 0 ) diff --git a/src/TNL/Algorithms/Segments/BiEllpackView.h b/src/TNL/Algorithms/Segments/BiEllpackView.h index 0bb603a3ae7322b7077caa1b3c01d58c9c8580de..c37ed6d730d42d6e7d7ea4438dae403807e99705 100644 --- a/src/TNL/Algorithms/Segments/BiEllpackView.h +++ b/src/TNL/Algorithms/Segments/BiEllpackView.h @@ -159,8 +159,7 @@ class BiEllpackView typename Reduction, typename ResultKeeper, typename Real, - int BlockDim, - typename... Args > + int BlockDim > __device__ void reduceSegmentsKernelWithAllParameters( IndexType gridIdx, IndexType first, @@ -168,15 +167,13 @@ class BiEllpackView Fetch fetch, Reduction reduction, ResultKeeper keeper, - Real zero, - Args... args ) const; + Real zero ) const; template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real_, - int BlockDim, - typename... Args > + int BlockDim > __device__ void reduceSegmentsKernel( IndexType gridIdx, IndexType first, @@ -184,8 +181,7 @@ class BiEllpackView Fetch fetch, Reduction reduction, ResultKeeper keeper, - Real_ zero, - Args... args ) const; + Real_ zero ) const; template< typename View_, typename Index_, @@ -193,8 +189,7 @@ class BiEllpackView typename Reduction_, typename ResultKeeper_, typename Real_, - int BlockDim, - typename... Args_ > + int BlockDim > friend __global__ void BiEllpackreduceSegmentsKernel( View_ chunkedEllpack, Index_ gridIdx, @@ -203,8 +198,7 @@ class BiEllpackView Fetch_ fetch, Reduction_ reduction, ResultKeeper_ keeper, - Real_ zero, - Args_... args ); + Real_ zero ); template< typename Index_, typename Fetch_, int BlockDim_, int WarpSize_, bool B_ > friend struct details::BiEllpackreduceSegmentsDispatcher; diff --git a/src/TNL/Algorithms/Segments/BiEllpackView.hpp b/src/TNL/Algorithms/Segments/BiEllpackView.hpp index 98c5c05c83cee68f9f62b4f8b79063be6c7e2c6b..b480deac08392cd150f397afeb00535afc884af2 100644 --- a/src/TNL/Algorithms/Segments/BiEllpackView.hpp +++ b/src/TNL/Algorithms/Segments/BiEllpackView.hpp @@ -275,9 +275,8 @@ forElements( IndexType first, IndexType last, Function&& f ) const const IndexType groupsCount = detail::BiEllpack< IndexType, DeviceType, Organization, getWarpSize() >::getActiveGroupsCountDirect( segmentsPermutationView, segmentIdx ); IndexType groupHeight = getWarpSize(); //printf( "segmentIdx = %d strip = %d firstGroupInStrip = %d rowStripPerm = %d groupsCount = %d \n", segmentIdx, strip, firstGroupInStrip, rowStripPerm, groupsCount ); - bool compute( true ); IndexType localIdx( 0 ); - for( IndexType groupIdx = firstGroupInStrip; groupIdx < firstGroupInStrip + groupsCount && compute; groupIdx++ ) + for( IndexType groupIdx = firstGroupInStrip; groupIdx < firstGroupInStrip + groupsCount; groupIdx++ ) { IndexType groupOffset = groupPointersView[ groupIdx ]; const IndexType groupSize = groupPointersView[ groupIdx + 1 ] - groupOffset; @@ -289,14 +288,14 @@ forElements( IndexType first, IndexType last, Function&& f ) const { if( Organization == RowMajorOrder ) { - f( segmentIdx, localIdx, groupOffset + rowStripPerm * groupWidth + i, compute ); + f( segmentIdx, localIdx, groupOffset + rowStripPerm * groupWidth + i ); } else { /*printf( "segmentIdx = %d localIdx = %d globalIdx = %d groupIdx = %d groupSize = %d groupWidth = %d\n", segmentIdx, localIdx, groupOffset + rowStripPerm + i * groupHeight, groupIdx, groupSize, groupWidth );*/ - f( segmentIdx, localIdx, groupOffset + rowStripPerm + i * groupHeight, compute ); + f( segmentIdx, localIdx, groupOffset + rowStripPerm + i * groupHeight ); } localIdx++; } diff --git a/src/TNL/Algorithms/Segments/CSR.h b/src/TNL/Algorithms/Segments/CSR.h index 4fe24934f21b822f8f8bf26a12ec257bfb15ec4f..af05a9f614f1a79f58d20e3b28285f8c495058dd 100644 --- a/src/TNL/Algorithms/Segments/CSR.h +++ b/src/TNL/Algorithms/Segments/CSR.h @@ -293,7 +293,7 @@ class CSR */ OffsetsContainer& getOffsets(); - /*** + /** * \brief Go over all segments and for each segment element call * function 'f'. The return type of 'f' is bool. * When its true, the for-loop continues. Once 'f' returns false, the for-loop diff --git a/src/TNL/Algorithms/Segments/CSRView.hpp b/src/TNL/Algorithms/Segments/CSRView.hpp index 7de19383738a0dcbfec720f8336b1bbc6ed50123..08822ca94884d17490ac80f3ee633b2bb3826d34 100644 --- a/src/TNL/Algorithms/Segments/CSRView.hpp +++ b/src/TNL/Algorithms/Segments/CSRView.hpp @@ -193,9 +193,8 @@ forElements( IndexType begin, IndexType end, Function&& f ) const const IndexType begin = offsetsView[ segmentIdx ]; const IndexType end = offsetsView[ segmentIdx + 1 ]; IndexType localIdx( 0 ); - bool compute( true ); - for( IndexType globalIdx = begin; globalIdx < end && compute; globalIdx++ ) - f( segmentIdx, localIdx++, globalIdx, compute ); + for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ ) + f( segmentIdx, localIdx++, globalIdx ); }; Algorithms::ParallelFor< Device >::exec( begin, end, l ); } diff --git a/src/TNL/Algorithms/Segments/ChunkedEllpackView.h b/src/TNL/Algorithms/Segments/ChunkedEllpackView.h index 8f8177dbb4309e572dac4010285d706bd3c5dd4b..123bc1cb9281db3668533e00eeed509147140c16 100644 --- a/src/TNL/Algorithms/Segments/ChunkedEllpackView.h +++ b/src/TNL/Algorithms/Segments/ChunkedEllpackView.h @@ -158,8 +158,7 @@ class ChunkedEllpackView template< typename Fetch, typename Reduction, typename ResultKeeper, - typename Real, - typename... Args > + typename Real > __device__ void reduceSegmentsKernelWithAllParameters( IndexType gridIdx, IndexType first, @@ -167,14 +166,12 @@ class ChunkedEllpackView Fetch fetch, Reduction reduction, ResultKeeper keeper, - Real zero, - Args... args ) const; + Real zero ) const; template< typename Fetch, typename Reduction, typename ResultKeeper, - typename Real, - typename... Args > + typename Real > __device__ void reduceSegmentsKernel( IndexType gridIdx, IndexType first, @@ -182,8 +179,7 @@ class ChunkedEllpackView Fetch fetch, Reduction reduction, ResultKeeper keeper, - Real zero, - Args... args ) const; + Real zero ) const; #endif IndexType size = 0, storageSize = 0, numberOfSlices = 0; @@ -216,8 +212,7 @@ class ChunkedEllpackView typename Fetch_, typename Reduction_, typename ResultKeeper_, - typename Real_, - typename... Args_ > + typename Real_ > friend __global__ void ChunkedEllpackreduceSegmentsKernel( View_ chunkedEllpack, Index_ gridIdx, @@ -226,8 +221,7 @@ class ChunkedEllpackView Fetch_ fetch, Reduction_ reduction, ResultKeeper_ keeper, - Real_ zero, - Args_... args ); + Real_ zero ); template< typename Index_, typename Fetch_, bool B_ > friend struct details::ChunkedEllpackreduceSegmentsDispatcher; diff --git a/src/TNL/Algorithms/Segments/ChunkedEllpackView.hpp b/src/TNL/Algorithms/Segments/ChunkedEllpackView.hpp index c43b57321d853b00315978776cc31bab6e216838..5f73fd8ab2b8604351827bfe1cc86b3d5529dd04 100644 --- a/src/TNL/Algorithms/Segments/ChunkedEllpackView.hpp +++ b/src/TNL/Algorithms/Segments/ChunkedEllpackView.hpp @@ -323,14 +323,13 @@ forElements( IndexType first, IndexType last, Function&& f ) const const IndexType chunkSize = slices[ sliceIdx ].chunkSize; const IndexType segmentSize = segmentChunksCount * chunkSize; - bool compute( true ); if( Organization == RowMajorOrder ) { IndexType begin = sliceOffset + firstChunkOfSegment * chunkSize; IndexType end = begin + segmentSize; IndexType localIdx( 0 ); - for( IndexType j = begin; j < end && compute; j++ ) - f( segmentIdx, localIdx++, j, compute ); + for( IndexType j = begin; j < end; j++ ) + f( segmentIdx, localIdx++, j ); } else { @@ -339,9 +338,9 @@ forElements( IndexType first, IndexType last, Function&& f ) const { IndexType begin = sliceOffset + firstChunkOfSegment + chunkIdx; IndexType end = begin + chunksInSlice * chunkSize; - for( IndexType j = begin; j < end && compute; j += chunksInSlice ) + for( IndexType j = begin; j < end; j += chunksInSlice ) { - f( segmentIdx, localIdx++, j, compute ); + f( segmentIdx, localIdx++, j ); } } } diff --git a/src/TNL/Algorithms/Segments/EllpackView.hpp b/src/TNL/Algorithms/Segments/EllpackView.hpp index 120f8f43692d150870b799c04ac52647f8e8583c..1ec928336ba7618d29fc09d84b19ac813d8ad285 100644 --- a/src/TNL/Algorithms/Segments/EllpackView.hpp +++ b/src/TNL/Algorithms/Segments/EllpackView.hpp @@ -207,9 +207,8 @@ forElements( IndexType first, IndexType last, Function&& f ) const const IndexType begin = segmentIdx * segmentSize; const IndexType end = begin + segmentSize; IndexType localIdx( 0 ); - bool compute( true ); - for( IndexType globalIdx = begin; globalIdx < end && compute; globalIdx++ ) - f( segmentIdx, localIdx++, globalIdx, compute ); + for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ ) + f( segmentIdx, localIdx++, globalIdx ); }; Algorithms::ParallelFor< Device >::exec( first, last, l ); } @@ -221,9 +220,8 @@ forElements( IndexType first, IndexType last, Function&& f ) const const IndexType begin = segmentIdx; const IndexType end = storageSize; IndexType localIdx( 0 ); - bool compute( true ); - for( IndexType globalIdx = begin; globalIdx < end && compute; globalIdx += alignedSize ) - f( segmentIdx, localIdx++, globalIdx, compute ); + for( IndexType globalIdx = begin; globalIdx < end; globalIdx += alignedSize ) + f( segmentIdx, localIdx++, globalIdx ); }; Algorithms::ParallelFor< Device >::exec( first, last, l ); } diff --git a/src/TNL/Algorithms/Segments/SlicedEllpackView.hpp b/src/TNL/Algorithms/Segments/SlicedEllpackView.hpp index 703da8d3c32e20f2cef99f84fbcbee6f56415327..871aa2da05eba9b4a3d0bd474589ea5a183e4969 100644 --- a/src/TNL/Algorithms/Segments/SlicedEllpackView.hpp +++ b/src/TNL/Algorithms/Segments/SlicedEllpackView.hpp @@ -242,15 +242,14 @@ forElements( IndexType first, IndexType last, Function&& f ) const const IndexType begin = sliceOffsets_view[ sliceIdx ] + segmentInSliceIdx * segmentSize; const IndexType end = begin + segmentSize; IndexType localIdx( 0 ); - bool compute( true ); - for( IndexType globalIdx = begin; globalIdx < end && compute; globalIdx++ ) + for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ ) { // The following is a workaround of a bug in nvcc 11.2 #if CUDART_VERSION == 11020 - f( segmentIdx, localIdx, globalIdx, compute ); + f( segmentIdx, localIdx, globalIdx ); localIdx++; #else - f( segmentIdx, localIdx++, globalIdx, compute ); + f( segmentIdx, localIdx++, globalIdx ); #endif } }; @@ -265,15 +264,14 @@ forElements( IndexType first, IndexType last, Function&& f ) const const IndexType begin = sliceOffsets_view[ sliceIdx ] + segmentInSliceIdx; const IndexType end = sliceOffsets_view[ sliceIdx + 1 ]; IndexType localIdx( 0 ); - bool compute( true ); - for( IndexType globalIdx = begin; globalIdx < end && compute; globalIdx += SliceSize ) + for( IndexType globalIdx = begin; globalIdx < end; globalIdx += SliceSize ) { // The following is a workaround of a bug in nvcc 11.2 #if CUDART_VERSION == 11020 - f( segmentIdx, localIdx, globalIdx, compute ); + f( segmentIdx, localIdx, globalIdx ); localIdx++; #else - f( segmentIdx, localIdx++, globalIdx, compute ); + f( segmentIdx, localIdx++, globalIdx ); #endif } }; diff --git a/src/TNL/Matrices/DenseMatrix.h b/src/TNL/Matrices/DenseMatrix.h index a65c12d80bcb0475198714b5adf597d45e7a926c..0036ba240d88ed0e9ac9458d3ae3ed149e3775e6 100644 --- a/src/TNL/Matrices/DenseMatrix.h +++ b/src/TNL/Matrices/DenseMatrix.h @@ -457,10 +457,8 @@ class DenseMatrix : public Matrix< Real, Device, Index, RealAllocator > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -479,10 +477,8 @@ class DenseMatrix : public Matrix< Real, Device, Index, RealAllocator > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -633,10 +629,8 @@ class DenseMatrix : public Matrix< Real, Device, Index, RealAllocator > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -650,10 +644,8 @@ class DenseMatrix : public Matrix< Real, Device, Index, RealAllocator > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. diff --git a/src/TNL/Matrices/DenseMatrix.hpp b/src/TNL/Matrices/DenseMatrix.hpp index 16b844cda7eebc28412b164e33bb58393b578648..46c85a373bb797ec9fec15a53183a1ac5e047187 100644 --- a/src/TNL/Matrices/DenseMatrix.hpp +++ b/src/TNL/Matrices/DenseMatrix.hpp @@ -1139,7 +1139,7 @@ operator=( const DenseMatrixView< RHSReal, RHSDevice, RHSIndex, RHSOrganization auto this_view = this->view; if( std::is_same< DeviceType, RHSDeviceType >::value ) { - auto f = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIdx, const RHSRealType& value, bool& compute ) mutable { + auto f = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIdx, const RHSRealType& value ) mutable { this_view( rowIdx, columnIdx ) = value; }; matrix.forAllElements( f ); @@ -1162,7 +1162,7 @@ operator=( const DenseMatrixView< RHSReal, RHSDevice, RHSIndex, RHSOrganization //// // Copy matrix elements into buffer - auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIdx, const RHSRealType& value, bool& compute ) mutable { + auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIdx, const RHSRealType& value ) mutable { const IndexType bufferIdx = ( rowIdx - baseRow ) * maxRowLength + columnIdx; matrixValuesBuffer_view[ bufferIdx ] = value; }; @@ -1214,7 +1214,7 @@ operator=( const RHSMatrix& matrix ) if( std::is_same< DeviceType, RHSDeviceType >::value ) { const auto segments_view = this->segments.getView(); - auto f = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx_, RHSIndexType columnIdx, const RHSRealType& value, bool& compute ) mutable { + auto f = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx_, RHSIndexType columnIdx, const RHSRealType& value ) mutable { if( value != 0.0 && columnIdx != padding_index ) values_view[ segments_view.getGlobalIndex( rowIdx, columnIdx ) ] = value; }; @@ -1244,7 +1244,7 @@ operator=( const RHSMatrix& matrix ) //// // Copy matrix elements into buffer - auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value, bool& compute ) mutable { + auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value ) mutable { if( columnIndex != padding_index ) { const IndexType bufferIdx = ( rowIdx - baseRow ) * maxRowLength + localIdx; diff --git a/src/TNL/Matrices/DenseMatrixView.h b/src/TNL/Matrices/DenseMatrixView.h index ea7f6dbe74d89fee10596363fccb710089486206..5fd6cda8e34ab9414afe76139ddc082c1e87361a 100644 --- a/src/TNL/Matrices/DenseMatrixView.h +++ b/src/TNL/Matrices/DenseMatrixView.h @@ -518,7 +518,7 @@ class DenseMatrixView : public MatrixView< Real, Device, Index > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx, const RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. * If the 'compute' variable is set to false the iteration over the row can * be interrupted. @@ -540,7 +540,7 @@ class DenseMatrixView : public MatrixView< Real, Device, Index > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx, RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx, RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. * If the 'compute' variable is set to false the iteration over the row can * be interrupted. @@ -694,7 +694,7 @@ class DenseMatrixView : public MatrixView< Real, Device, Index > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. * If the 'compute' variable is set to false the iteration over the row can * be interrupted. @@ -711,7 +711,7 @@ class DenseMatrixView : public MatrixView< Real, Device, Index > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. * If the 'compute' variable is set to false the iteration over the row can * be interrupted. diff --git a/src/TNL/Matrices/DenseMatrixView.hpp b/src/TNL/Matrices/DenseMatrixView.hpp index 68b2de7eed6129445bb564a6ddfa10100918a89e..1ace7705689491fe9320b837ab2b0a624ad265a6 100644 --- a/src/TNL/Matrices/DenseMatrixView.hpp +++ b/src/TNL/Matrices/DenseMatrixView.hpp @@ -355,8 +355,8 @@ DenseMatrixView< Real, Device, Index, Organization >:: forElements( IndexType begin, IndexType end, Function&& function ) const { const auto values_view = this->values.getConstView(); - auto f = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType globalIdx, bool& compute ) mutable { - function( rowIdx, columnIdx, columnIdx, values_view[ globalIdx ], compute ); + auto f = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType globalIdx ) mutable { + function( rowIdx, columnIdx, columnIdx, values_view[ globalIdx ] ); }; this->segments.forElements( begin, end, f ); } @@ -371,8 +371,8 @@ DenseMatrixView< Real, Device, Index, Organization >:: forElements( IndexType begin, IndexType end, Function&& function ) { auto values_view = this->values.getView(); - auto f = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType globalIdx, bool& compute ) mutable { - function( rowIdx, columnIdx, globalIdx, values_view[ globalIdx ], compute ); + auto f = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType globalIdx ) mutable { + function( rowIdx, columnIdx, globalIdx, values_view[ globalIdx ] ); }; this->segments.forElements( begin, end, f ); } diff --git a/src/TNL/Matrices/LambdaMatrix.h b/src/TNL/Matrices/LambdaMatrix.h index 01d3a0b9101bb5e95e0c044f4c39d70b750bd95e..cfdd77d2e3d19c24f5758cd9d7f9c995ef6adabd 100644 --- a/src/TNL/Matrices/LambdaMatrix.h +++ b/src/TNL/Matrices/LambdaMatrix.h @@ -260,10 +260,8 @@ class LambdaMatrix * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -348,7 +346,7 @@ class LambdaMatrix * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. * If the 'compute' variable is set to false the iteration over the row can * be interrupted. diff --git a/src/TNL/Matrices/LambdaMatrix.hpp b/src/TNL/Matrices/LambdaMatrix.hpp index 867016d474147f688a6c3f99e396ee33e0f43b38..77de0872c5379a8bd144c10c85a70e5755717805 100644 --- a/src/TNL/Matrices/LambdaMatrix.hpp +++ b/src/TNL/Matrices/LambdaMatrix.hpp @@ -317,14 +317,13 @@ forElements( IndexType first, IndexType last, Function& function ) const auto matrixElements = this->matrixElementsLambda; auto processRow = [=] __cuda_callable__ ( IndexType rowIdx ) mutable { const IndexType rowLength = rowLengths( rows, columns, rowIdx ); - bool compute( true ); - for( IndexType localIdx = 0; localIdx < rowLength && compute; localIdx++ ) + for( IndexType localIdx = 0; localIdx < rowLength; localIdx++ ) { IndexType elementColumn( 0 ); RealType elementValue( 0.0 ); matrixElements( rows, columns, rowIdx, localIdx, elementColumn, elementValue ); if( elementValue != 0.0 ) - function( rowIdx, localIdx, elementColumn, elementValue, compute ); + function( rowIdx, localIdx, elementColumn, elementValue ); } }; Algorithms::ParallelFor< DeviceType >::exec( first, last, processRow ); diff --git a/src/TNL/Matrices/MultidiagonalMatrix.h b/src/TNL/Matrices/MultidiagonalMatrix.h index d938a106298c298b090ad5bdaf67b57768e109a4..622b79da4f03e745e7bcdc1222ca1027da092a6e 100644 --- a/src/TNL/Matrices/MultidiagonalMatrix.h +++ b/src/TNL/Matrices/MultidiagonalMatrix.h @@ -715,7 +715,7 @@ class MultidiagonalMatrix : public Matrix< Real, Device, Index, RealAllocator > * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like * - * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value, bool& compute )`, + * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )`, * * where * @@ -728,9 +728,6 @@ class MultidiagonalMatrix : public Matrix< Real, Device, Index, RealAllocator > * * \e value is the matrix element value. * - * \e compute is a reference to a boolen variable. If it is set to false the iteration over the row can - * be interrupted. - * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. * \param function is an instance of the lambda function to be called in each row. @@ -749,7 +746,7 @@ class MultidiagonalMatrix : public Matrix< Real, Device, Index, RealAllocator > * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like * - * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value, bool& compute )`, + * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )`, * * where * @@ -762,9 +759,6 @@ class MultidiagonalMatrix : public Matrix< Real, Device, Index, RealAllocator > * * \e value is a reference to the matrix element value. It can be used even for changing the matrix element value. * - * \e compute is a reference to a boolen variable. If it is set to false the iteration over the row can - * be interrupted. - * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. * \param function is an instance of the lambda function to be called in each row. @@ -914,10 +908,8 @@ class MultidiagonalMatrix : public Matrix< Real, Device, Index, RealAllocator > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -931,10 +923,8 @@ class MultidiagonalMatrix : public Matrix< Real, Device, Index, RealAllocator > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. diff --git a/src/TNL/Matrices/MultidiagonalMatrix.hpp b/src/TNL/Matrices/MultidiagonalMatrix.hpp index b432814c6ab06481d1720df07f044e3df06e8e0e..244188831cf05b7d2dc5218060ff35c589e0d016 100644 --- a/src/TNL/Matrices/MultidiagonalMatrix.hpp +++ b/src/TNL/Matrices/MultidiagonalMatrix.hpp @@ -873,7 +873,7 @@ operator=( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, Rea if( std::is_same< Device, Device_ >::value ) { const auto matrix_view = matrix.getView(); - auto f = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value, bool& compute ) mutable { + auto f = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable { value = matrix_view.getValues()[ matrix_view.getIndexer().getGlobalIndex( rowIdx, localIdx ) ]; }; this->forAllElements( f ); @@ -898,7 +898,7 @@ operator=( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, Rea //// // Copy matrix elements into buffer - auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value, bool& compute ) mutable { + auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value ) mutable { const IndexType bufferIdx = ( rowIdx - baseRow ) * maxRowLength + localIdx; matrixValuesBuffer_view[ bufferIdx ] = value; }; @@ -910,7 +910,7 @@ operator=( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, Rea //// // Copy matrix elements from the buffer to the matrix - auto f2 = [=] __cuda_callable__ ( const IndexType rowIdx, const IndexType localIdx, const IndexType columnIndex, RealType& value, bool& compute ) mutable { + auto f2 = [=] __cuda_callable__ ( const IndexType rowIdx, const IndexType localIdx, const IndexType columnIndex, RealType& value ) mutable { const IndexType bufferIdx = ( rowIdx - baseRow ) * maxRowLength + localIdx; value = thisValuesBuffer_view[ bufferIdx ]; }; diff --git a/src/TNL/Matrices/MultidiagonalMatrixView.h b/src/TNL/Matrices/MultidiagonalMatrixView.h index 3575602136cc1596dd461dab2e3ad302645dd535..fc5799fa68b23cdd25a501d899b2fcdcf34c0356 100644 --- a/src/TNL/Matrices/MultidiagonalMatrixView.h +++ b/src/TNL/Matrices/MultidiagonalMatrixView.h @@ -477,7 +477,7 @@ class MultidiagonalMatrixView : public MatrixView< Real, Device, Index > * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like * - * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value, bool& compute )`, + * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )`, * * where * @@ -490,9 +490,6 @@ class MultidiagonalMatrixView : public MatrixView< Real, Device, Index > * * \e value is the matrix element value. * - * \e compute is a reference to a boolen variable. If it is set to false the iteration over the row can - * be interrupted. - * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. * \param function is an instance of the lambda function to be called in each row. @@ -511,7 +508,7 @@ class MultidiagonalMatrixView : public MatrixView< Real, Device, Index > * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like * - * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value, bool& compute )`, + * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )`, * * where * @@ -524,9 +521,6 @@ class MultidiagonalMatrixView : public MatrixView< Real, Device, Index > * * \e value is a reference to the matrix element value. It can be used even for changing the matrix element value. * - * \e compute is a reference to a boolen variable. If it is set to false the iteration over the row can - * be interrupted. - * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. * \param function is an instance of the lambda function to be called in each row. @@ -676,10 +670,8 @@ class MultidiagonalMatrixView : public MatrixView< Real, Device, Index > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -693,10 +685,8 @@ class MultidiagonalMatrixView : public MatrixView< Real, Device, Index > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. diff --git a/src/TNL/Matrices/MultidiagonalMatrixView.hpp b/src/TNL/Matrices/MultidiagonalMatrixView.hpp index 7621f16787363ab5e7ad2b0fcba1367b9bbd7904..550158e4d458261e65d89fb5bd5d4018f4eb9a32 100644 --- a/src/TNL/Matrices/MultidiagonalMatrixView.hpp +++ b/src/TNL/Matrices/MultidiagonalMatrixView.hpp @@ -216,7 +216,7 @@ setValue( const RealType& v ) // we dont do this->values = v here because it would set even elements 'outside' the matrix // method getNumberOfNonzeroElements would not work well then const RealType newValue = v; - auto f = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType columnIdx, RealType& value, bool& compute ) mutable { + auto f = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType columnIdx, RealType& value ) mutable { value = newValue; }; this->forAllElements( f ); @@ -443,13 +443,12 @@ forElements( IndexType first, IndexType last, Function& function ) const const IndexType diagonalsCount = this->diagonalsOffsets.getSize(); const IndexType columns = this->getColumns(); const auto indexer = this->indexer; - bool compute( true ); auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable { for( IndexType localIdx = 0; localIdx < diagonalsCount; localIdx++ ) { const IndexType columnIdx = rowIdx + diagonalsOffsets_view[ localIdx ]; if( columnIdx >= 0 && columnIdx < columns ) - function( rowIdx, localIdx, columnIdx, values_view[ indexer.getGlobalIndex( rowIdx, localIdx ) ], compute ); + function( rowIdx, localIdx, columnIdx, values_view[ indexer.getGlobalIndex( rowIdx, localIdx ) ] ); } }; Algorithms::ParallelFor< DeviceType >::exec( first, last, f ); @@ -469,13 +468,12 @@ forElements( IndexType first, IndexType last, Function& function ) const IndexType diagonalsCount = this->diagonalsOffsets.getSize(); const IndexType columns = this->getColumns(); const auto indexer = this->indexer; - bool compute( true ); auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable { - for( IndexType localIdx = 0; localIdx < diagonalsCount && compute; localIdx++ ) + for( IndexType localIdx = 0; localIdx < diagonalsCount; localIdx++ ) { const IndexType columnIdx = rowIdx + diagonalsOffsets_view[ localIdx ]; if( columnIdx >= 0 && columnIdx < columns ) - function( rowIdx, localIdx, columnIdx, values_view[ indexer.getGlobalIndex( rowIdx, localIdx ) ], compute ); + function( rowIdx, localIdx, columnIdx, values_view[ indexer.getGlobalIndex( rowIdx, localIdx ) ] ); } }; Algorithms::ParallelFor< DeviceType >::exec( first, last, f ); diff --git a/src/TNL/Matrices/SparseMatrix.h b/src/TNL/Matrices/SparseMatrix.h index 237417d66aa903b176b1e502a7f92cec99c81049..ef7fe058039ee96606d38c921e42477368e035ec 100644 --- a/src/TNL/Matrices/SparseMatrix.h +++ b/src/TNL/Matrices/SparseMatrix.h @@ -724,12 +724,10 @@ class SparseMatrix : public Matrix< Real, Device, Index, RealAllocator > * The lambda function `function` should be declared like follows: * * ``` - * auto function = [] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value, bool& compute ) { ... }; + * auto function = [] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) { ... }; * ``` * * The \e localIdx parameter is a rank of the non-zero element in given row. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \par Example * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp @@ -751,12 +749,10 @@ class SparseMatrix : public Matrix< Real, Device, Index, RealAllocator > * The lambda function `function` should be declared like follows: * * ``` - * auto function = [] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value, bool& compute ) mutable { ... } + * auto function = [] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) mutable { ... } * ``` * * The \e localIdx parameter is a rank of the non-zero element in given row. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \par Example * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp @@ -903,10 +899,8 @@ class SparseMatrix : public Matrix< Real, Device, Index, RealAllocator > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -920,10 +914,8 @@ class SparseMatrix : public Matrix< Real, Device, Index, RealAllocator > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. diff --git a/src/TNL/Matrices/SparseMatrix.hpp b/src/TNL/Matrices/SparseMatrix.hpp index 08e55190f4e1ba9ff6a538cfb3e9afb45f78aae2..40c568b4dfe1ae211a7ee9961718f16d037c2756 100644 --- a/src/TNL/Matrices/SparseMatrix.hpp +++ b/src/TNL/Matrices/SparseMatrix.hpp @@ -890,7 +890,7 @@ operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocato if( std::is_same< DeviceType, RHSDeviceType >::value ) { const auto segments_view = this->segments.getView(); - auto f = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIdx, const RHSRealType& value, bool& compute ) mutable { + auto f = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIdx, const RHSRealType& value ) mutable { if( value != 0.0 ) { IndexType thisGlobalIdx = segments_view.getGlobalIndex( rowIdx, rowLocalIndexes_view[ rowIdx ]++ ); @@ -921,7 +921,7 @@ operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocato //// // Copy matrix elements into buffer - auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value, bool& compute ) mutable { + auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value ) mutable { const IndexType bufferIdx = ( rowIdx - baseRow ) * maxRowLength + localIdx; matrixValuesBuffer_view[ bufferIdx ] = value; }; @@ -935,7 +935,7 @@ operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocato // Copy matrix elements from the buffer to the matrix and ignoring // zero matrix elements. const IndexType matrix_columns = this->getColumns(); - auto f2 = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType& columnIndex, RealType& value, bool& compute ) mutable { + auto f2 = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType& columnIndex, RealType& value ) mutable { RealType inValue( 0.0 ); IndexType bufferIdx, column( rowLocalIndexes_view[ rowIdx ] ); while( inValue == 0.0 && column < matrix_columns ) @@ -1001,7 +1001,7 @@ operator=( const RHSMatrix& matrix ) if( std::is_same< DeviceType, RHSDeviceType >::value ) { const auto segments_view = this->segments.getView(); - auto f = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx_, RHSIndexType columnIndex, const RHSRealType& value, bool& compute ) mutable { + auto f = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx_, RHSIndexType columnIndex, const RHSRealType& value ) mutable { IndexType localIdx( rowLocalIndexes_view[ rowIdx ] ); if( value != 0.0 && columnIndex != paddingIndex ) { @@ -1043,7 +1043,7 @@ operator=( const RHSMatrix& matrix ) //// // Copy matrix elements into buffer - auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value, bool& compute ) mutable { + auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value ) mutable { if( columnIndex != paddingIndex ) { TNL_ASSERT_LT( rowIdx - baseRow, bufferRowsCount, "" ); @@ -1066,7 +1066,7 @@ operator=( const RHSMatrix& matrix ) // zero matrix elements //const IndexType matrix_columns = this->getColumns(); const auto thisRowLengths_view = thisRowLengths.getConstView(); - auto f2 = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType& columnIndex, RealType& value, bool& compute ) mutable { + auto f2 = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType& columnIndex, RealType& value ) mutable { RealType inValue( 0.0 ); size_t bufferIdx; IndexType bufferLocalIdx( rowLocalIndexes_view[ rowIdx ] ); diff --git a/src/TNL/Matrices/SparseMatrixView.h b/src/TNL/Matrices/SparseMatrixView.h index 40a89b628a4d0474f811dfb16ae62d05407d5302..10310d8023ea5c2aea035c79022e49782be6ae74 100644 --- a/src/TNL/Matrices/SparseMatrixView.h +++ b/src/TNL/Matrices/SparseMatrixView.h @@ -508,10 +508,8 @@ class SparseMatrixView : public MatrixView< Real, Device, Index > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )`. * The \e localIdx parameter is a rank of the non-zero element in given row. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -530,10 +528,8 @@ class SparseMatrixView : public MatrixView< Real, Device, Index > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )`. * The \e localIdx parameter is a rank of the non-zero element in given row. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -685,10 +681,8 @@ class SparseMatrixView : public MatrixView< Real, Device, Index > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -702,10 +696,8 @@ class SparseMatrixView : public MatrixView< Real, Device, Index > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. diff --git a/src/TNL/Matrices/SparseMatrixView.hpp b/src/TNL/Matrices/SparseMatrixView.hpp index 5df969867fd2c2a85164b982ec35c4e11d336afe..72377f8478ab73443383899d7fc7371965d2b458 100644 --- a/src/TNL/Matrices/SparseMatrixView.hpp +++ b/src/TNL/Matrices/SparseMatrixView.hpp @@ -594,11 +594,11 @@ forElements( IndexType begin, IndexType end, Function& function ) const const auto columns_view = this->columnIndexes.getConstView(); const auto values_view = this->values.getConstView(); //const IndexType paddingIndex_ = this->getPaddingIndex(); - auto f = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType globalIdx, bool& compute ) mutable -> bool { + auto f = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType globalIdx ) mutable -> bool { if( isBinary() ) - function( rowIdx, localIdx, columns_view[ globalIdx ], 1, compute ); + function( rowIdx, localIdx, columns_view[ globalIdx ], 1 ); else - function( rowIdx, localIdx, columns_view[ globalIdx ], values_view[ globalIdx ], compute ); + function( rowIdx, localIdx, columns_view[ globalIdx ], values_view[ globalIdx ] ); return true; }; this->segments.forElements( begin, end, f ); @@ -618,14 +618,14 @@ forElements( IndexType begin, IndexType end, Function& function ) auto columns_view = this->columnIndexes.getView(); auto values_view = this->values.getView(); const IndexType paddingIndex_ = this->getPaddingIndex(); - auto f = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType globalIdx, bool& compute ) mutable { + auto f = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType globalIdx ) mutable { if( isBinary() ) { RealType one( columns_view[ globalIdx ] != paddingIndex_ ); - function( rowIdx, localIdx, columns_view[ globalIdx ], one, compute ); + function( rowIdx, localIdx, columns_view[ globalIdx ], one ); } else - function( rowIdx, localIdx, columns_view[ globalIdx ], values_view[ globalIdx ], compute ); + function( rowIdx, localIdx, columns_view[ globalIdx ], values_view[ globalIdx ] ); }; this->segments.forElements( begin, end, f ); } diff --git a/src/TNL/Matrices/TridiagonalMatrix.h b/src/TNL/Matrices/TridiagonalMatrix.h index b74e0dcb9d8e3d609c593a40f3ac5986f3dd8ea5..4789a079f0dc469a656b5eb7e371bf024d2ff4f7 100644 --- a/src/TNL/Matrices/TridiagonalMatrix.h +++ b/src/TNL/Matrices/TridiagonalMatrix.h @@ -610,10 +610,8 @@ class TridiagonalMatrix : public Matrix< Real, Device, Index, RealAllocator > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )`. * The \e localIdx parameter is a rank of the non-zero element in given row. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -632,10 +630,8 @@ class TridiagonalMatrix : public Matrix< Real, Device, Index, RealAllocator > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )`. * The \e localIdx parameter is a rank of the non-zero element in given row. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -654,10 +650,8 @@ class TridiagonalMatrix : public Matrix< Real, Device, Index, RealAllocator > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )`. * The \e localIdx parameter is a rank of the non-zero element in given row. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -676,10 +670,8 @@ class TridiagonalMatrix : public Matrix< Real, Device, Index, RealAllocator > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )`. * The \e localIdx parameter is a rank of the non-zero element in given row. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -798,10 +790,8 @@ class TridiagonalMatrix : public Matrix< Real, Device, Index, RealAllocator > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -815,10 +805,8 @@ class TridiagonalMatrix : public Matrix< Real, Device, Index, RealAllocator > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. diff --git a/src/TNL/Matrices/TridiagonalMatrix.hpp b/src/TNL/Matrices/TridiagonalMatrix.hpp index a76ae3ef92484eb6ec0d48cc872d1d9fbb476d91..93ebcd8b39e68ba0f70079497a8b3cb64d5e5e43 100644 --- a/src/TNL/Matrices/TridiagonalMatrix.hpp +++ b/src/TNL/Matrices/TridiagonalMatrix.hpp @@ -717,7 +717,7 @@ operator=( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealA if( std::is_same< Device, Device_ >::value ) { const auto matrix_view = matrix.getView(); - auto f = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value, bool& compute ) mutable { + auto f = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable { value = matrix_view.getValues()[ matrix_view.getIndexer().getGlobalIndex( rowIdx, localIdx ) ]; }; this->forAllElements( f ); @@ -727,7 +727,7 @@ operator=( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealA TridiagonalMatrix< Real, Device, Index, Organization_ > auxMatrix; auxMatrix = matrix; const auto matrix_view = auxMatrix.getView(); - auto f = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value, bool& compute ) mutable { + auto f = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable { value = matrix_view.getValues()[ matrix_view.getIndexer().getGlobalIndex( rowIdx, localIdx ) ]; }; this->forAllElements( f ); diff --git a/src/TNL/Matrices/TridiagonalMatrixView.h b/src/TNL/Matrices/TridiagonalMatrixView.h index e05a8b05971b2fed4492a58b169474aec6dcdf78..6b68f419783328208caa9a07ed49e50c5a99eabd 100644 --- a/src/TNL/Matrices/TridiagonalMatrixView.h +++ b/src/TNL/Matrices/TridiagonalMatrixView.h @@ -463,10 +463,8 @@ class TridiagonalMatrixView : public MatrixView< Real, Device, Index > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )`. * The \e localIdx parameter is a rank of the non-zero element in given row. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -485,10 +483,8 @@ class TridiagonalMatrixView : public MatrixView< Real, Device, Index > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )`. * The \e localIdx parameter is a rank of the non-zero element in given row. - * If the 'compute' variable is set to false the iteration over the row can - * be interrupted. * * \param begin defines beginning of the range [begin,end) of rows to be processed. * \param end defines ending of the range [begin,end) of rows to be processed. @@ -639,7 +635,7 @@ class TridiagonalMatrixView : public MatrixView< Real, Device, Index > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. * If the 'compute' variable is set to false the iteration over the row can * be interrupted. @@ -656,7 +652,7 @@ class TridiagonalMatrixView : public MatrixView< Real, Device, Index > * * \tparam Function is type of lambda function that will operate on matrix elements. * It is should have form like - * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value, bool& compute )`. + * `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value )`. * The column index repeats twice only for compatibility with sparse matrices. * If the 'compute' variable is set to false the iteration over the row can * be interrupted. diff --git a/src/TNL/Matrices/TridiagonalMatrixView.hpp b/src/TNL/Matrices/TridiagonalMatrixView.hpp index 0ebad8cb64e627dcdc37549658c9b10fa3e6a68d..c67073381047ef8a282bae91fcb5e470f5a484d1 100644 --- a/src/TNL/Matrices/TridiagonalMatrixView.hpp +++ b/src/TNL/Matrices/TridiagonalMatrixView.hpp @@ -393,26 +393,25 @@ forElements( IndexType first, IndexType last, Function& function ) const { const auto values_view = this->values.getConstView(); const auto indexer = this->indexer; - bool compute( true ); auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable { if( rowIdx == 0 ) { - function( 0, 1, 0, values_view[ indexer.getGlobalIndex( 0, 1 ) ], compute ); - function( 0, 2, 1, values_view[ indexer.getGlobalIndex( 0, 2 ) ], compute ); + function( 0, 1, 0, values_view[ indexer.getGlobalIndex( 0, 1 ) ] ); + function( 0, 2, 1, values_view[ indexer.getGlobalIndex( 0, 2 ) ] ); } else if( rowIdx + 1 < indexer.getColumns() ) { - function( rowIdx, 0, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ], compute ); - function( rowIdx, 1, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ], compute ); - function( rowIdx, 2, rowIdx + 1, values_view[ indexer.getGlobalIndex( rowIdx, 2 ) ], compute ); + function( rowIdx, 0, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ); + function( rowIdx, 1, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ); + function( rowIdx, 2, rowIdx + 1, values_view[ indexer.getGlobalIndex( rowIdx, 2 ) ] ); } else if( rowIdx < indexer.getColumns() ) { - function( rowIdx, 0, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ], compute ); - function( rowIdx, 1, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ], compute ); + function( rowIdx, 0, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ); + function( rowIdx, 1, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ); } else - function( rowIdx, 0, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ], compute ); + function( rowIdx, 0, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ); }; Algorithms::ParallelFor< DeviceType >::exec( first, last, f ); } @@ -428,26 +427,25 @@ forElements( IndexType first, IndexType last, Function& function ) { auto values_view = this->values.getView(); const auto indexer = this->indexer; - bool compute( true ); auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable { if( rowIdx == 0 ) { - function( 0, 1, 0, values_view[ indexer.getGlobalIndex( 0, 1 ) ], compute ); - function( 0, 2, 1, values_view[ indexer.getGlobalIndex( 0, 2 ) ], compute ); + function( 0, 1, 0, values_view[ indexer.getGlobalIndex( 0, 1 ) ] ); + function( 0, 2, 1, values_view[ indexer.getGlobalIndex( 0, 2 ) ] ); } else if( rowIdx + 1 < indexer.getColumns() ) { - function( rowIdx, 0, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ], compute ); - function( rowIdx, 1, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ], compute ); - function( rowIdx, 2, rowIdx + 1, values_view[ indexer.getGlobalIndex( rowIdx, 2 ) ], compute ); + function( rowIdx, 0, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ); + function( rowIdx, 1, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ); + function( rowIdx, 2, rowIdx + 1, values_view[ indexer.getGlobalIndex( rowIdx, 2 ) ] ); } else if( rowIdx < indexer.getColumns() ) { - function( rowIdx, 0, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ], compute ); - function( rowIdx, 1, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ], compute ); + function( rowIdx, 0, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ); + function( rowIdx, 1, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ); } else - function( rowIdx, 0, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ], compute ); + function( rowIdx, 0, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ); }; Algorithms::ParallelFor< DeviceType >::exec( first, last, f ); } @@ -663,13 +661,13 @@ addMatrix( const TridiagonalMatrixView< Real_, Device_, Index_, Organization_ >& const auto matrix_view = matrix; const auto matrixMult = matrixMultiplicator; const auto thisMult = thisMatrixMultiplicator; - auto add0 = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value, bool& compute ) mutable { + auto add0 = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable { value = matrixMult * matrix.getValues()[ matrix.getIndexer().getGlobalIndex( rowIdx, localIdx ) ]; }; - auto add1 = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value, bool& compute ) mutable { + auto add1 = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable { value += matrixMult * matrix.getValues()[ matrix.getIndexer().getGlobalIndex( rowIdx, localIdx ) ]; }; - auto addGen = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value, bool& compute ) mutable { + auto addGen = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable { value = thisMult * value + matrixMult * matrix.getValues()[ matrix.getIndexer().getGlobalIndex( rowIdx, localIdx ) ]; }; if( thisMult == 0.0 ) diff --git a/src/UnitTests/Matrices/DenseMatrixTest.h b/src/UnitTests/Matrices/DenseMatrixTest.h index ceb7ae358855a35d3dba2848375a76f8994fe88b..9a5fee6e986552f766219bfcd58a5acef3a10e39 100644 --- a/src/UnitTests/Matrices/DenseMatrixTest.h +++ b/src/UnitTests/Matrices/DenseMatrixTest.h @@ -791,7 +791,7 @@ void test_ForElements() const IndexType rows = 8; Matrix m( rows, cols ); - m.forAllElements( [] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, const IndexType& columnIdx, RealType& value, bool compute ) mutable { + m.forAllElements( [] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, const IndexType& columnIdx, RealType& value ) mutable { value = rowIdx + 1.0; } ); diff --git a/src/UnitTests/Matrices/SparseMatrixTest.hpp b/src/UnitTests/Matrices/SparseMatrixTest.hpp index cca22d85740e03bdb0887e1181c9842c9748ad01..1716b0ab894d506fe8eed2f13eb29821cb2266cf 100644 --- a/src/UnitTests/Matrices/SparseMatrixTest.hpp +++ b/src/UnitTests/Matrices/SparseMatrixTest.hpp @@ -1050,7 +1050,7 @@ void test_ForElements() const IndexType rows = 8; Matrix m( { 3, 3, 3, 3, 3, 3, 3, 3, 3 }, cols ); - m.forAllElements( [] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType& columnIdx, RealType& value, bool compute ) mutable { + m.forAllElements( [] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType& columnIdx, RealType& value ) mutable { value = rowIdx + 1.0; columnIdx = localIdx; } ); diff --git a/src/UnitTests/Matrices/SparseMatrixVectorProductTest.hpp b/src/UnitTests/Matrices/SparseMatrixVectorProductTest.hpp index c3f8a39dbb6a315d7093eb5f0fb3f56dacdb646d..d39593e232c47383f86581eb887278e534ddeb17 100644 --- a/src/UnitTests/Matrices/SparseMatrixVectorProductTest.hpp +++ b/src/UnitTests/Matrices/SparseMatrixVectorProductTest.hpp @@ -365,7 +365,7 @@ void test_VectorProduct_largeMatrix() TNL::Containers::Vector< IndexType, DeviceType, IndexType > rowCapacities( size ); rowCapacities.forAllElements( [] __cuda_callable__ ( IndexType i, IndexType& value ) { value = 1; } ); m1.setRowCapacities( rowCapacities ); - auto f1 = [=] __cuda_callable__ ( IndexType row, IndexType localIdx, IndexType& column, RealType& value, bool& compute ) { + auto f1 = [=] __cuda_callable__ ( IndexType row, IndexType localIdx, IndexType& column, RealType& value ) { if( localIdx == 0 ) { value = row + 1; @@ -389,7 +389,7 @@ void test_VectorProduct_largeMatrix() rowCapacities.setSize( rows ); rowCapacities.forAllElements( [=] __cuda_callable__ ( IndexType i, IndexType& value ) { value = i + 1; } ); m2.setRowCapacities( rowCapacities ); - auto f2 = [=] __cuda_callable__ ( IndexType row, IndexType localIdx, IndexType& column, RealType& value, bool& compute ) { + auto f2 = [=] __cuda_callable__ ( IndexType row, IndexType localIdx, IndexType& column, RealType& value ) { if( localIdx <= row ) { value = localIdx + 1; @@ -436,7 +436,7 @@ void test_VectorProduct_longRowsMatrix() TNL::Containers::Vector< IndexType, DeviceType, IndexType > rowsCapacities( rows ); rowsCapacities = columns; m3.setRowCapacities( rowsCapacities ); - auto f = [] __cuda_callable__ ( IndexType row, IndexType localIdx, IndexType& column, RealType& value, bool& compute ) { + auto f = [] __cuda_callable__ ( IndexType row, IndexType localIdx, IndexType& column, RealType& value ) { column = localIdx; value = localIdx + row; };