Commit ab0ac669 authored by Marcel Koch's avatar Marcel Koch
Browse files

handle empty matrices (after convert) correctly

parent 1e79716b
......@@ -397,19 +397,29 @@ class GinkgoCGSolver : public Solver< OperatorType >
matrix_ = csr::create( solver_exec_ );
host_matrix_->convert_to( gko::lend( matrix_ ) );
//auto par_ilu = gko::factorization::Ilu< valueType, int32_t >::build().on( solver_exec_ )->generate( matrix_ );
//auto ilu = gko::preconditioner::Ilu<>::build().on( solver_exec_ )->generate( gko::share( par_ilu ) );
solver_ = solver_factory_->generate( matrix_ );
//solver_->set_preconditioner( gko::share( ilu ) );
if ( matrix_->get_size()[0] > 0 && matrix_->get_size()[1] > 0 )
{
//auto par_ilu = gko::factorization::Ilu< valueType, int32_t >::build().on( solver_exec_ )->generate( matrix_ );
auto ilu = gko::preconditioner::Ilu<>::build().on( solver_exec_ )->generate( matrix_ );
solver_->set_preconditioner( gko::share( ilu ) );
}
x.getStorage()->getTimingTree()->stop( "Ginkgo CG Solver Set-Up" );
}
auto global_rhs = dense::create( solver_exec_ );
auto global_x0 = dense::create( solver_exec_ );
auto global_rhs = dense::create( host_exec_ );
auto global_x0 = dense::create( host_exec_ );
rhs->convert_to( gko::lend( global_rhs ) );
x0->convert_to( gko::lend( global_x0 ) );
x.getStorage()->getTimingTree()->start( "Ginkgo CG Solver Apply" );
solver_->apply( gko::lend( global_rhs ), gko::lend( global_x0 ) );
if ( matrix_->get_size()[0] > 0 && matrix_->get_size()[1] > 0 )
{
solver_->apply( gko::lend( global_rhs ), gko::lend( global_x0 ) );
}
else
{
global_x0 = dense::create( host_exec_, x0->get_size() );
}
x.getStorage()->getTimingTree()->stop( "Ginkgo CG Solver Apply" );
gko::mpi::broadcast( global_x0->get_values(), global_x0->get_num_stored_elements(), 0, 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