Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_Details_getGraphOffRankOffsets_decl.hpp
Go to the documentation of this file.
1/*
2// @HEADER
3// ***********************************************************************
4//
5// Tpetra: Templated Linear Algebra Services Package
6// Copyright (2008) 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// @HEADER
42*/
43
44#ifndef TPETRA_DETAILS_GETGRAPHOFFRANKOFFSETS_DECL_HPP
45#define TPETRA_DETAILS_GETGRAPHOFFRANKOFFSETS_DECL_HPP
46
51
52#include "TpetraCore_config.h"
53#include "Kokkos_Core.hpp"
54#include "Kokkos_StaticCrsGraph.hpp"
56#include <type_traits>
57
58namespace Tpetra {
59namespace Details {
60namespace Impl {
61
75template<class LO,
76 class GO,
77 class DeviceType,
78 class OffsetType = size_t>
80public:
81 typedef typename DeviceType::device_type device_type;
82 typedef OffsetType offset_type;
83 typedef ::Kokkos::View<offset_type*,
84 device_type,
85 ::Kokkos::MemoryUnmanaged> offsets_type;
86 typedef ::Kokkos::StaticCrsGraph<LO,
87 ::Kokkos::LayoutLeft,
88 device_type,
89 void, size_t> local_graph_type;
90 typedef ::Tpetra::Details::LocalMap<LO, GO, device_type> local_map_type;
91 typedef ::Kokkos::View<const typename local_graph_type::size_type*,
92 ::Kokkos::LayoutLeft,
93 device_type,
94 ::Kokkos::MemoryUnmanaged> row_offsets_type;
95 // This is unmanaged for performance, because we need to take
96 // subviews inside the functor.
97 typedef ::Kokkos::View<const LO*,
98 ::Kokkos::LayoutLeft,
99 device_type,
100 ::Kokkos::MemoryUnmanaged> lcl_col_inds_type;
101
103 GetGraphOffRankOffsets (const offsets_type& OffRankOffsets,
104 const local_map_type& lclColMap,
105 const local_map_type& lclDomMap,
106 const row_offsets_type& ptr,
107 const lcl_col_inds_type& ind);
108
110 KOKKOS_FUNCTION void operator() (const LO& lclRowInd) const;
111
112private:
113 offsets_type OffRankOffsets_;
114 local_map_type lclColMap_;
115 local_map_type lclDomMap_;
116 row_offsets_type ptr_;
117 lcl_col_inds_type ind_;
118 LO lclNumRows_;
119};
120
121} // namespace Impl
122
123template<class OffsetsType,
124 class LclMapType,
125 class LclGraphType>
126void
127getGraphOffRankOffsets (const OffsetsType& OffRankOffsets,
128 const LclMapType& lclColMap,
129 const LclMapType& lclDomMap,
130 const LclGraphType& lclGraph)
131{
132 typedef typename OffsetsType::non_const_value_type offset_type;
133 typedef typename LclMapType::local_ordinal_type LO;
134 typedef typename LclMapType::global_ordinal_type GO;
135 typedef typename LclMapType::device_type DT;
136
138
139 // The functor's constructor runs the functor.
140 impl_type impl (OffRankOffsets, lclColMap, lclDomMap, lclGraph.row_map, lclGraph.entries);
141}
142
143} // namespace Details
144} // namespace Tpetra
145
146#endif // TPETRA_DETAILS_GETGRAPHOFFRANKOFFSETS_DECL_HPP
Declaration and definition of the Tpetra::Map class, an implementation detail of Tpetra::Map.
Implementation detail of Tpetra::Details::getGraphOffRankOffsets, which in turn is an implementation ...
KOKKOS_FUNCTION void operator()(const LO &lclRowInd) const
Kokkos::parallel_for loop body.
Implementation details of Tpetra.
Namespace Tpetra contains the class and methods constituting the Tpetra library.