Skip to content
Snippets Groups Projects
Commit 65e1cc9e authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Fixed ILU preconditioners for distributed matrices

parent 863a4f69
No related branches found
No related tags found
1 merge request!82MPI refactoring
...@@ -96,9 +96,6 @@ solve( ConstVectorViewType b, VectorViewType x ) const ...@@ -96,9 +96,6 @@ solve( ConstVectorViewType b, VectorViewType x ) const
const auto b_view = b.getConstLocalView(); const auto b_view = b.getConstLocalView();
auto x_view = x.getLocalView(); auto x_view = x.getLocalView();
// wait for pending synchronization
b.waitForSynchronization();
// compute without ghosts (diagonal includes only local rows) // compute without ghosts (diagonal includes only local rows)
x_view = b_view / diag_view; x_view = b_view / diag_view;
......
...@@ -90,7 +90,12 @@ protected: ...@@ -90,7 +90,12 @@ protected:
template< typename M > template< typename M >
static IndexType getMinColumn( const Matrices::DistributedMatrix< M >& m ) static IndexType getMinColumn( const Matrices::DistributedMatrix< M >& m )
{ {
return m.getLocalRowRange().getBegin(); if( m.getRows() == m.getColumns() )
// square matrix, assume global column indices
return m.getLocalRowRange().getBegin();
else
// non-square matrix, assume ghost indexing
return 0;
} }
}; };
......
...@@ -145,6 +145,9 @@ solve( ConstVectorViewType _b, VectorViewType _x ) const ...@@ -145,6 +145,9 @@ solve( ConstVectorViewType _b, VectorViewType _x ) const
// Step 2: solve x from Ux = y // Step 2: solve x from Ux = y
triangularSolveUpper< true, true >( U, x, x ); triangularSolveUpper< true, true >( U, x, x );
// synchronize ghosts
Traits< Matrix >::startSynchronization( _x );
} }
......
...@@ -79,7 +79,12 @@ protected: ...@@ -79,7 +79,12 @@ protected:
template< typename M > template< typename M >
static IndexType getMinColumn( const Matrices::DistributedMatrix< M >& m ) static IndexType getMinColumn( const Matrices::DistributedMatrix< M >& m )
{ {
return m.getLocalRowRange().getBegin(); if( m.getRows() == m.getColumns() )
// square matrix, assume global column indices
return m.getLocalRowRange().getBegin();
else
// non-square matrix, assume ghost indexing
return 0;
} }
}; };
......
...@@ -272,6 +272,9 @@ solve( ConstVectorViewType _b, VectorViewType _x ) const ...@@ -272,6 +272,9 @@ solve( ConstVectorViewType _b, VectorViewType _x ) const
// Step 2: solve x from Ux = y // Step 2: solve x from Ux = y
triangularSolveUpper< true, false >( U, x, x ); triangularSolveUpper< true, false >( U, x, x );
// synchronize ghosts
Traits< Matrix >::startSynchronization( _x );
} }
} // namespace Preconditioners } // namespace Preconditioners
......
...@@ -52,6 +52,8 @@ struct Traits ...@@ -52,6 +52,8 @@ struct Traits
static LocalViewType getLocalView( VectorViewType v ) { return v; } static LocalViewType getLocalView( VectorViewType v ) { return v; }
static typename CommunicatorType::CommunicationGroup getCommunicationGroup( const Matrix& m ) { return CommunicatorType::AllGroup; } static typename CommunicatorType::CommunicationGroup getCommunicationGroup( const Matrix& m ) { return CommunicatorType::AllGroup; }
static void startSynchronization( VectorViewType v ) {}
static void waitForSynchronization( VectorViewType v ) {}
}; };
template< typename Matrix, typename Communicator > template< typename Matrix, typename Communicator >
...@@ -95,6 +97,8 @@ struct Traits< Matrices::DistributedMatrix< Matrix, Communicator > > ...@@ -95,6 +97,8 @@ struct Traits< Matrices::DistributedMatrix< Matrix, Communicator > >
static LocalViewType getLocalView( VectorViewType v ) { return v.getLocalView(); } static LocalViewType getLocalView( VectorViewType v ) { return v.getLocalView(); }
static typename CommunicatorType::CommunicationGroup getCommunicationGroup( const Matrices::DistributedMatrix< Matrix, Communicator >& m ) { return m.getCommunicationGroup(); } static typename CommunicatorType::CommunicationGroup getCommunicationGroup( const Matrices::DistributedMatrix< Matrix, Communicator >& m ) { return m.getCommunicationGroup(); }
static void startSynchronization( VectorViewType v ) { v.startSynchronization(); }
static void waitForSynchronization( VectorViewType v ) { v.waitForSynchronization(); }
}; };
} // namespace Linear } // namespace Linear
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment