MueLu  Version of the Day
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 
58 namespace 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  typedef typename LWGraph_kokkos::local_graph_type local_graph_type;
84  typedef typename local_graph_type::row_map_type::non_const_type non_const_row_map_type;
85  typedef typename local_graph_type::size_type size_type;
86  typedef typename local_graph_type::entries_type entries_type;
87  typedef typename local_graph_type::device_type::execution_space execution_space;
88  typedef typename local_graph_type::device_type::memory_space memory_space;
89 
90  typedef decltype(std::declval<LOVector>().template getLocalView<memory_space>()) LOVectorView;
91  typedef typename Kokkos::View<const int[3], memory_space> constIntTupleView;
92  typedef typename Kokkos::View<const LO[3], memory_space> constLOTupleView;
93 
95 
96 
99 
102 
104 
105 
107 
108 
111  void BuildAggregates(const Teuchos::ParameterList& params,
112  const LWGraph_kokkos& graph,
113  Aggregates_kokkos& aggregates,
115  LO& numNonAggregatedNodes) const;
116 
119  void BuildGraph(const LWGraph_kokkos& graph,
120  RCP<IndexManager_kokkos>& geoData,
121  const LO dofsPerNode,
122  RCP<CrsGraph>& myGraph) const;
124 
125  std::string description() const { return "Aggretation: structured algorithm"; }
126 
128 
129  IndexManager_kokkos geoData_;
130  const int myRank_;
134 
135  fillAggregatesFunctor(RCP<IndexManager_kokkos> geoData,
136  const int myRank,
138  LOVectorView vertex2AggID,
139  LOVectorView procWinner);
140 
141  KOKKOS_INLINE_FUNCTION
142  void operator() (const LO nodeIdx, LO& lNumAggregatedNodes) const;
143 
144  }; // struct fillAggregatesFunctor
145 
147 
148  IndexManager_kokkos geoData_;
149  const int numGhostedNodes_;
150  const LO dofsPerNode_;
156 
157 
158  computeGraphDataConstantFunctor(RCP<IndexManager_kokkos> geoData,
159  const LO numGhostedNodes, const LO dofsPerNode,
160  constIntTupleView coarseRate, constIntTupleView endRate,
161  constLOTupleView lFineNodesPerDir,
162  non_const_row_map_type rowPtr, entries_type colIndex);
163 
164  KOKKOS_INLINE_FUNCTION
165  void operator() (const LO nodeIdx) const;
166 
167  }; // struct computeGraphDataConstantFunctor
168 
170 
171  IndexManager_kokkos geoData_;
172  const LO dofsPerNode_;
174  const LO numLocalRows_;
178 
179  computeGraphRowPtrFunctor(RCP<IndexManager_kokkos> geoData,
180  const LO dofsPerNode,
181  const int numInterpolationPoints, const LO numLocalRows,
182  constIntTupleView coarseRate, constLOTupleView lFineNodesPerDir,
183  non_const_row_map_type rowPtr);
184 
185  KOKKOS_INLINE_FUNCTION
186  void operator() (const LO rowIdx, GO& update, const bool final) const;
187  }; // struct computeGraphRowPtrFunctor
188 
190 
191  IndexManager_kokkos geoData_;
192  const int numDimensions_;
193  const int numGhostedNodes_;
194  const LO dofsPerNode_;
202 
203 
204  computeGraphDataLinearFunctor(RCP<IndexManager_kokkos> geoData,
205  const int numDimensions,
206  const LO numGhostedNodes, const LO dofsPerNode,
207  const int numInterpolationPoints,
208  constIntTupleView coarseRate, constIntTupleView endRate,
209  constLOTupleView lFineNodesPerDir,
210  constLOTupleView ghostedNodesPerDir,
211  non_const_row_map_type rowPtr, entries_type colIndex);
212 
213  KOKKOS_INLINE_FUNCTION
214  void operator() (const LO nodeIdx) const;
215 
216  }; // struct computeGraphDataLinearFunctor
217 
218  }; // class AggregationStructuredAlgorithm_kokkos
219 
220 } //namespace MueLu
221 
222 #define MUELU_AGGREGATIONSTRUCTUREDALGORITHM_KOKKOS_SHORT
223 #endif /* MUELU_AGGREGATIONSTRUCTUREDALGORITHM_DECL_HPP_ */
MueLu_ConfigDefs.hpp
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphRowPtrFunctor::operator()
KOKKOS_INLINE_FUNCTION void operator()(const LO rowIdx, GO &update, const bool final) const
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_def.hpp:316
MueLu::AggregationStructuredAlgorithm_kokkos
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:77
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphRowPtrFunctor::coarseRate_
constIntTupleView coarseRate_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:175
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataConstantFunctor::operator()
KOKKOS_INLINE_FUNCTION void operator()(const LO nodeIdx) const
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_def.hpp:267
MueLu::AggregationStructuredAlgorithm_kokkos::execution_space
local_graph_type::device_type::execution_space execution_space
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:87
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphRowPtrFunctor
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:169
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataConstantFunctor::coarseRate_
constIntTupleView coarseRate_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:151
MueLu::AggregationStructuredAlgorithm_kokkos::fillAggregatesFunctor::operator()
KOKKOS_INLINE_FUNCTION void operator()(const LO nodeIdx, LO &lNumAggregatedNodes) const
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_def.hpp:219
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphRowPtrFunctor::lFineNodesPerDir_
constLOTupleView lFineNodesPerDir_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:176
MueLu::AggregationStructuredAlgorithm_kokkos::BuildAggregates
void BuildAggregates(const Teuchos::ParameterList &params, const LWGraph_kokkos &graph, Aggregates_kokkos &aggregates, Kokkos::View< unsigned *, memory_space > &aggStat, LO &numNonAggregatedNodes) const
Build aggregates object.
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_def.hpp:70
string
DASHPOS string(SUBSTRING ${CLASS} 0 ${DASHPOS} CLASS_NAME) set(CONDITION_NAME "") set(CONDITION_NAME_END "") string(SUBSTRING $
Definition: src/CMakeLists.txt:134
MueLu::AggregationStructuredAlgorithm_kokkos::~AggregationStructuredAlgorithm_kokkos
virtual ~AggregationStructuredAlgorithm_kokkos()
Destructor.
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:101
MueLu_AggregationStructuredAlgorithm_kokkos_fwd.hpp
MueLu_Aggregates_kokkos_fwd.hpp
MueLu::AggregationStructuredAlgorithm_kokkos::LOVectorView
decltype(std::declval< LOVector >().template getLocalView< memory_space >()) typedef LOVectorView
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:90
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataConstantFunctor
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:146
MueLu::AggregationStructuredAlgorithm_kokkos::entries_type
local_graph_type::entries_type entries_type
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:86
MueLu::AggregationStructuredAlgorithm_kokkos::size_type
local_graph_type::size_type size_type
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:85
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataLinearFunctor::geoData_
IndexManager_kokkos geoData_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:191
MueLu::AggregationStructuredAlgorithm_kokkos::fillAggregatesFunctor::aggStat_
Kokkos::View< unsigned *, memory_space > aggStat_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:131
MueLu_AggregationAlgorithmBase_kokkos.hpp
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphRowPtrFunctor::computeGraphRowPtrFunctor
computeGraphRowPtrFunctor(RCP< IndexManager_kokkos > geoData, const LO dofsPerNode, const int numInterpolationPoints, const LO numLocalRows, constIntTupleView coarseRate, constLOTupleView lFineNodesPerDir, non_const_row_map_type rowPtr)
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_def.hpp:302
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataConstantFunctor::rowPtr_
non_const_row_map_type rowPtr_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:154
GlobalOrdinal
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Definition: MueLu_UseDefaultTypes.hpp:51
MueLu
Namespace for MueLu classes and methods.
Definition: MueLu_BrickAggregationFactory_decl.hpp:76
MueLu::DefaultLocalOrdinal
int DefaultLocalOrdinal
Definition: MueLu_Details_DefaultTypes.hpp:56
MueLu::AggregationStructuredAlgorithm_kokkos::fillAggregatesFunctor::vertex2AggID_
LOVectorView vertex2AggID_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:132
MueLu::AggregationStructuredAlgorithm_kokkos::BuildGraph
void BuildGraph(const LWGraph_kokkos &graph, RCP< IndexManager_kokkos > &geoData, const LO dofsPerNode, RCP< CrsGraph > &myGraph) const
Build a CrsGraph instead of aggregates.
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_def.hpp:111
Node
MueLu::DefaultNode Node
Definition: MueLu_UseDefaultTypes.hpp:52
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataLinearFunctor
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:189
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphRowPtrFunctor::numLocalRows_
const LO numLocalRows_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:174
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataLinearFunctor::operator()
KOKKOS_INLINE_FUNCTION void operator()(const LO nodeIdx) const
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_def.hpp:364
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataConstantFunctor::endRate_
constIntTupleView endRate_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:152
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataLinearFunctor::dofsPerNode_
const LO dofsPerNode_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:194
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataConstantFunctor::numGhostedNodes_
const int numGhostedNodes_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:149
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataConstantFunctor::dofsPerNode_
const LO dofsPerNode_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:150
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataConstantFunctor::computeGraphDataConstantFunctor
computeGraphDataConstantFunctor(RCP< IndexManager_kokkos > geoData, const LO numGhostedNodes, const LO dofsPerNode, constIntTupleView coarseRate, constIntTupleView endRate, constLOTupleView lFineNodesPerDir, non_const_row_map_type rowPtr, entries_type colIndex)
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_def.hpp:250
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphRowPtrFunctor::dofsPerNode_
const LO dofsPerNode_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:172
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataLinearFunctor::coarseRate_
constIntTupleView coarseRate_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:196
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphRowPtrFunctor::geoData_
IndexManager_kokkos geoData_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:171
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataConstantFunctor::lFineNodesPerDir_
constLOTupleView lFineNodesPerDir_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:153
MueLu::AggregationStructuredAlgorithm_kokkos::local_graph_type
LWGraph_kokkos::local_graph_type local_graph_type
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:83
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphRowPtrFunctor::numInterpolationPoints_
const int numInterpolationPoints_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:173
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphRowPtrFunctor::rowPtr_
non_const_row_map_type rowPtr_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:177
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataLinearFunctor::computeGraphDataLinearFunctor
computeGraphDataLinearFunctor(RCP< IndexManager_kokkos > geoData, const int numDimensions, const LO numGhostedNodes, const LO dofsPerNode, const int numInterpolationPoints, constIntTupleView coarseRate, constIntTupleView endRate, constLOTupleView lFineNodesPerDir, constLOTupleView ghostedNodesPerDir, non_const_row_map_type rowPtr, entries_type colIndex)
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_def.hpp:342
MueLu::DefaultNode
KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
Definition: MueLu_Details_DefaultTypes.hpp:66
MueLu::AggregationStructuredAlgorithm_kokkos::fillAggregatesFunctor
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:127
MueLu::AggregationStructuredAlgorithm_kokkos::non_const_row_map_type
local_graph_type::row_map_type::non_const_type non_const_row_map_type
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:84
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataLinearFunctor::rowPtr_
non_const_row_map_type rowPtr_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:200
MueLu::AggregationStructuredAlgorithm_kokkos::fillAggregatesFunctor::geoData_
IndexManager_kokkos geoData_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:129
MueLu_FactoryBase_fwd.hpp
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataLinearFunctor::lFineNodesPerDir_
constLOTupleView lFineNodesPerDir_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:198
MueLu::AggregationStructuredAlgorithm_kokkos::description
std::string description() const
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:125
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataLinearFunctor::colIndex_
entries_type colIndex_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:201
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataConstantFunctor::colIndex_
entries_type colIndex_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:155
MueLu_UseShortNamesOrdinal.hpp
Kokkos::View< const int[3], memory_space >
MueLu::AggregationStructuredAlgorithm_kokkos::memory_space
local_graph_type::device_type::memory_space memory_space
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:88
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataLinearFunctor::numDimensions_
const int numDimensions_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:192
Kokkos
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataLinearFunctor::numInterpolationPoints_
const int numInterpolationPoints_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:195
MueLu::AggregationStructuredAlgorithm_kokkos::fillAggregatesFunctor::fillAggregatesFunctor
fillAggregatesFunctor(RCP< IndexManager_kokkos > geoData, const int myRank, Kokkos::View< unsigned *, memory_space > aggStat, LOVectorView vertex2AggID, LOVectorView procWinner)
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_def.hpp:208
MueLu::DefaultGlobalOrdinal
int DefaultGlobalOrdinal
Definition: MueLu_Details_DefaultTypes.hpp:63
MueLu::AggregationStructuredAlgorithm_kokkos::fillAggregatesFunctor::myRank_
const int myRank_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:130
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataLinearFunctor::endRate_
constIntTupleView endRate_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:197
MueLu::AggregationStructuredAlgorithm_kokkos::fillAggregatesFunctor::procWinner_
LOVectorView procWinner_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:133
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataLinearFunctor::ghostedNodesPerDir_
constLOTupleView ghostedNodesPerDir_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:199
MueLu_IndexManager_kokkos_fwd.hpp
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataConstantFunctor::geoData_
IndexManager_kokkos geoData_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:148
MueLu::AggregationStructuredAlgorithm_kokkos::computeGraphDataLinearFunctor::numGhostedNodes_
const int numGhostedNodes_
Definition: MueLu_AggregationStructuredAlgorithm_kokkos_decl.hpp:193
LocalOrdinal
MueLu::DefaultLocalOrdinal LocalOrdinal
Definition: MueLu_UseDefaultTypes.hpp:50