Skip to content

Commit

Permalink
use gko::lend based on Ginkgo version
Browse files Browse the repository at this point in the history
  • Loading branch information
gardner48 committed May 17, 2024
1 parent 45b1578 commit 417134e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
13 changes: 12 additions & 1 deletion examples/sunlinsol/ginkgo/test_sunlinsol_ginkgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,14 @@ int main(int argc, char* argv[])
gko_matdata.remove_zeros();
gko_matrix->read(gko_matdata);
}
else { fill_matrix(gko_matrix); }
else
{
#if (GKO_VERSION_MAJOR == 1) && (GKO_VERSION_MINOR < 6)
fill_matrix(gko::lend(gko_matrix));
#else
fill_matrix(gko_matrix);
#endif
}
A = std::make_unique<sundials::ginkgo::Matrix<GkoMatrixType>>(std::move(
gko_matrix),
sunctx);
Expand All @@ -502,7 +509,11 @@ int main(int argc, char* argv[])
else
{
gko_matrix->fill(0.0);
#if (GKO_VERSION_MAJOR == 1) && (GKO_VERSION_MINOR < 6)
fill_matrix(gko::lend(gko_matrix));
#else
fill_matrix(gko_matrix);
#endif
}
A = std::make_unique<sundials::ginkgo::Matrix<GkoMatrixType>>(std::move(
gko_matrix),
Expand Down
8 changes: 8 additions & 0 deletions include/sunlinsol/sunlinsol_ginkgo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,19 @@ class LinearSolver : public ConvertibleTo<SUNLinearSolver>
}

iter_count_ = static_cast<int>(logger->get_num_iterations());
#if (GKO_VERSION_MAJOR == 1) && (GKO_VERSION_MINOR < 6)
GkoExec()->get_master()->copy_from(gko::lend(GkoExec()), 1,
gko::as<impl::GkoDenseMat>(
logger->get_residual_norm())
->get_const_values(),
&res_norm_);
#else
GkoExec()->get_master()->copy_from(GkoExec(), 1,
gko::as<impl::GkoDenseMat>(
logger->get_residual_norm())
->get_const_values(),
&res_norm_);
#endif

return result;
}
Expand Down

0 comments on commit 417134e

Please sign in to comment.