MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp
Go to the documentation of this file.
1// @HEADER
2//
3// ***********************************************************************
4//
5// MueLu: A package for multigrid based preconditioning
6// Copyright 2012 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
39// Jonathan Hu (jhu@sandia.gov)
40// Andrey Prokopenko (aprokop@sandia.gov)
41// Ray Tuminaro (rstumin@sandia.gov)
42//
43// ***********************************************************************
44//
45// @HEADER
46#ifndef MUELU_AGGREGATIONSTRUCTUREDALGORITHM_KOKKOS_DECL_HPP
47#define MUELU_AGGREGATIONSTRUCTUREDALGORITHM_KOKKOS_DECL_HPP
48
49#include "MueLu_ConfigDefs.hpp"
52
56#include "MueLu_LWGraph_kokkos.hpp"
57
58namespace MueLu {
73 template<class LocalOrdinal = DefaultLocalOrdinal,
75 class Node = DefaultNode>
77 public MueLu::AggregationAlgorithmBase_kokkos<LocalOrdinal,GlobalOrdinal,Node> {
78#undef MUELU_AGGREGATIONSTRUCTUREDALGORITHM_KOKKOS_SHORT
80
81 public:
82
83 using local_graph_type = typename LWGraph_kokkos::local_graph_type;
84 using non_const_row_map_type = typename local_graph_type::row_map_type::non_const_type;
85 using size_type = typename local_graph_type::size_type;
86 using entries_type = typename local_graph_type::entries_type;
87 using device_type = typename local_graph_type::device_type;
88 using execution_space = typename local_graph_type::device_type::execution_space;
89 using memory_space = typename local_graph_type::device_type::memory_space;
90
91 using LOVectorView = decltype(std::declval<LOVector>().getDeviceLocalView(Xpetra::Access::ReadWrite));
92 using constIntTupleView = typename Kokkos::View<const int[3], device_type>;
93 using constLOTupleView = typename Kokkos::View<const LO[3], device_type>;
94
96
97
100
103
105
106
108
109
112 void BuildAggregates(const Teuchos::ParameterList& params,
113 const LWGraph_kokkos& graph,
114 Aggregates_kokkos& aggregates,
115 Kokkos::View<unsigned*, device_type>& aggStat,
116 LO& numNonAggregatedNodes) const;
117
120 void BuildGraph(const LWGraph_kokkos& graph,
121 RCP<IndexManager_kokkos>& geoData,
122 const LO dofsPerNode,
123 RCP<CrsGraph>& myGraph) const;
125
126 std::string description() const { return "Aggretation: structured algorithm"; }
127
129
131 const int myRank_;
132 Kokkos::View<unsigned*, device_type> aggStat_;
135
136 fillAggregatesFunctor(RCP<IndexManager_kokkos> geoData,
137 const int myRank,
138 Kokkos::View<unsigned*, device_type> aggStat,
139 LOVectorView vertex2AggID,
140 LOVectorView procWinner);
141
142 KOKKOS_INLINE_FUNCTION
143 void operator() (const LO nodeIdx, LO& lNumAggregatedNodes) const;
144
145 }; // struct fillAggregatesFunctor
146
148
151 const LO dofsPerNode_;
157
158
159 computeGraphDataConstantFunctor(RCP<IndexManager_kokkos> geoData,
160 const LO numGhostedNodes, const LO dofsPerNode,
161 constIntTupleView coarseRate, constIntTupleView endRate,
162 constLOTupleView lFineNodesPerDir,
163 non_const_row_map_type rowPtr, entries_type colIndex);
164
165 KOKKOS_INLINE_FUNCTION
166 void operator() (const LO nodeIdx) const;
167
168 }; // struct computeGraphDataConstantFunctor
169
171
173 const LO dofsPerNode_;
179
180 computeGraphRowPtrFunctor(RCP<IndexManager_kokkos> geoData,
181 const LO dofsPerNode,
182 const int numInterpolationPoints, const LO numLocalRows,
183 constIntTupleView coarseRate, constLOTupleView lFineNodesPerDir,
185
186 KOKKOS_INLINE_FUNCTION
187 void operator() (const LO rowIdx, GO& update, const bool final) const;
188 }; // struct computeGraphRowPtrFunctor
189
191
193 const int numDimensions_;
195 const LO dofsPerNode_;
203
204
205 computeGraphDataLinearFunctor(RCP<IndexManager_kokkos> geoData,
206 const int numDimensions,
207 const LO numGhostedNodes, const LO dofsPerNode,
208 const int numInterpolationPoints,
209 constIntTupleView coarseRate, constIntTupleView endRate,
210 constLOTupleView lFineNodesPerDir,
211 constLOTupleView ghostedNodesPerDir,
212 non_const_row_map_type rowPtr, entries_type colIndex);
213
214 KOKKOS_INLINE_FUNCTION
215 void operator() (const LO nodeIdx) const;
216
217 }; // struct computeGraphDataLinearFunctor
218
219 }; // class AggregationStructuredAlgorithm_kokkos
220
221} //namespace MueLu
222
223#define MUELU_AGGREGATIONSTRUCTUREDALGORITHM_KOKKOS_SHORT
224#endif /* MUELU_AGGREGATIONSTRUCTUREDALGORITHM_DECL_HPP_ */
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultGlobalOrdinal GlobalOrdinal
MueLu::DefaultNode Node
decltype(std::declval< LOVector >().getDeviceLocalView(Xpetra::Access::ReadWrite)) LOVectorView
typename Kokkos::View< const int[3], device_type > constIntTupleView
typename local_graph_type::row_map_type::non_const_type non_const_row_map_type
typename local_graph_type::device_type::execution_space execution_space
std::string description() const
Return a simple one-line description of this object.
void BuildAggregates(const Teuchos::ParameterList &params, const LWGraph_kokkos &graph, Aggregates_kokkos &aggregates, Kokkos::View< unsigned *, device_type > &aggStat, LO &numNonAggregatedNodes) const
Build aggregates object.
typename Kokkos::View< const LO[3], device_type > constLOTupleView
void BuildGraph(const LWGraph_kokkos &graph, RCP< IndexManager_kokkos > &geoData, const LO dofsPerNode, RCP< CrsGraph > &myGraph) const
Build a CrsGraph instead of aggregates.
typename local_graph_type::device_type::memory_space memory_space
Container class for mesh layout and indices calculation.
Lightweight MueLu representation of a compressed row storage graph.
Namespace for MueLu classes and methods.
KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
KOKKOS_INLINE_FUNCTION void operator()(const LO rowIdx, GO &update, const bool final) const
KOKKOS_INLINE_FUNCTION void operator()(const LO nodeIdx, LO &lNumAggregatedNodes) const