MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 = int,
74  class GlobalOrdinal = LocalOrdinal,
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 */, const LWGraph_kokkos& /* graph */,
112  Aggregates_kokkos& /* aggregates */,
113  std::vector<unsigned>& /* aggStat */,
114  LO& /* numNonAggregatedNodes */) const {};
115 
116  void BuildAggregates(const Teuchos::ParameterList& params, const LWGraph_kokkos& graph,
117  Aggregates_kokkos& aggregates,
119  LO& numNonAggregatedNodes) const;
120 
123  void BuildGraph(const LWGraph_kokkos& graph, RCP<IndexManager_kokkos>& geoData,
124  const LO dofsPerNode, RCP<CrsGraph>& myGraph) const;
126 
127  std::string description() const { return "Aggretation: structured algorithm"; }
128 
130 
131  IndexManager_kokkos geoData_;
132  const int myRank_;
136 
138  const int myRank,
140  LOVectorView vertex2AggID,
141  LOVectorView procWinner);
142 
143  KOKKOS_INLINE_FUNCTION
144  void operator() (const LO nodeIdx, LO& lNumAggregatedNodes) const;
145 
146  }; // struct fillAggregatesFunctor
147 
149 
150  IndexManager_kokkos geoData_;
151  const int numGhostedNodes_;
158 
159 
161  const LO numGhostedNodes, const LO dofsPerNode,
162  constIntTupleView coarseRate, constIntTupleView endRate,
163  constLOTupleView lFineNodesPerDir,
164  non_const_row_map_type rowPtr, entries_type colIndex);
165 
166  KOKKOS_INLINE_FUNCTION
167  void operator() (const LO nodeIdx) const;
168 
169  }; // struct computeGraphDataConstantFunctor
170 
172 
173  IndexManager_kokkos geoData_;
180 
182  const LO dofsPerNode,
183  const int numInterpolationPoints, const LO numLocalRows,
184  constIntTupleView coarseRate, constLOTupleView lFineNodesPerDir,
185  non_const_row_map_type rowPtr);
186 
187  KOKKOS_INLINE_FUNCTION
188  void operator() (const LO rowIdx, GO& update, const bool final) const;
189  }; // struct computeGraphRowPtrFunctor
190 
192 
193  IndexManager_kokkos geoData_;
194  const int numDimensions_;
195  const int numGhostedNodes_;
204 
205 
207  const int numDimensions,
208  const LO numGhostedNodes, const LO dofsPerNode,
209  const int numInterpolationPoints,
210  constIntTupleView coarseRate, constIntTupleView endRate,
211  constLOTupleView lFineNodesPerDir,
212  constLOTupleView ghostedNodesPerDir,
213  non_const_row_map_type rowPtr, entries_type colIndex);
214 
215  KOKKOS_INLINE_FUNCTION
216  void operator() (const LO nodeIdx) const;
217 
218  }; // struct computeGraphDataLinearFunctor
219 
220  }; // class AggregationStructuredAlgorithm_kokkos
221 
222 } //namespace MueLu
223 
224 #define MUELU_AGGREGATIONSTRUCTUREDALGORITHM_KOKKOS_SHORT
225 #endif /* MUELU_AGGREGATIONSTRUCTUREDALGORITHM_DECL_HPP_ */
GlobalOrdinal GO
LocalOrdinal LO
decltype(std::declval< LOVector >().template getLocalView< memory_space >()) typedef LOVectorView
computeGraphRowPtrFunctor(RCP< IndexManager_kokkos > geoData, const LO dofsPerNode, const int numInterpolationPoints, const LO numLocalRows, constIntTupleView coarseRate, constLOTupleView lFineNodesPerDir, non_const_row_map_type rowPtr)
KOKKOS_INLINE_FUNCTION void operator()(const LO rowIdx, GO &update, const bool final) const
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)
fillAggregatesFunctor(RCP< IndexManager_kokkos > geoData, const int myRank, Kokkos::View< unsigned *, memory_space > aggStat, LOVectorView vertex2AggID, LOVectorView procWinner)
KOKKOS_INLINE_FUNCTION void operator()(const LO nodeIdx, LO &lNumAggregatedNodes) const
void BuildAggregates(const Teuchos::ParameterList &, const LWGraph_kokkos &, Aggregates_kokkos &, std::vector< unsigned > &, LO &) const
Local aggregation.
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)
void BuildGraph(const LWGraph_kokkos &graph, RCP< IndexManager_kokkos > &geoData, const LO dofsPerNode, RCP< CrsGraph > &myGraph) const
Local aggregation.