Amesos2 - Direct Sparse Solver Interfaces  Version of the Day
Amesos2_KokkosMultiVecAdapter_def.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // Amesos2: Templated Direct Sparse Solver Package
6 // Copyright 2011 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ***********************************************************************
41 //
42 // @HEADER
43 
53 #ifndef AMESOS2_KOKKOS_MULTIVEC_ADAPTER_DEF_HPP
54 #define AMESOS2_KOKKOS_MULTIVEC_ADAPTER_DEF_HPP
55 
56 #include <type_traits>
59 
60 
61 namespace Amesos2 {
62 
63  template <typename Scalar, typename ExecutionSpace >
64  MultiVecAdapter<
65  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::MultiVecAdapter( const Teuchos::RCP<multivec_t>& m )
66  : mv_(m)
67  {}
68 
69  template <typename Scalar, typename ExecutionSpace >
70  Scalar *
72  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::getMVPointer_impl() const
73  {
74  TEUCHOS_TEST_FOR_EXCEPTION( true, std::runtime_error, "getMVPointer_impl not implemented.");
75  }
76 
77  template <typename Scalar, typename ExecutionSpace >
78  void
80  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::get1dCopy(const Teuchos::ArrayView<scalar_t>& av,
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>> distribution_map,
85  EDistribution distribution) const
86  {
87  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "get1dCopy for kokkos not implemented.");
88  }
89 
90  template <typename Scalar, typename ExecutionSpace >
91  Teuchos::ArrayRCP<Scalar>
93  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::get1dViewNonConst (bool local)
94  {
95  TEUCHOS_TEST_FOR_EXCEPTION(
96  true, std::logic_error, "Amesos2::MultiVecAdapter::get1dViewNonConst: "
97  "Not implemented.");
98  }
99 
100  template <typename Scalar, typename ExecutionSpace>
101  void
103  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::put1dData(
104  const Teuchos::ArrayView<const scalar_t>& new_data,
105  size_t lda,
106  Teuchos::Ptr<
107  const Tpetra::Map<local_ordinal_t, global_ordinal_t,
108  MultiVecAdapter<Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace>>::node_t> > source_map,
109  EDistribution /* distribution */) const
110  {
111  TEUCHOS_TEST_FOR_EXCEPTION(
112  true, std::logic_error, "Amesos2::MultiVecAdapter::put1dData: "
113  "Not implemented.");
114  }
115 
116  template <typename Scalar, typename ExecutionSpace >
117  std::string
119  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::description() const
120  {
121  std::ostringstream oss;
122  oss << "Amesos2 adapter wrapping: ";
123  oss << mv_->description();
124  return oss.str();
125  }
126 
127 
128  template <typename Scalar, typename ExecutionSpace >
129  void
131  Kokkos::View<Scalar**, Kokkos::LayoutLeft, ExecutionSpace> >::describe (Teuchos::FancyOStream& os,
132  const Teuchos::EVerbosityLevel verbLevel) const
133  {
134  mv_->describe (os, verbLevel);
135  }
136 
137 } // end namespace Amesos2
138 
139 #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:123
A templated MultiVector class adapter for Amesos2.
Definition: Amesos2_MultiVecAdapter_decl.hpp:176