[Trilinos-Users] [EXTERNAL] Tpetra vector and multivector coefficient access

Bartlett, Roscoe A rabartl at sandia.gov
Tue Feb 28 21:57:43 EST 2017


Bart,

If you know you have a wrapped Tpetra::Vector (or Tpetra::MultiVector) object, then extract the Tpetra::Vector (or Tpetra::MultiVector) object from the Thyra::TpetraVector (or Tpetra::MultiVector) object and then extract the Kokkos view from that.  See:

   https://trilinos.org/docs/dev/packages/thyra/doc/html/classThyra_1_1TpetraOperatorVectorExtraction.html

As for Thyra, the only way to implement and element-by-element operator[](i) function would be a super-slow virtual function call for every element one-by-one.  That would be super slow.  Therefore, you need to grab a view then access that view.

Let me know if you have any questions about extracting the Tpetra objects from the wrapped Thyra objects.

-Ross


Dr. Roscoe A. Bartlett, PhD
http://www.cs.sandia.gov/cr-rabartl
Sandia National Laboratories

From: Trilinos-Users [mailto:trilinos-users-bounces at trilinos.org] On Behalf Of Bart Janssens
Sent: Tuesday, February 28, 2017 5:00 PM
To: Trilinos-users at trilinos.org
Subject: [EXTERNAL] [Trilinos-Users] Tpetra vector and multivector coefficient access

Hi all,
I'm a bit confused about what the best way forward is to access elements of Tpetra (multi-)vectors. From the Tpetra documentation, it seems getting a Kokkos view is the recommended method, but I am also using the vectors in Thyra to pass them to the Belos solver, and Thyra seems to provide its own View classes (but docs seem to recommend against using them). Finally, there is also ArrayRCP, which seems to be also not recommended. So I am leaning towards using the Kokkos views? The goal is to provide a high-level interface in the Julia wrappers, so users can access local coefficients using the [] operator. The way I understand it, it's a bad idea to expose the [] operator directly on a Tpetra or Thyra vector, but it's better to extract a view and implement the [] operator on that?
To get a more concrete context, see this example:
https://github.com/barche/Trilinos.jl/blob/master/test/thyra.jl
I would like something like
x2[i]
or
v = getLocalView(x2)
v[i]
to access element i of Tpetra vector x2.
Kind regards,
Bart

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20170301/0364af6c/attachment.html>


More information about the Trilinos-Users mailing list