35#if defined(MFEM_USE_CUDA) || defined(MFEM_USE_HIP)
36 gko::version_info gko_version = gko::version_info::get();
37 bool gko_with_omp_support = (strcmp(gko_version.omp_version.tag,
38 "not compiled") != 0);
44 executor = gko::ReferenceExecutor::create();
49 executor = gko::OmpExecutor::create();
54 if (gko::CudaExecutor::get_num_devices() > 0)
57 int current_device = 0;
58 MFEM_GPU_CHECK(cudaGetDevice(¤t_device));
59 if (gko_with_omp_support)
61 executor = gko::CudaExecutor::create(current_device,
62 gko::OmpExecutor::create());
66 executor = gko::CudaExecutor::create(current_device,
67 gko::ReferenceExecutor::create());
73 MFEM_ABORT(
"gko::CudaExecutor::get_num_devices() did not report "
74 "any valid devices.");
80 if (gko::HipExecutor::get_num_devices() > 0)
83 int current_device = 0;
84 MFEM_GPU_CHECK(hipGetDevice(¤t_device));
85 if (gko_with_omp_support)
87 executor = gko::HipExecutor::create(current_device,
88 gko::OmpExecutor::create());
92 executor = gko::HipExecutor::create(current_device,
93 gko::ReferenceExecutor::create());
99 MFEM_ABORT(
"gko::HipExecutor::get_num_devices() did not report "
100 "any valid devices.");
105 MFEM_ABORT(
"Invalid ExecType specified");
117 MFEM_WARNING(
"Parameter host_exec_type ignored for CPU GinkgoExecutor.");
118 executor = gko::ReferenceExecutor::create();
123 MFEM_WARNING(
"Parameter host_exec_type ignored for CPU GinkgoExecutor.");
124 executor = gko::OmpExecutor::create();
129 if (gko::CudaExecutor::get_num_devices() > 0)
132 int current_device = 0;
133 MFEM_GPU_CHECK(cudaGetDevice(¤t_device));
136 executor = gko::CudaExecutor::create(current_device,
137 gko::OmpExecutor::create());
141 executor = gko::CudaExecutor::create(current_device,
142 gko::ReferenceExecutor::create());
148 MFEM_ABORT(
"gko::CudaExecutor::get_num_devices() did not report "
149 "any valid devices.");
155 if (gko::HipExecutor::get_num_devices() > 0)
158 int current_device = 0;
159 MFEM_GPU_CHECK(hipGetDevice(¤t_device));
162 executor = gko::HipExecutor::create(current_device,
163 gko::OmpExecutor::create());
167 executor = gko::HipExecutor::create(current_device,
168 gko::ReferenceExecutor::create());
174 MFEM_ABORT(
"gko::HipExecutor::get_num_devices() did not report "
175 "any valid devices.");
180 MFEM_ABORT(
"Invalid ExecType specified");
187 gko::version_info gko_version = gko::version_info::get();
188 bool gko_with_omp_support = (strcmp(gko_version.omp_version.tag,
189 "not compiled") != 0);
192 if (gko::CudaExecutor::get_num_devices() > 0)
195 int current_device = 0;
196 MFEM_GPU_CHECK(cudaGetDevice(¤t_device));
197 if (gko_with_omp_support)
199 executor = gko::CudaExecutor::create(current_device,
200 gko::OmpExecutor::create());
204 executor = gko::CudaExecutor::create(current_device,
205 gko::ReferenceExecutor::create());
211 MFEM_ABORT(
"gko::CudaExecutor::get_num_devices() did not report "
212 "any valid devices.");
217 if (gko::HipExecutor::get_num_devices() > 0)
220 int current_device = 0;
221 MFEM_GPU_CHECK(hipGetDevice(¤t_device));
222 if (gko_with_omp_support)
224 executor = gko::HipExecutor::create(current_device,
225 gko::OmpExecutor::create());
229 executor = gko::HipExecutor::create(current_device,
230 gko::ReferenceExecutor::create());
236 MFEM_ABORT(
"gko::HipExecutor::get_num_devices() did not report "
237 "any valid devices.");
245 if (gko_with_omp_support)
247 executor = gko::OmpExecutor::create();
251 executor = gko::ReferenceExecutor::create();
256 executor = gko::ReferenceExecutor::create();
269 if (gko::CudaExecutor::get_num_devices() > 0)
272 int current_device = 0;
273 MFEM_GPU_CHECK(cudaGetDevice(¤t_device));
276 executor = gko::CudaExecutor::create(current_device,
277 gko::OmpExecutor::create());
281 executor = gko::CudaExecutor::create(current_device,
282 gko::ReferenceExecutor::create());
288 MFEM_ABORT(
"gko::CudaExecutor::get_num_devices() did not report "
289 "any valid devices.");
294 if (gko::HipExecutor::get_num_devices() > 0)
297 int current_device = 0;
298 MFEM_GPU_CHECK(hipGetDevice(¤t_device));
301 executor = gko::HipExecutor::create(current_device,
302 gko::OmpExecutor::create());
306 executor = gko::HipExecutor::create(current_device,
307 gko::ReferenceExecutor::create());
313 MFEM_ABORT(
"gko::HipExecutor::get_num_devices() did not report "
314 "any valid devices.");
319 MFEM_WARNING(
"Parameter host_exec_type ignored for CPU GinkgoExecutor.");
323 gko::version_info gko_version = gko::version_info::get();
324 bool gko_with_omp_support = (strcmp(gko_version.omp_version.tag,
325 "not compiled") != 0);
326 if (gko_with_omp_support)
328 executor = gko::OmpExecutor::create();
332 executor = gko::ReferenceExecutor::create();
337 executor = gko::ReferenceExecutor::create();
343 bool use_implicit_res_norm)
345 use_implicit_res_norm(use_implicit_res_norm)
362 using ResidualCriterionFactory = gko::stop::ResidualNorm<>;
363 using ImplicitResidualCriterionFactory = gko::stop::ImplicitResidualNorm<>;
368 .with_reduction_factor(sqrt(
rel_tol))
369 .with_baseline(gko::stop::mode::initial_resnorm)
372 .with_reduction_factor(sqrt(
abs_tol))
373 .with_baseline(gko::stop::mode::absolute)
376 gko::stop::Combined::build()
379 gko::stop::Iteration::build()
380 .with_max_iters(
static_cast<unsigned long>(
max_iter))
387 .with_reduction_factor(
rel_tol)
388 .with_baseline(gko::stop::mode::initial_resnorm)
391 .with_reduction_factor(
abs_tol)
392 .with_baseline(gko::stop::mode::absolute)
395 gko::stop::Combined::build()
398 gko::stop::Iteration::build()
399 .with_max_iters(
static_cast<unsigned long>(
max_iter))
406GinkgoIterativeSolver::initialize_ginkgo_log(gko::matrix::Dense<real_t>*
b)
411#if MFEM_GINKGO_VERSION < 10500
413 executor, gko::log::Logger::criterion_check_completed_mask);
416 gko::log::Logger::criterion_check_completed_mask);
419 system_oper.get(),
b);
435 const gko::LinOp *
beta,
444 if (
alpha->get_size()[0] > 1 ||
alpha->get_size()[1] > 1)
446 throw gko::BadDimension(
447 __FILE__, __LINE__, __func__,
"alpha",
alpha->get_size()[0],
448 alpha->get_size()[1],
449 "Expected an object of size [1 x 1] for scaling "
450 " in this operator's apply_impl");
452 if (
beta->get_size()[0] > 1 ||
beta->get_size()[1] > 1)
454 throw gko::BadDimension(
455 __FILE__, __LINE__, __func__,
"beta",
beta->get_size()[0],
457 "Expected an object of size [1 x 1] for scaling "
458 " in this operator's apply_impl");
463 if (
alpha->get_executor() ==
alpha->get_executor()->get_master())
466 alpha_f = gko::as<gko::matrix::Dense<real_t>>(
alpha)->at(0, 0);
471 this->get_executor()->get_master().get()->copy_from(
472 this->get_executor().get(),
473 1, gko::as<gko::matrix::Dense<real_t>>(
alpha)->get_const_values(),
476 if (
beta->get_executor() ==
beta->get_executor()->get_master())
479 beta_f = gko::as<gko::matrix::Dense<real_t>>(
beta)->at(0, 0);
484 this->get_executor()->get_master().get()->copy_from(
485 this->get_executor().get(),
486 1, gko::as<gko::matrix::Dense<real_t>>(
beta)->get_const_values(),
511 MFEM_VERIFY(system_oper,
"System matrix or operator not initialized");
512 MFEM_VERIFY(
executor,
"executor is not initialized");
514 "Mismatching sizes for rhs and solution");
516 using vec = gko::matrix::Dense<real_t>;
524 bool on_device =
false;
529 std::unique_ptr<vec> gko_x;
530 std::unique_ptr<vec> gko_y;
540 x.
Read(on_device))), 1);
548 gko_x = std::unique_ptr<vec>(
550 const_cast<Vector *
>(&x),
false));
551 gko_y = std::unique_ptr<vec>(
558 initialize_ginkgo_log(gko_x.get());
574#if MFEM_GINKGO_VERSION < 10600
575 solver->apply(gko::lend(gko_x), gko::lend(gko_y));
577 solver->apply(gko_x, gko_y);
584 real_t final_res_norm = 0.0;
597 auto imp_residual_norm_d =
598 gko::as<gko::matrix::Dense<real_t>>(imp_residual_norm);
599 auto imp_residual_norm_d_master =
600 gko::matrix::Dense<real_t>::create(
executor->get_master(),
602 imp_residual_norm_d_master->copy_from(imp_residual_norm_d);
604 final_res_norm = imp_residual_norm_d_master->at(0,0);
608 auto residual_norm_d =
609 gko::as<gko::matrix::Dense<real_t>>(residual_norm);
610 auto residual_norm_d_master =
611 gko::matrix::Dense<real_t>::create(
executor->get_master(),
613 residual_norm_d_master->copy_from(residual_norm_d);
615 final_res_norm = residual_norm_d_master->at(0,0);
635 " iterations with final residual norm "
636 << final_res_norm <<
'\n';
666 "System matrix is not square");
668 bool on_device =
false;
674 using mtx = gko::matrix::Csr<real_t, int>;
676 system_oper = mtx::create(
691 system_oper = std::shared_ptr<OperatorWrapper>(
707 using cg = gko::solver::Cg<real_t>;
716 using cg = gko::solver::Cg<real_t>;
722 .with_generated_preconditioner(
726 GetGeneratedPreconditioner().get()))
736 .with_preconditioner(preconditioner.
GetFactory())
746 using bicgstab = gko::solver::Bicgstab<real_t>;
756 using bicgstab = gko::solver::Bicgstab<real_t>;
761 .with_generated_preconditioner(
765 GetGeneratedPreconditioner().get()))
775 .with_preconditioner(preconditioner.
GetFactory())
785 using cgs = gko::solver::Cgs<real_t>;
794 using cgs = gko::solver::Cgs<real_t>;
799 .with_generated_preconditioner(
803 GetGeneratedPreconditioner().get()))
813 .with_preconditioner(preconditioner.
GetFactory())
823 using fcg = gko::solver::Fcg<real_t>;
832 using fcg = gko::solver::Fcg<real_t>;
837 .with_generated_preconditioner(
841 GetGeneratedPreconditioner().get()))
851 .with_preconditioner(preconditioner.
GetFactory())
862 using gmres = gko::solver::Gmres<real_t>;
872 .with_krylov_dim(
static_cast<unsigned long>(
m))
883 using gmres = gko::solver::Gmres<real_t>;
891 .with_generated_preconditioner(
895 GetGeneratedPreconditioner().get()))
905 .with_preconditioner(preconditioner.
GetFactory())
914 .with_krylov_dim(
static_cast<unsigned long>(
m))
916 .with_generated_preconditioner(
920 GetGeneratedPreconditioner().get()))
929 .with_krylov_dim(
static_cast<unsigned long>(
m))
931 .with_preconditioner(preconditioner.
GetFactory())
940 using gmres = gko::solver::Gmres<real_t>;
942 auto current_params = gko::as<gmres::Factory>(
solver_gen)->get_parameters();
943 this->
solver_gen = current_params.with_krylov_dim(
static_cast<unsigned long>(
m))
947 gko::as<gmres>(
solver)->set_krylov_dim(
static_cast<unsigned long>(
m));
953 storage_precision prec)
957 using gmres = gko::solver::CbGmres<real_t>;
962 .with_storage_precision(prec)
968 .with_krylov_dim(
static_cast<unsigned long>(
m))
970 .with_storage_precision(prec)
977 int dim, storage_precision prec)
981 using gmres = gko::solver::CbGmres<real_t>;
989 .with_storage_precision(prec)
990 .with_generated_preconditioner(
994 GetGeneratedPreconditioner().get()))
1004 .with_storage_precision(prec)
1005 .with_preconditioner(preconditioner.
GetFactory())
1006 .on(this->executor);
1014 .with_krylov_dim(
static_cast<unsigned long>(
m))
1016 .with_storage_precision(prec)
1017 .with_generated_preconditioner(
1019 .on(this->executor);
1021 GetGeneratedPreconditioner().get()))
1030 .with_krylov_dim(
static_cast<unsigned long>(
m))
1032 .with_storage_precision(prec)
1033 .with_preconditioner(preconditioner.
GetFactory())
1034 .on(this->executor);
1042 using gmres = gko::solver::CbGmres<real_t>;
1044 auto current_params = gko::as<gmres::Factory>(
solver_gen)->get_parameters();
1045 this->
solver_gen = current_params.with_krylov_dim(
static_cast<unsigned long>(
m))
1046 .on(this->executor);
1049 gko::as<gmres>(
solver)->set_krylov_dim(
static_cast<unsigned long>(
m));
1057 using ir = gko::solver::Ir<real_t>;
1066 using ir = gko::solver::Ir<real_t>;
1070 .on(this->executor);
1093 MFEM_VERIFY(
executor,
"executor is not initialized");
1095 using vec = gko::matrix::Dense<real_t>;
1103 bool on_device =
false;
1108 auto gko_x = vec::create(
executor, gko::dim<2>(x.
Size(), 1),
1111 x.
Read(on_device))), 1);
1112 auto gko_y = vec::create(
executor, gko::dim<2>(y.
Size(), 1),
1116#if MFEM_GINKGO_VERSION < 10600
1135 MFEM_VERIFY(op_mat != NULL,
1136 "GinkgoPreconditioner::SetOperator : not a SparseMatrix!");
1138 bool on_device =
false;
1144 using mtx = gko::matrix::Csr<real_t, int>;
1146 auto gko_matrix = mtx::create(
1169 const std::string &storage_opt,
1171 const int max_block_size
1176 if (storage_opt ==
"auto")
1178 precond_gen = gko::preconditioner::Jacobi<real_t, int>::build()
1179 .with_storage_optimization(
1180 gko::precision_reduction::autodetect())
1181 .with_accuracy(accuracy)
1182 .with_max_block_size(
static_cast<unsigned int>(max_block_size))
1187 precond_gen = gko::preconditioner::Jacobi<real_t, int>::build()
1188 .with_storage_optimization(
1189 gko::precision_reduction(0, 0))
1190 .with_accuracy(accuracy)
1191 .with_max_block_size(
static_cast<unsigned int>(max_block_size))
1200 const std::string &factorization_type,
1202 const bool skip_sort
1206 if (factorization_type ==
"exact")
1208 using ilu_fact_type = gko::factorization::Ilu<real_t, int>;
1209 std::shared_ptr<ilu_fact_type::Factory> fact_factory =
1210 ilu_fact_type::build()
1211 .with_skip_sorting(skip_sort)
1214#if MFEM_GINKGO_VERSION < 10700
1215 .with_factorization_factory(fact_factory)
1217 .with_factorization(fact_factory)
1223 using ilu_fact_type = gko::factorization::ParIlu<real_t, int>;
1224 std::shared_ptr<ilu_fact_type::Factory> fact_factory =
1225 ilu_fact_type::build()
1226 .with_iterations(
static_cast<unsigned long>(sweeps))
1227 .with_skip_sorting(skip_sort)
1230#if MFEM_GINKGO_VERSION < 10700
1231 .with_factorization_factory(fact_factory)
1233 .with_factorization(fact_factory)
1242 const std::string &factorization_type,
1244 const int sparsity_power,
1245 const bool skip_sort
1249 using l_solver_type = gko::preconditioner::LowerIsai<>;
1250 using u_solver_type = gko::preconditioner::UpperIsai<>;
1252 std::shared_ptr<l_solver_type::Factory> l_solver_factory =
1253 l_solver_type::build()
1254 .with_sparsity_power(sparsity_power)
1256 std::shared_ptr<u_solver_type::Factory> u_solver_factory =
1257 u_solver_type::build()
1258 .with_sparsity_power(sparsity_power)
1263 if (factorization_type ==
"exact")
1265 using ilu_fact_type = gko::factorization::Ilu<real_t, int>;
1266 std::shared_ptr<ilu_fact_type::Factory> fact_factory =
1267 ilu_fact_type::build()
1268 .with_skip_sorting(skip_sort)
1270 precond_gen = gko::preconditioner::Ilu<l_solver_type,
1271 u_solver_type>::build()
1272#if MFEM_GINKGO_VERSION < 10700
1273 .with_factorization_factory(fact_factory)
1274 .with_l_solver_factory(l_solver_factory)
1275 .with_u_solver_factory(u_solver_factory)
1277 .with_factorization(fact_factory)
1278 .with_l_solver(l_solver_factory)
1279 .with_u_solver(u_solver_factory)
1286 using ilu_fact_type = gko::factorization::ParIlu<real_t, int>;
1287 std::shared_ptr<ilu_fact_type::Factory> fact_factory =
1288 ilu_fact_type::build()
1289 .with_iterations(
static_cast<unsigned long>(sweeps))
1290 .with_skip_sorting(skip_sort)
1292 precond_gen = gko::preconditioner::Ilu<l_solver_type,
1293 u_solver_type>::build()
1294#if MFEM_GINKGO_VERSION < 10700
1295 .with_factorization_factory(fact_factory)
1296 .with_l_solver_factory(l_solver_factory)
1297 .with_u_solver_factory(u_solver_factory)
1299 .with_factorization(fact_factory)
1300 .with_l_solver(l_solver_factory)
1301 .with_u_solver(u_solver_factory)
1311 const std::string &factorization_type,
1313 const bool skip_sort
1318 if (factorization_type ==
"exact")
1320 using ic_fact_type = gko::factorization::Ic<real_t, int>;
1321 std::shared_ptr<ic_fact_type::Factory> fact_factory =
1322 ic_fact_type::build()
1323 .with_both_factors(
false)
1324 .with_skip_sorting(skip_sort)
1327#if MFEM_GINKGO_VERSION < 10700
1328 .with_factorization_factory(fact_factory)
1330 .with_factorization(fact_factory)
1336 using ic_fact_type = gko::factorization::ParIc<real_t, int>;
1337 std::shared_ptr<ic_fact_type::Factory> fact_factory =
1338 ic_fact_type::build()
1339 .with_both_factors(
false)
1340 .with_iterations(
static_cast<unsigned long>(sweeps))
1341 .with_skip_sorting(skip_sort)
1344#if MFEM_GINKGO_VERSION < 10700
1345 .with_factorization_factory(fact_factory)
1347 .with_factorization(fact_factory)
1355 const std::string &factorization_type,
1357 const int sparsity_power,
1358 const bool skip_sort
1363 using l_solver_type = gko::preconditioner::LowerIsai<>;
1364 std::shared_ptr<l_solver_type::Factory> l_solver_factory =
1365 l_solver_type::build()
1366 .with_sparsity_power(sparsity_power)
1368 if (factorization_type ==
"exact")
1370 using ic_fact_type = gko::factorization::Ic<real_t, int>;
1371 std::shared_ptr<ic_fact_type::Factory> fact_factory =
1372 ic_fact_type::build()
1373 .with_both_factors(
false)
1374 .with_skip_sorting(skip_sort)
1376 precond_gen = gko::preconditioner::Ic<l_solver_type>::build()
1377#if MFEM_GINKGO_VERSION < 10700
1378 .with_factorization_factory(fact_factory)
1379 .with_l_solver_factory(l_solver_factory)
1381 .with_factorization(fact_factory)
1382 .with_l_solver(l_solver_factory)
1388 using ic_fact_type = gko::factorization::ParIc<real_t, int>;
1389 std::shared_ptr<ic_fact_type::Factory> fact_factory =
1390 ic_fact_type::build()
1391 .with_both_factors(
false)
1392 .with_iterations(
static_cast<unsigned long>(sweeps))
1393 .with_skip_sorting(skip_sort)
1395 precond_gen = gko::preconditioner::Ic<l_solver_type>::build()
1396#if MFEM_GINKGO_VERSION < 10700
1397 .with_factorization_factory(fact_factory)
1398 .with_l_solver_factory(l_solver_factory)
1400 .with_factorization(fact_factory)
1401 .with_l_solver(l_solver_factory)
1410 const Solver &mfem_precond
1416 mfem_precond.
Height(), &mfem_precond));
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
static bool Allows(unsigned long b_mask)
Return true if any of the backends in the backend mask, b_mask, are allowed.
BICGSTABSolver(GinkgoExecutor &exec)
CBGMRESSolver(GinkgoExecutor &exec, int dim=0, storage_precision prec=storage_precision::reduce1)
CGSSolver(GinkgoExecutor &exec)
FCGSolver(GinkgoExecutor &exec)
std::shared_ptr< gko::Executor > GetExecutor() const
GinkgoExecutor(ExecType exec_type)
@ REFERENCE
Reference CPU Executor.
@ OMP
OpenMP CPU Executor.
bool sub_op_needs_wrapped_vecs
bool UsesVectorWrappers() const
std::shared_ptr< gko::stop::ImplicitResidualNorm<>::Factory > imp_abs_criterion
virtual void Mult(const Vector &x, Vector &y) const
std::shared_ptr< ResidualLogger<> > residual_logger
void update_stop_factory()
bool use_implicit_res_norm
std::shared_ptr< gko::stop::ResidualNorm<>::Factory > abs_criterion
std::shared_ptr< gko::stop::Combined::Factory > combined_factory
const std::shared_ptr< gko::LinOpFactory > GetFactory() const
std::shared_ptr< gko::log::Convergence<> > convergence_logger
GinkgoIterativeSolver(GinkgoExecutor &exec, bool use_implicit_res_norm)
std::shared_ptr< gko::LinOpFactory > solver_gen
std::shared_ptr< gko::stop::ResidualNorm<>::Factory > rel_criterion
std::shared_ptr< gko::stop::ImplicitResidualNorm<>::Factory > imp_rel_criterion
std::shared_ptr< gko::Executor > executor
virtual void SetOperator(const Operator &op)
std::shared_ptr< gko::LinOp > solver
std::shared_ptr< gko::Executor > executor
const std::shared_ptr< gko::LinOpFactory > GetFactory() const
std::shared_ptr< gko::LinOp > generated_precond
virtual void SetOperator(const Operator &op)
virtual void Mult(const Vector &x, Vector &y) const
bool HasGeneratedPreconditioner() const
bool has_generated_precond
GinkgoPreconditioner(GinkgoExecutor &exec)
std::shared_ptr< gko::LinOpFactory > precond_gen
const std::shared_ptr< gko::LinOp > GetGeneratedPreconditioner() const
IRSolver(GinkgoExecutor &exec)
IcIsaiPreconditioner(GinkgoExecutor &exec, const std::string &factorization_type="exact", const int sweeps=0, const int sparsity_power=1, const bool skip_sort=false)
IcPreconditioner(GinkgoExecutor &exec, const std::string &factorization_type="exact", const int sweeps=0, const bool skip_sort=false)
IluIsaiPreconditioner(GinkgoExecutor &exec, const std::string &factorization_type="exact", const int sweeps=0, const int sparsity_power=1, const bool skip_sort=false)
IluPreconditioner(GinkgoExecutor &exec, const std::string &factorization_type="exact", const int sweeps=0, const bool skip_sort=false)
JacobiPreconditioner(GinkgoExecutor &exec, const std::string &storage_opt="none", const real_t accuracy=1.e-1, const int max_block_size=32)
MFEMPreconditioner(GinkgoExecutor &exec, const Solver &mfem_precond)
void apply_impl(const gko::LinOp *b, gko::LinOp *x) const override
Vector & get_mfem_vec_ref()
const Vector & get_mfem_vec_const_ref() const
int Capacity() const
Return the size of the allocated memory.
MemoryType GetMemoryType() const
Return a MemoryType that is currently valid. If both the host and the device pointers are currently v...
int width
Dimension of the input / number of columns in the matrix.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int height
Dimension of the output / number of rows in the matrix.
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
bool iterative_mode
If true, use the second argument of Mult() as an initial guess.
int * ReadWriteI(bool on_dev=true)
real_t * ReadWriteData(bool on_dev=true)
int * ReadWriteJ(bool on_dev=true)
Memory< real_t > & GetMemoryData()
virtual const real_t * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
virtual real_t * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), on_dev).
Memory< real_t > & GetMemory()
Return a reference to the Memory object used by the Vector.
void Destroy()
Destroy a vector.
int Size() const
Returns the size of the vector.
virtual void UseDevice(bool use_dev) const
Enable execution of Vector operations using the mfem::Device.
Vector & Add(const real_t a, const Vector &Va)
(*this) += a * Va
gko::Array< T > gko_array
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
OutStream err(std::cerr)
Global stream used by the library for standard error output. Initially it uses the same std::streambu...
@ HIP_MASK
Biwise-OR of all HIP backends.
@ CUDA_MASK
Biwise-OR of all CUDA backends.
@ OMP_MASK
Biwise-OR of all OpenMP backends.