Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tpetra_Details_unpackCrsMatrixAndCombine_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Tpetra: Templated Linear Algebra Services Package
5 // Copyright (2008) Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // ************************************************************************
38 // @HEADER
39 
40 #ifndef TPETRA_DETAILS_UNPACKCRSMATRIXANDCOMBINE_DECL_HPP
41 #define TPETRA_DETAILS_UNPACKCRSMATRIXANDCOMBINE_DECL_HPP
42 
43 #include "TpetraCore_config.h"
44 #include "Tpetra_CombineMode.hpp"
45 #include "Kokkos_DualView.hpp"
46 #include "Tpetra_CrsMatrix_fwd.hpp"
48 #include "Tpetra_Details_DefaultTypes.hpp"
49 
70 
71 #ifndef DOXYGEN_SHOULD_SKIP_THIS
72 namespace Teuchos {
73 // Forward declaration of Array
74 template<class T> class Array;
75 // Forward declaration of ArrayView
76 template<class T> class ArrayView;
77 } // namespace Teuchos
78 #endif // DOXYGEN_SHOULD_SKIP_THIS
79 
80 namespace Tpetra {
81 
82 //
83 // Users must never rely on anything in the Details namespace.
84 //
85 namespace Details {
86 
125 template<typename ST, typename LO, typename GO, typename NT>
126 void
127 unpackCrsMatrixAndCombine (const CrsMatrix<ST, LO, GO, NT>& sourceMatrix,
128  const Teuchos::ArrayView<const char>& imports,
129  const Teuchos::ArrayView<const size_t>& numPacketsPerLID,
130  const Teuchos::ArrayView<const LO>& importLIDs,
131  size_t constantNumPackets,
132  CombineMode combineMode);
133 
134 template<typename ST, typename LO, typename GO, typename NT>
135 void
136 unpackCrsMatrixAndCombineNew(
137  const CrsMatrix<ST, LO, GO, NT>& sourceMatrix,
138  Kokkos::DualView<char*,
140  Kokkos::DualView<size_t*,
141  typename DistObject<char, LO, GO, NT>::buffer_device_type> numPacketsPerLID,
142  const Kokkos::DualView<const LO*,
144  const size_t constantNumPackets,
145  const CombineMode combineMode);
146 
193 //
202 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
203 size_t
205  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> & sourceMatrix,
206  const Teuchos::ArrayView<const LocalOrdinal> &importLIDs,
207  const Teuchos::ArrayView<const char> &imports,
208  const Teuchos::ArrayView<const size_t>& numPacketsPerLID,
209  size_t constantNumPackets,
210  CombineMode combineMode,
211  size_t numSameIDs,
212  const Teuchos::ArrayView<const LocalOrdinal>& permuteToLIDs,
213  const Teuchos::ArrayView<const LocalOrdinal>& permuteFromLIDs);
214 
229 
230 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
231 void
233  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> & sourceMatrix,
234  const Kokkos::View<LocalOrdinal const *,
235  Kokkos::Device<typename Node::device_type::execution_space,
236  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>,
237  void, void>,
238  const Kokkos::View<const char*,
239  Kokkos::Device<typename Node::device_type::execution_space,
240  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
241  ,void, void >,
242  const Kokkos::View<const size_t*,
243  Kokkos::Device<typename Node::device_type::execution_space,
244  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
245  ,void, void >,
246  const size_t numSameIDs,
247  const Kokkos::View<LocalOrdinal const *,
248  Kokkos::Device<typename Node::device_type::execution_space,
249  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>,
250  void, void>,
251  const Kokkos::View<LocalOrdinal const *,
252  Kokkos::Device<typename Node::device_type::execution_space,
253  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>,
254  void, void>,
255  size_t TargetNumRows,
256  const int MyTargetPID,
257  Teuchos::ArrayRCP<size_t>& CRS_rowptr,
258  Teuchos::ArrayRCP<GlobalOrdinal>& CRS_colind,
259  Teuchos::ArrayRCP<Scalar>& CRS_vals,
260  const Teuchos::ArrayView<const int>& SourcePids,
261  Teuchos::Array<int>& TargetPids);
262 
263 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
264 void
266  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> & sourceMatrix,
267  const Kokkos::View<LocalOrdinal const *,
268  Kokkos::Device<typename Node::device_type::execution_space,
269  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>,
270  void, void>,
271  const Kokkos::View<const char*,
272  Kokkos::Device<typename Node::device_type::execution_space,
273  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
274  ,void, void >,
275  const Kokkos::View<const size_t*,
276  Kokkos::Device<typename Node::device_type::execution_space,
277  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
278  ,void, void >,
279  const size_t numSameIDs,
280  const Kokkos::View<LocalOrdinal const *,
281  Kokkos::Device<typename Node::device_type::execution_space,
282  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>,
283  void, void>,
284  const Kokkos::View<LocalOrdinal const *,
285  Kokkos::Device<typename Node::device_type::execution_space,
286  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>,
287  void, void>,
288  size_t TargetNumRows,
289  const int MyTargetPID,
290  Kokkos::View<size_t*,typename Node::device_type>& /*crs_rowptr_d*/,
291  Kokkos::View<GlobalOrdinal*,typename Node::device_type>& /*crs_colind_d*/,
292  Kokkos::View<typename CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::impl_scalar_type*,typename Node::device_type>& /*crs_vals_d*/,
293  const Teuchos::ArrayView<const int>& SourcePids,
294  Kokkos::View<int*,typename Node::device_type>& /*TargetPids*/);
295 
296 } // namespace Details
297 } // namespace Tpetra
298 
299 #endif // TPETRA_DETAILS_UNPACKCRSMATRIXANDCOMBINE_DECL_HPP
void unpackCrsMatrixAndCombine(const CrsMatrix< ST, LO, GO, NT > &sourceMatrix, const Teuchos::ArrayView< const char > &imports, const Teuchos::ArrayView< const size_t > &numPacketsPerLID, const Teuchos::ArrayView< const LO > &importLIDs, size_t constantNumPackets, CombineMode combineMode)
Unpack the imported column indices and values, and combine into matrix.
Declaration of Tpetra::CombineMode enum, and a function for setting a Tpetra::CombineMode parameter i...
void unpackAndCombineIntoCrsArrays(const CrsGraph< LO, GO, NT > &sourceGraph, const Teuchos::ArrayView< const LO > &importLIDs, const Teuchos::ArrayView< const typename CrsGraph< LO, GO, NT >::packet_type > &imports, const Teuchos::ArrayView< const size_t > &numPacketsPerLID, const size_t constantNumPackets, const CombineMode combineMode, const size_t numSameIDs, const Teuchos::ArrayView< const LO > &permuteToLIDs, const Teuchos::ArrayView< const LO > &permuteFromLIDs, size_t TargetNumRows, size_t TargetNumNonzeros, const int MyTargetPID, const Teuchos::ArrayView< size_t > &CRS_rowptr, const Teuchos::ArrayView< GO > &CRS_colind, const Teuchos::ArrayView< const int > &SourcePids, Teuchos::Array< int > &TargetPids)
unpackAndCombineIntoCrsArrays
CombineMode
Rule for combining data in an Import or Export.
Forward declaration of Tpetra::CrsMatrix.
Declaration of the Tpetra::DistObject class.
size_t unpackAndCombineWithOwningPIDsCount(const CrsGraph< LO, GO, NT > &sourceGraph, const Teuchos::ArrayView< const LO > &importLIDs, const Teuchos::ArrayView< const typename CrsGraph< LO, GO, NT >::packet_type > &imports, const Teuchos::ArrayView< const size_t > &numPacketsPerLID, size_t constantNumPackets, CombineMode combineMode, size_t numSameIDs, const Teuchos::ArrayView< const LO > &permuteToLIDs, const Teuchos::ArrayView< const LO > &permuteFromLIDs)
Special version of Tpetra::Details::unpackCrsGraphAndCombine that also unpacks owning process ranks...
Kokkos::Device< typename device_type::execution_space, buffer_memory_space > buffer_device_type