Skip to content
Snippets Groups Projects
Commit 219abe6c authored by Tomáš Oberhuber's avatar Tomáš Oberhuber Committed by Jakub Klinkovský
Browse files

Removing boolean variable compute from forElements.

parent 6ca4d125
No related branches found
No related tags found
1 merge request!105TO/matrices-adaptive-csr
Showing
with 28 additions and 44 deletions
......@@ -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;
} );
......
......@@ -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;
} );
......
......@@ -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;
} );
......
......@@ -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;
};
......
......@@ -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;
};
......
......@@ -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;
};
......
......@@ -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;
};
......
......@@ -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 );
};
......
......@@ -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 );
};
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment