Commit 6e443c35 authored by Marcel Koch's avatar Marcel Koch
Browse files

fix permutation of gathered matrix

parent f5e758b9
......@@ -147,6 +147,8 @@ class GinkgoBlockSolver : public Solver< OperatorType >
std::vector< int32_t > pIndices;
gatherIndices( vIndices, pIndices, *storage_, level, num_ );
std::sort( vIndices.begin(), vIndices.end() );
std::sort( pIndices.begin(), pIndices.end() );
std::vector< int32_t > perm_vec;
......@@ -179,11 +181,11 @@ class GinkgoBlockSolver : public Solver< OperatorType >
monolithic_matrix_ = gko::share( csr::create( solver_exec_ ) );
gko::as< mtx >( host_monolithic_matrix_ )->convert_to( monolithic_matrix_.get() );
gko::Array< gko::int32 > perm{ solver_exec_, perm_vec.begin(), perm_vec.end() };
if ( monolithic_matrix_->get_size() )
if ( comm_->size() > 1 && monolithic_matrix_->get_size() )
{
monolithic_matrix_->permute( &perm );
monolithic_matrix_ = gko::as< csr >( monolithic_matrix_->permute( &perm ) );
monolithic_matrix_->sort_by_column_index();
}
{
......@@ -249,10 +251,17 @@ class GinkgoBlockSolver : public Solver< OperatorType >
if ( monolithic_matrix_->get_size() )
{
global_rhs->row_permute( &perm );
global_x0->row_permute( &perm );
solver_->apply( gko::lend( global_rhs ), gko::lend( global_x0 ) );
global_x0->inverse_row_permute( &perm );
if ( comm_->size() > 1 )
{
auto permuted_global_rhs = gko::as< dense >( global_rhs->row_permute( &perm ) );
auto permuted_global_x0 = gko::as< dense >( global_x0->row_permute( &perm ) );
solver_->apply( gko::lend( permuted_global_rhs ), gko::lend( permuted_global_x0 ) );
permuted_global_x0->inverse_row_permute( &perm, global_x0.get() );
}
else
{
solver_->apply( gko::lend( global_rhs ), gko::lend( global_x0 ) );
}
}
gather_idxs_ = compute_gather_idxs( part_ );
scatter_global_vector( global_x0.get(), x0, gather_idxs_, comm_ );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment