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 // Tpetra: Templated Linear Algebra Services Package
4 //
5 // Copyright 2008 NTESS and the Tpetra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TPETRA_DETAILS_UNPACKCRSMATRIXANDCOMBINE_DECL_HPP
11 #define TPETRA_DETAILS_UNPACKCRSMATRIXANDCOMBINE_DECL_HPP
12 
13 #include "TpetraCore_config.h"
14 #include "Tpetra_CombineMode.hpp"
15 #include "Kokkos_DualView.hpp"
16 #include "Tpetra_CrsMatrix_fwd.hpp"
18 #include "Tpetra_Details_DefaultTypes.hpp"
19 
40 
41 #ifndef DOXYGEN_SHOULD_SKIP_THIS
42 namespace Teuchos {
43 // Forward declaration of Array
44 template<class T> class Array;
45 // Forward declaration of ArrayView
46 template<class T> class ArrayView;
47 } // namespace Teuchos
48 #endif // DOXYGEN_SHOULD_SKIP_THIS
49 
50 namespace Tpetra {
51 
52 //
53 // Users must never rely on anything in the Details namespace.
54 //
55 namespace Details {
56 
95 template<typename ST, typename LO, typename GO, typename NT>
96 void
97 unpackCrsMatrixAndCombine (const CrsMatrix<ST, LO, GO, NT>& sourceMatrix,
98  const Teuchos::ArrayView<const char>& imports,
99  const Teuchos::ArrayView<const size_t>& numPacketsPerLID,
100  const Teuchos::ArrayView<const LO>& importLIDs,
101  size_t constantNumPackets,
102  CombineMode combineMode);
103 
104 template<typename ST, typename LO, typename GO, typename NT>
105 void
106 unpackCrsMatrixAndCombineNew(
107  const CrsMatrix<ST, LO, GO, NT>& sourceMatrix,
108  Kokkos::DualView<char*,
110  Kokkos::DualView<size_t*,
111  typename DistObject<char, LO, GO, NT>::buffer_device_type> numPacketsPerLID,
112  const Kokkos::DualView<const LO*,
114  const size_t constantNumPackets,
115  const CombineMode combineMode);
116 
163 //
172 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
173 size_t
175  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> & sourceMatrix,
176  const Teuchos::ArrayView<const LocalOrdinal> &importLIDs,
177  const Teuchos::ArrayView<const char> &imports,
178  const Teuchos::ArrayView<const size_t>& numPacketsPerLID,
179  size_t constantNumPackets,
180  CombineMode combineMode,
181  size_t numSameIDs,
182  const Teuchos::ArrayView<const LocalOrdinal>& permuteToLIDs,
183  const Teuchos::ArrayView<const LocalOrdinal>& permuteFromLIDs);
184 
199 
200 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
201 void
203  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> & sourceMatrix,
204  const Kokkos::View<LocalOrdinal const *,
205  Kokkos::Device<typename Node::device_type::execution_space,
206  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
207 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
208  , void, void
209 #endif
210  >,
211  const Kokkos::View<const char*,
212  Kokkos::Device<typename Node::device_type::execution_space,
213  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
214 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
215  , void, void
216 #endif
217  >,
218  const Kokkos::View<const size_t*,
219  Kokkos::Device<typename Node::device_type::execution_space,
220  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
221 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
222  , void, void
223 #endif
224  >,
225  const size_t numSameIDs,
226  const Kokkos::View<LocalOrdinal const *,
227  Kokkos::Device<typename Node::device_type::execution_space,
228  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
229 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
230  , void, void
231 #endif
232  >,
233  const Kokkos::View<LocalOrdinal const *,
234  Kokkos::Device<typename Node::device_type::execution_space,
235  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
236 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
237  , void, void
238 #endif
239  >,
240  size_t TargetNumRows,
241  const int MyTargetPID,
242  Teuchos::ArrayRCP<size_t>& CRS_rowptr,
243  Teuchos::ArrayRCP<GlobalOrdinal>& CRS_colind,
244  Teuchos::ArrayRCP<Scalar>& CRS_vals,
245  const Teuchos::ArrayView<const int>& SourcePids,
246  Teuchos::Array<int>& TargetPids);
247 
248 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
249 void
251  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> & sourceMatrix,
252  const Kokkos::View<LocalOrdinal const *,
253  Kokkos::Device<typename Node::device_type::execution_space,
254  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
255 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
256  , void, void
257 #endif
258  >,
259  const Kokkos::View<const char*,
260  Kokkos::Device<typename Node::device_type::execution_space,
261  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
262 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
263  , void, void
264 #endif
265  >,
266  const Kokkos::View<const size_t*,
267  Kokkos::Device<typename Node::device_type::execution_space,
268  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
269 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
270  , void, void
271 #endif
272  >,
273  const size_t numSameIDs,
274  const Kokkos::View<LocalOrdinal const *,
275  Kokkos::Device<typename Node::device_type::execution_space,
276  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
277 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
278  , void, void
279 #endif
280  >,
281  const Kokkos::View<LocalOrdinal const *,
282  Kokkos::Device<typename Node::device_type::execution_space,
283  Tpetra::Details::DefaultTypes::comm_buffer_memory_space<typename Node::device_type>>
284 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
285  , void, void
286 #endif
287  >,
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