Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lac/trilinos_tpetra...h: Fix compilation on Ubuntu 20.04 #15612

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion include/deal.II/lac/trilinos_tpetra_vector.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,16 @@ namespace LinearAlgebra
auto vector_2d = vector.template getLocalView<Kokkos::HostSpace>(
Tpetra::Access::ReadOnly);
# else
vector.template sync<Kokkos::HostSpace>();
/*
* For Trilinos older than 13.2 we would normally have to call
* vector.template sync<Kokkos::HostSpace>() at this place in order
* to sync between memory spaces. This is necessary for GPU support.
* Unfortunately, we are in a const context here and cannot call to
* sync() (which is a non-const member function).
*
* Let us choose to simply ignore this problem for such an old
* Trilinos version.
*/
Comment on lines +135 to +144
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is OK but we could also check via need_sync_host(https://docs.trilinos.org/dev/packages/tpetra/doc/html/classTpetra_1_1MultiVector.html#a5af96c2c9c0212e16b88a97d3ab7a284) if we are running into issues.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can always do a const cast. As long as the function is "semantically const", that should be ok.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed and agreed to keep this PR as is for the time being. We can revisit if someone ever ends up using an old Trilinos version with GPUs.

auto vector_2d = vector.template getLocalView<Kokkos::HostSpace>();
# endif
auto vector_1d = Kokkos::subview(vector_2d, Kokkos::ALL(), 0);
Expand Down