Tpetra: "New RTI" (Reduction Transform Interface), Part 1 (for_each, transform)
Created by: mhoemmen
Tpetra once had something called the Reduction Transform Interface (RTI). It let users apply a function to each entry of one or two (or three, I think)
Tpetra::Vectors, and then possibly end with a reduction over the output Vector.
This commit starts anew with RTI, by adding the following features:
withLocalAccess: Access the local data of a
Tpetra::)Multi)Vectorin a given memory space -- a declarative replacement for DualView-style functions
for_each: Works like
std::for_each, but for
transform: Works like unary or binary
std::transform, but for
(2) and (3) use (1). All of these have extension points so that they can be adapted for other objects, such as CrsGraph or CrsMatrix.
Motivation and Context
Users want to apply functions entrywise to a Vector or MultiVector. They want to get at the local data, and they want Tpetra to handle the sync and modify flag stuff for them. Tpetra wants the power to do things like lazy allocation (see #333) that go beyond what
Kokkos::DualView allows. Tpetra wants to protect users from holding on to owning
Kokkos::View that really belong to Tpetra objects, because that can cause bugs (e.g., if the mesh that produced the linear system has changed) and unnecessary memory usage.
transform_reduce(the "R" in "RTI")
- Think about how to do kernel fusion with a mixture of Vector and CrsMatrix (or at least provide a "residual" interface)