Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tpetra_Details_getGraphOffRankOffsets_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_GETGRAPHOFFRANKOFFSETS_DECL_HPP
11 #define TPETRA_DETAILS_GETGRAPHOFFRANKOFFSETS_DECL_HPP
12 
17 
18 #include "TpetraCore_config.h"
19 #include "Kokkos_Core.hpp"
20 #include "KokkosSparse_StaticCrsGraph.hpp"
22 #include <type_traits>
23 
24 namespace Tpetra {
25 namespace Details {
26 namespace Impl {
27 
41 template<class LO,
42  class GO,
43  class DeviceType,
44  class OffsetType = size_t>
46 public:
47  typedef typename DeviceType::device_type device_type;
48  typedef OffsetType offset_type;
49  typedef ::Kokkos::View<offset_type*,
50  device_type,
51  ::Kokkos::MemoryUnmanaged> offsets_type;
52  using local_graph_type = ::KokkosSparse::StaticCrsGraph<LO,
53  ::Kokkos::LayoutLeft,
54  device_type, void, size_t>;
55  typedef ::Tpetra::Details::LocalMap<LO, GO, device_type> local_map_type;
56  typedef ::Kokkos::View<const typename local_graph_type::size_type*,
57  ::Kokkos::LayoutLeft,
58  device_type,
59  ::Kokkos::MemoryUnmanaged> row_offsets_type;
60  // This is unmanaged for performance, because we need to take
61  // subviews inside the functor.
62  typedef ::Kokkos::View<const LO*,
63  ::Kokkos::LayoutLeft,
64  device_type,
65  ::Kokkos::MemoryUnmanaged> lcl_col_inds_type;
66 
68  GetGraphOffRankOffsets (const offsets_type& OffRankOffsets,
69  const local_map_type& lclColMap,
70  const local_map_type& lclDomMap,
71  const row_offsets_type& ptr,
72  const lcl_col_inds_type& ind);
73 
75  KOKKOS_FUNCTION void operator() (const LO& lclRowInd) const;
76 
77 private:
78  offsets_type OffRankOffsets_;
79  local_map_type lclColMap_;
80  local_map_type lclDomMap_;
81  row_offsets_type ptr_;
82  lcl_col_inds_type ind_;
83  LO lclNumRows_;
84 };
85 
86 } // namespace Impl
87 
88 template<class OffsetsType,
89  class LclMapType,
90  class LclGraphType>
91 void
92 getGraphOffRankOffsets (const OffsetsType& OffRankOffsets,
93  const LclMapType& lclColMap,
94  const LclMapType& lclDomMap,
95  const LclGraphType& lclGraph)
96 {
97  typedef typename OffsetsType::non_const_value_type offset_type;
98  typedef typename LclMapType::local_ordinal_type LO;
99  typedef typename LclMapType::global_ordinal_type GO;
100  typedef typename LclMapType::device_type DT;
101 
103 
104  // The functor's constructor runs the functor.
105  impl_type impl (OffRankOffsets, lclColMap, lclDomMap, lclGraph.row_map, lclGraph.entries);
106 }
107 
108 } // namespace Details
109 } // namespace Tpetra
110 
111 #endif // TPETRA_DETAILS_GETGRAPHOFFRANKOFFSETS_DECL_HPP
Implementation detail of Tpetra::Details::getGraphOffRankOffsets, which in turn is an implementation ...
Declaration and definition of the Tpetra::Map class, an implementation detail of Tpetra::Map.
GetGraphOffRankOffsets(const offsets_type &OffRankOffsets, const local_map_type &lclColMap, const local_map_type &lclDomMap, const row_offsets_type &ptr, const lcl_col_inds_type &ind)
Constructor; also runs the functor.
KOKKOS_FUNCTION void operator()(const LO &lclRowInd) const
Kokkos::parallel_for loop body.