Teuchos: Kokkos::Compat::persistingView must not call Teuchos::arcp with nonnull pointer and zero length
Created by: mhoemmen
@trilinos/teuchos @trilinos/tpetra @trilinos/kokkos
Kokkos::Compat::persistingView
passes the Kokkos::View
's pointer directly to Teuchos::arcp
(nonmember "constructor" for Teuchos::ArrayRCP
). Kokkos::View
, just like std::vector
, permits a nonnull pointer with a zero size. Teuchos::ArrayRCP
does not; its constructor throws when bounds checking is enabled (a configure-time option). This causes some Tpetra tests to fail.
Expectations
It should be harmless to convert a zero-size Kokkos::View
to a Teuchos::ArrayRCP
.
Current Behavior
Some Tpetra tests fail, because Teuchos::arcp
throws. When I fix persistingView
as suggested below, the tests pass.
Possible Solution
Here are two possible solutions:
- Fix
persistingView
so that it givesTeuchos::arcp
a null pointer if theKokkos::View
's size is zero. - Fix
Teuchos::arcp
, analogously toTeuchos::ArrayView
(see #4234 (closed)).
For now I prefer Solution (1). See #4234 (closed) discussion, esp. the comment here.
Related Issues
- Related to #4234 (closed)