68 Kokkos::View<unsigned*, typename LWGraph_kokkos::device_type>& aggStat,
69 LO& numNonAggregatedNodes)
const {
70 Monitor m(*
this,
"BuildAggregates");
71 using local_ordinal_type =
typename LWGraph_kokkos::local_ordinal_type;
75 const bool preserve = params.get<
bool>(
"aggregation: preserve Dirichlet points");
78 const LO numNodes = graph.GetNodeNumVertices();
79 const int myRank = graph.GetComm()->getRank();
82 auto vertex2AggId = aggregates.GetVertex2AggId()->getDeviceLocalView(Xpetra::Access::ReadWrite);
83 auto procWinner = aggregates.GetProcWinner() ->getDeviceLocalView(Xpetra::Access::ReadWrite);
86 Kokkos::View<LO, device_type> aggCount(
"aggCount");
88 Kokkos::deep_copy(aggCount, aggregates.GetNumAggregates());
90 Kokkos::parallel_for(
"MueLu - PreserveDirichlet: tagging ignored nodes",
91 Kokkos::RangePolicy<local_ordinal_type, execution_space>(0, numNodes),
92 KOKKOS_LAMBDA(
const local_ordinal_type nodeIdx) {
95 const LO aggIdx = Kokkos::atomic_fetch_add(&aggCount(), 1);
100 vertex2AggId(nodeIdx, 0) = aggIdx;
101 procWinner(nodeIdx, 0) = myRank;
105 typename Kokkos::View<LO, device_type>::HostMirror aggCount_h
106 = Kokkos::create_mirror_view(aggCount);
107 Kokkos::deep_copy(aggCount_h, aggCount);
110 numNonAggregatedNodes -= (aggCount_h() - aggregates.GetNumAggregates());
114 aggregates.SetNumAggregates(aggCount_h());