Commit 645004c0 authored by Marcel Koch's avatar Marcel Koch
Browse files

use jacobi preconditioner in both cases

parent 861ab17e
Pipeline #33996 failed with stages
in 19 minutes and 14 seconds
......@@ -22,10 +22,12 @@
#include "ginkgo/core/factorization/par_ilu.hpp"
#include "ginkgo/core/factorization/par_ilut.hpp"
#include "ginkgo/core/log/convergence.hpp"
#include "ginkgo/core/log/record.hpp"
#include "ginkgo/core/log/stream.hpp"
#include "ginkgo/core/matrix/csr.hpp"
#include "ginkgo/core/matrix/dense.hpp"
#include "ginkgo/core/preconditioner/ilu.hpp"
#include "ginkgo/core/preconditioner/jacobi.hpp"
#include "ginkgo/core/solver/cg.hpp"
#include "ginkgo/core/stop/iteration.hpp"
#include "ginkgo/core/stop/residual_norm.hpp"
......@@ -297,6 +299,7 @@ class GinkgoCGSolver : public Solver< OperatorType >
{
auto rel_mode = constraints_type == constraints::penalty ? gko::stop::mode::initial_resnorm : gko::stop::mode::rhs_norm;
auto log_cout = gko::share( gko::log::Stream<valueType >::create( host_exec_, gko::log::Logger::criterion_check_completed_mask, std::cout, true ) );
auto log = gko::share( gko::log::Convergence< valueType >::create( solver_exec_ ) );
auto criteria = gko::stop::Combined::build()
.with_criteria( gko::stop::ResidualNorm< valueType >::build()
......@@ -309,7 +312,8 @@ class GinkgoCGSolver : public Solver< OperatorType >
.on( solver_exec_ ),
gko::stop::Iteration::build().with_max_iters( maxIterations ).on( solver_exec_ ) )
.on( solver_exec_ );
criteria->add_logger( gko::share( log ) );
criteria->add_logger( log );
//criteria->add_logger( log_cout );
solver_factory_ = gko::solver::Cg< valueType >::build().with_criteria( gko::share( criteria ) ).on( solver_exec_ );
}
......@@ -402,7 +406,8 @@ class GinkgoCGSolver : public Solver< OperatorType >
{
//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 ) );
auto jac = gko::preconditioner::Jacobi<valueType, int32_t>::build().on(solver_exec_)->generate(matrix_);
solver_->set_preconditioner( gko::share( jac ) );
}
x.getStorage()->getTimingTree()->stop( "Ginkgo CG Solver Set-Up" );
}
......
......@@ -116,7 +116,7 @@ class PETScCGSolver : public Solver< OperatorType >
}
KSPSetOperators( ksp, Amat.get(), Amat.get() );
KSPGetPC( ksp, &pc );
PCSetType( pc, PCNONE );
PCSetType( pc, PCJACOBI );
KSPSolve( ksp, bVec.get(), xVec.get() );
......
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