Amesos2 - Direct Sparse Solver Interfaces  Version of the Day
Amesos2_KokkosMultiVecAdapter_def.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Amesos2: Templated Direct Sparse Solver Package
4 //
5 // Copyright 2011 NTESS and the Amesos2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
19 #ifndef AMESOS2_KOKKOS_MULTIVEC_ADAPTER_DEF_HPP
20 #define AMESOS2_KOKKOS_MULTIVEC_ADAPTER_DEF_HPP
21 
22 #include <type_traits>
25 
26 
27 namespace Amesos2 {
28 
29  template <typename Scalar, typename ExecutionSpace >
30  MultiVecAdapter<
31  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::MultiVecAdapter( const Teuchos::RCP<multivec_t>& m )
32  : mv_(m)
33  {}
34 
35  template <typename Scalar, typename ExecutionSpace >
36  Teuchos::RCP< Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >
38  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::clone() const
39  {
40  using MV = Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace>;
41  MV Y("clonedY", mv_->extent(0), mv_->extent(1));
42  return Teuchos::rcp( &Y );
43  }
44 
45  template <typename Scalar, typename ExecutionSpace >
46  Scalar *
47  MultiVecAdapter<
48  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::getMVPointer_impl() const
49  {
50  TEUCHOS_TEST_FOR_EXCEPTION( true, std::runtime_error, "getMVPointer_impl not implemented.");
51  }
52 
53  template <typename Scalar, typename ExecutionSpace >
54  void
56  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::get1dCopy(const Teuchos::ArrayView<scalar_t>& av,
57  size_t lda,
58  Teuchos::Ptr<
59  const Tpetra::Map<local_ordinal_t, global_ordinal_t,
60  MultiVecAdapter<Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace>>::node_t>> distribution_map,
61  EDistribution distribution) const
62  {
63  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "get1dCopy for kokkos not implemented.");
64  }
65 
66  template <typename Scalar, typename ExecutionSpace >
67  Teuchos::ArrayRCP<Scalar>
69  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::get1dViewNonConst (bool local)
70  {
71  TEUCHOS_TEST_FOR_EXCEPTION(
72  true, std::logic_error, "Amesos2::MultiVecAdapter::get1dViewNonConst: "
73  "Not implemented.");
74  }
75 
76  template <typename Scalar, typename ExecutionSpace>
77  void
79  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::put1dData(
80  const Teuchos::ArrayView<const scalar_t>& new_data,
81  size_t lda,
82  Teuchos::Ptr<
83  const Tpetra::Map<local_ordinal_t, global_ordinal_t,
84  MultiVecAdapter<Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace>>::node_t> > source_map,
85  EDistribution /* distribution */) const
86  {
87  TEUCHOS_TEST_FOR_EXCEPTION(
88  true, std::logic_error, "Amesos2::MultiVecAdapter::put1dData: "
89  "Not implemented.");
90  }
91 
92  template <typename Scalar, typename ExecutionSpace>
93  template<typename KV, typename host_ordinal_type_array>
94  int
96  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::gather (
97  KV& kokkos_new_view,
98  host_ordinal_type_array &perm_g2l,
99  host_ordinal_type_array &recvCountRows,
100  host_ordinal_type_array &recvDisplRows,
101  EDistribution distribution ) const
102  {
103  return -1;
104  }
105 
106  template <typename Scalar, typename ExecutionSpace>
107  template<typename KV, typename host_ordinal_type_array>
108  int
109  MultiVecAdapter<
110  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::scatter (
111  KV& kokkos_new_view,
112  host_ordinal_type_array &perm_g2l,
113  host_ordinal_type_array &recvCountRows,
114  host_ordinal_type_array &recvDisplRows,
115  EDistribution distribution ) const
116  {
117  return -1;
118  }
119 
120  template <typename Scalar, typename ExecutionSpace >
121  std::string
122  MultiVecAdapter<
123  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::description() const
124  {
125  std::ostringstream oss;
126  oss << "Amesos2 adapter wrapping: ";
127  oss << mv_->description();
128  return oss.str();
129  }
130 
131 
132  template <typename Scalar, typename ExecutionSpace >
133  void
135  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::describe (Teuchos::FancyOStream& os,
136  const Teuchos::EVerbosityLevel verbLevel) const
137  {
138  mv_->describe (os, verbLevel);
139  }
140 
141 } // end namespace Amesos2
142 
143 #endif // AMESOS2_KOKKOS_MULTIVEC_ADAPTER_DEF_HPP
Amesos2::MultiVecAdapter specialization for the Kokkos::View class.
Copy or assign views based on memory spaces.
EDistribution
Definition: Amesos2_TypeDecl.hpp:89
A templated MultiVector class adapter for Amesos2.
Definition: Amesos2_MultiVecAdapter_decl.hpp:142