400 typedef typename Teuchos::ScalarTraits<Scalar>::coordinateType coordinate_type;
401 typedef Xpetra::MultiVectorFactory<coordinate_type, LO, GO, NO> RealValuedMultiVectorFactory;
402 const ParameterList& pL = GetParameterList();
403 std::string nspName =
"Nullspace";
404 if (pL.isParameter(
"Nullspace name")) nspName = pL.get<std::string>(
"Nullspace name");
406 auto A = Get<RCP<Matrix>>(fineLevel,
"A");
407 auto aggregates = Get<RCP<Aggregates>>(fineLevel,
"Aggregates");
408 auto amalgInfo = Get<RCP<AmalgamationInfo>>(fineLevel,
"UnAmalgamationInfo");
409 auto fineNullspace = Get<RCP<MultiVector>>(fineLevel, nspName);
410 auto coarseMap = Get<RCP<const Map>>(fineLevel,
"CoarseMap");
411 RCP<RealValuedMultiVector> fineCoords;
412 if (bTransferCoordinates_) {
413 fineCoords = Get<RCP<RealValuedMultiVector>>(fineLevel,
"Coordinates");
416 RCP<Matrix> Ptentative;
419 if (aggregates->GetNumGlobalAggregatesComputeIfNeeded() == 0) {
420 Ptentative = Teuchos::null;
421 Set(coarseLevel,
"P", Ptentative);
424 RCP<MultiVector> coarseNullspace;
425 RCP<RealValuedMultiVector> coarseCoords;
427 if (bTransferCoordinates_) {
428 RCP<const Map> coarseCoordMap;
431 if (rcp_dynamic_cast<const StridedMap>(coarseMap) != Teuchos::null)
432 blkSize = rcp_dynamic_cast<const StridedMap>(coarseMap)->getFixedBlockSize();
437 coarseCoordMap = coarseMap;
443 coarseCoords = RealValuedMultiVectorFactory::Build(coarseCoordMap, fineCoords->getNumVectors(),
false);
446 auto uniqueMap = fineCoords->getMap();
447 RCP<RealValuedMultiVector> ghostedCoords = fineCoords;
448 if (aggregates->AggregatesCrossProcessors()) {
449 auto nonUniqueMap = aggregates->GetMap();
450 auto importer = ImportFactory::Build(uniqueMap, nonUniqueMap);
452 ghostedCoords = RealValuedMultiVectorFactory::Build(nonUniqueMap, fineCoords->getNumVectors(),
false);
453 ghostedCoords->doImport(*fineCoords, *importer, Xpetra::INSERT);
458 auto aggGraph = aggregates->GetGraph();
459 auto numAggs = aggGraph.numRows();
461 auto fineCoordsView = fineCoords->getLocalViewDevice(Tpetra::Access::ReadOnly);
462 auto coarseCoordsView = coarseCoords->getLocalViewDevice(Tpetra::Access::OverwriteAll);
468 const auto dim = fineCoords->getNumVectors();
470 typename AppendTrait<
decltype(fineCoordsView), Kokkos::RandomAccess>::type fineCoordsRandomView = fineCoordsView;
471 for (
size_t j = 0; j < dim; j++) {
472 Kokkos::parallel_for(
473 "MueLu::TentativeP::BuildCoords", Kokkos::RangePolicy<local_ordinal_type, execution_space>(0, numAggs),
474 KOKKOS_LAMBDA(
const LO i) {
478 auto aggregate = aggGraph.rowConst(i);
480 coordinate_type sum = 0.0;
481 for (
size_t colID = 0; colID < static_cast<size_t>(aggregate.length); colID++)
482 sum += fineCoordsRandomView(aggregate(colID), j);
484 coarseCoordsView(i, j) = sum / aggregate.length;
490 if (!aggregates->AggregatesCrossProcessors()) {
491 if (Xpetra::Helpers<SC, LO, GO, NO>::isTpetraBlockCrs(A)) {
492 BuildPuncoupledBlockCrs(coarseLevel, A, aggregates, amalgInfo, fineNullspace, coarseMap, Ptentative, coarseNullspace,
495 BuildPuncoupled(coarseLevel, A, aggregates, amalgInfo, fineNullspace, coarseMap, Ptentative, coarseNullspace, coarseLevel.
GetLevelID());
498 BuildPcoupled(A, aggregates, amalgInfo, fineNullspace, coarseMap, Ptentative, coarseNullspace);
508 if (A->IsView(
"stridedMaps") ==
true)
509 Ptentative->CreateView(
"stridedMaps", A->getRowMap(
"stridedMaps"), coarseMap);
511 Ptentative->CreateView(
"stridedMaps", Ptentative->getRangeMap(), coarseMap);
513 if (bTransferCoordinates_) {
514 Set(coarseLevel,
"Coordinates", coarseCoords);
519 RCP<const Teuchos::Comm<int>> nodeComm = Get<RCP<const Teuchos::Comm<int>>>(fineLevel,
"Node Comm");
520 Set<RCP<const Teuchos::Comm<int>>>(coarseLevel,
"Node Comm", nodeComm);
523 Set(coarseLevel,
"Nullspace", coarseNullspace);
524 Set(coarseLevel,
"P", Ptentative);
527 RCP<ParameterList> params = rcp(
new ParameterList());
528 params->set(
"printLoadBalancingInfo",
true);
536 RCP<AmalgamationInfo> amalgInfo, RCP<MultiVector> fineNullspace,
537 RCP<const Map> coarseMap, RCP<Matrix>& Ptentative,
538 RCP<MultiVector>& coarseNullspace,
const int levelID)
const {
539 auto rowMap = A->getRowMap();
540 auto colMap = A->getColMap();
542 const size_t numRows = rowMap->getLocalNumElements();
543 const size_t NSDim = fineNullspace->getNumVectors();
545 typedef KokkosKernels::ArithTraits<SC> ATS;
546 using impl_SC =
typename ATS::val_type;
547 using impl_ATS = KokkosKernels::ArithTraits<impl_SC>;
548 const impl_SC zero = impl_ATS::zero(), one = impl_ATS::one();
550 const LO INVALID = Teuchos::OrdinalTraits<LO>::invalid();
555 aggGraph = aggregates->GetGraph();
557 auto aggRows = aggGraph.row_map;
558 auto aggCols = aggGraph.entries;
566 goodMap = isGoodMap(*rowMap, *colMap);
570 "MueLu: TentativePFactory_kokkos: for now works only with good maps "
571 "(i.e. \"matching\" row and column maps)");
580 LO fullBlockSize, blockID, stridingOffset, stridedBlockSize;
582 amalgInfo->GetStridingInformation(fullBlockSize, blockID, stridingOffset, stridedBlockSize, indexBase);
583 GO globalOffset = amalgInfo->GlobalOffset();
586 auto procWinner = aggregates->GetProcWinner()->getLocalViewDevice(Tpetra::Access::ReadOnly);
587 auto vertex2AggId = aggregates->GetVertex2AggId()->getLocalViewDevice(Tpetra::Access::ReadOnly);
588 const size_t numAggregates = aggregates->GetNumAggregates();
590 int myPID = aggregates->GetMap()->getComm()->getRank();
595 typedef typename Aggregates::aggregates_sizes_type::non_const_type AggSizeType;
596 AggSizeType aggDofSizes;
598 if (stridedBlockSize == 1) {
602 aggDofSizes = AggSizeType(
"agg_dof_sizes", numAggregates + 1);
604 auto sizesConst = aggregates->ComputeAggregateSizes();
605 Kokkos::deep_copy(Kokkos::subview(aggDofSizes, Kokkos::make_pair(
static_cast<size_t>(1), numAggregates + 1)), sizesConst);
611 aggDofSizes = AggSizeType(
"agg_dof_sizes", numAggregates + 1);
613 auto nodeMap = aggregates->GetMap()->getLocalMap();
614 auto dofMap = colMap->getLocalMap();
616 Kokkos::parallel_for(
617 "MueLu:TentativePF:Build:compute_agg_sizes",
range_type(0, numAggregates),
618 KOKKOS_LAMBDA(
const LO agg) {
619 auto aggRowView = aggGraph.rowConst(agg);
622 for (LO colID = 0; colID < aggRowView.length; colID++) {
623 GO nodeGID = nodeMap.getGlobalElement(aggRowView(colID));
625 for (LO k = 0; k < stridedBlockSize; k++) {
626 GO dofGID = (nodeGID - indexBase) * fullBlockSize + k + indexBase + globalOffset + stridingOffset;
628 if (dofMap.getLocalElement(dofGID) != INVALID)
632 aggDofSizes(agg + 1) = size;
639 ReduceMaxFunctor<LO,
decltype(aggDofSizes)> reduceMax(aggDofSizes);
640 Kokkos::parallel_reduce(
"MueLu:TentativePF:Build:max_agg_size",
range_type(0, aggDofSizes.extent(0)), reduceMax, maxAggSize);
644 Kokkos::parallel_scan(
645 "MueLu:TentativePF:Build:aggregate_sizes:stage1_scan",
range_type(0, numAggregates + 1),
646 KOKKOS_LAMBDA(
const LO i, LO& update,
const bool& final_pass) {
647 update += aggDofSizes(i);
649 aggDofSizes(i) = update;
654 Kokkos::View<LO*, DeviceType>
agg2RowMapLO(Kokkos::ViewAllocateWithoutInitializing(
"agg2row_map_LO"), numRows);
658 AggSizeType aggOffsets(Kokkos::ViewAllocateWithoutInitializing(
"aggOffsets"), numAggregates);
659 Kokkos::deep_copy(aggOffsets, Kokkos::subview(aggDofSizes, Kokkos::make_pair(
static_cast<size_t>(0), numAggregates)));
661 Kokkos::parallel_for(
662 "MueLu:TentativePF:Build:createAgg2RowMap",
range_type(0, vertex2AggId.extent(0)),
663 KOKKOS_LAMBDA(
const LO lnode) {
664 if (procWinner(lnode, 0) == myPID) {
666 auto aggID = vertex2AggId(lnode, 0);
668 auto offset = Kokkos::atomic_fetch_add(&aggOffsets(aggID), stridedBlockSize);
672 for (LO k = 0; k < stridedBlockSize; k++)
673 agg2RowMapLO(offset + k) = lnode * stridedBlockSize + k;
680 coarseNullspace = MultiVectorFactory::Build(coarseMap, NSDim,
true);
683 auto fineNS = fineNullspace->getLocalViewDevice(Tpetra::Access::ReadWrite);
684 auto coarseNS = coarseNullspace->getLocalViewDevice(Tpetra::Access::ReadWrite);
688 typedef typename Xpetra::Matrix<SC, LO, GO, NO>::local_matrix_device_type local_matrix_type;
689 typedef typename local_matrix_type::row_map_type::non_const_type rows_type;
690 typedef typename local_matrix_type::index_type::non_const_type cols_type;
691 typedef typename local_matrix_type::values_type::non_const_type vals_type;
694 typedef Kokkos::View<int[10], DeviceType> status_type;
695 status_type status(
"status");
700 const ParameterList& pL = GetParameterList();
701 const bool&
doQRStep = pL.get<
bool>(
"tentative: calculate qr");
703 GetOStream(
Runtime1) <<
"TentativePFactory : bypassing local QR phase" << std::endl;
705 GetOStream(
Warnings0) <<
"TentativePFactor : for nontrivial nullspace, this may degrade performance" << std::endl;
708 size_t nnzEstimate = numRows * NSDim;
709 rows_type
rowsAux(Kokkos::ViewAllocateWithoutInitializing(
"Ptent_aux_rows"), numRows + 1);
710 cols_type
colsAux(Kokkos::ViewAllocateWithoutInitializing(
"Ptent_aux_cols"), nnzEstimate);
711 vals_type
valsAux(
"Ptent_aux_vals", nnzEstimate);
712 rows_type
rows(
"Ptent_rows", numRows + 1);
719 Kokkos::parallel_for(
720 "MueLu:TentativePF:BuildPuncoupled:for1",
range_type(0, numRows + 1),
721 KOKKOS_LAMBDA(
const LO row) {
724 Kokkos::parallel_for(
725 "MueLu:TentativePF:BuildUncoupled:for2",
range_type(0, nnzEstimate),
726 KOKKOS_LAMBDA(
const LO j) {
743 const Kokkos::TeamPolicy<execution_space> policy(numAggregates, 1);
746 Kokkos::parallel_for(
747 "MueLu:TentativePF:BuildUncoupled:main_loop", policy,
748 KOKKOS_LAMBDA(
const typename Kokkos::TeamPolicy<execution_space>::member_type& thread) {
749 auto agg = thread.league_rank();
757 auto norm = impl_ATS::magnitude(zero);
762 for (
decltype(aggSize) k = 0; k < aggSize; k++) {
764 norm += dnorm * dnorm;
778 for (
decltype(aggSize) k = 0; k < aggSize; k++) {
782 rows(localRow + 1) = 1;
788 typename status_type::host_mirror_type statusHost = Kokkos::create_mirror_view(status);
789 Kokkos::deep_copy(statusHost, status);
790 for (
decltype(statusHost.size()) i = 0; i < statusHost.size(); i++)
792 std::ostringstream oss;
793 oss <<
"MueLu::TentativePFactory::MakeTentative: ";
795 case 0: oss <<
"!goodMap is not implemented";
break;
796 case 1: oss <<
"fine level NS part has a zero column";
break;
802 Kokkos::parallel_for(
803 "MueLu:TentativePF:BuildUncoupled:main_loop_noqr", policy,
804 KOKKOS_LAMBDA(
const typename Kokkos::TeamPolicy<execution_space>::member_type& thread) {
805 auto agg = thread.league_rank();
814 for (
decltype(aggSize) k = 0; k < aggSize; k++) {
818 rows(localRow + 1) = 1;
825 Kokkos::parallel_reduce(
826 "MueLu:TentativeP:CountNNZ",
range_type(0, numRows + 1),
827 KOKKOS_LAMBDA(
const LO i,
size_t& nnz_count) {
828 nnz_count +=
rows(i);
846 const Kokkos::TeamPolicy<execution_space> policy(numAggregates, 1);
848 decltype(aggDofSizes ),
decltype(maxAggSize),
decltype(
agg2RowMapLO),
853 Kokkos::parallel_reduce(
"MueLu:TentativePF:BuildUncoupled:main_qr_loop", policy, localQRFunctor, nnz);
856 typename status_type::host_mirror_type statusHost = Kokkos::create_mirror_view(status);
857 Kokkos::deep_copy(statusHost, status);
858 for (
decltype(statusHost.size()) i = 0; i < statusHost.size(); i++)
860 std::ostringstream oss;
861 oss <<
"MueLu::TentativePFactory::MakeTentative: ";
863 case 0: oss <<
"!goodMap is not implemented";
break;
864 case 1: oss <<
"fine level NS part has a zero column";
break;
877 if (nnz != nnzEstimate) {
882 Kokkos::parallel_scan(
883 "MueLu:TentativePF:Build:compress_rows",
range_type(0, numRows + 1),
884 KOKKOS_LAMBDA(
const LO i, LO& upd,
const bool&
final) {
894 cols = cols_type(
"Ptent_cols", nnz);
895 vals = vals_type(
"Ptent_vals", nnz);
900 Kokkos::parallel_for(
901 "MueLu:TentativePF:Build:compress_cols_vals",
range_type(0, numRows),
902 KOKKOS_LAMBDA(
const LO i) {
903 LO rowStart =
rows(i);
908 cols(rowStart + lnnz) =
colsAux(j);
909 vals(rowStart + lnnz) =
valsAux(j);
921 GetOStream(
Runtime1) <<
"TentativePFactory : aggregates do not cross process boundaries" << std::endl;
927 local_matrix_type lclMatrix = local_matrix_type(
"A", numRows, coarseMap->getLocalNumElements(), nnz, vals,
rows, cols);
930 RCP<ParameterList> FCparams;
931 if (pL.isSublist(
"matrixmatrix: kernel params"))
932 FCparams = rcp(
new ParameterList(pL.sublist(
"matrixmatrix: kernel params")));
934 FCparams = rcp(
new ParameterList);
937 FCparams->set(
"compute global constants", FCparams->get(
"compute global constants",
false));
938 FCparams->set(
"Timer Label", std::string(
"MueLu::TentativeP-") +
toString(levelID));
940 auto PtentCrs = CrsMatrixFactory::Build(lclMatrix, rowMap, coarseMap, coarseMap, A->getDomainMap());
941 Ptentative = rcp(
new CrsMatrixWrap(PtentCrs));
948 RCP<AmalgamationInfo> amalgInfo, RCP<MultiVector> fineNullspace,
949 RCP<const Map> coarsePointMap, RCP<Matrix>& Ptentative,
950 RCP<MultiVector>& coarseNullspace,
const int levelID)
const {
960 RCP<const Map> rowMap = A->getRowMap();
961 RCP<const Map> rangeMap = A->getRangeMap();
962 RCP<const Map> colMap = A->getColMap();
964 const size_t numFineBlockRows = rowMap->getLocalNumElements();
968 const LO INVALID = Teuchos::OrdinalTraits<LO>::invalid();
970 typedef KokkosKernels::ArithTraits<SC> ATS;
971 using impl_SC =
typename ATS::val_type;
972 using impl_ATS = KokkosKernels::ArithTraits<impl_SC>;
973 const impl_SC one = impl_ATS::one();
976 const size_t NSDim = fineNullspace->getNumVectors();
977 auto aggSizes = aggregates->ComputeAggregateSizes();
982 aggGraph = aggregates->GetGraph();
984 auto aggRows = aggGraph.row_map;
985 auto aggCols = aggGraph.entries;
991 const size_t numCoarseBlockRows = coarsePointMap->getLocalNumElements() / NSDim;
992 RCP<const Map> coarseBlockMap = MapFactory::Build(coarsePointMap->lib(),
993 Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid(),
995 coarsePointMap->getIndexBase(),
996 coarsePointMap->getComm());
998 const ParameterList& pL = GetParameterList();
1008 "MueLu: TentativePFactory_kokkos: for now works only with good maps "
1009 "(i.e. \"matching\" row and column maps)");
1018 LO fullBlockSize, blockID, stridingOffset, stridedBlockSize;
1020 amalgInfo->GetStridingInformation(fullBlockSize, blockID, stridingOffset, stridedBlockSize, indexBase);
1024 auto procWinner = aggregates->GetProcWinner()->getLocalViewDevice(Tpetra::Access::ReadOnly);
1025 auto vertex2AggId = aggregates->GetVertex2AggId()->getLocalViewDevice(Tpetra::Access::ReadOnly);
1026 const size_t numAggregates = aggregates->GetNumAggregates();
1028 int myPID = aggregates->GetMap()->getComm()->getRank();
1033 typedef typename Aggregates::aggregates_sizes_type::non_const_type AggSizeType;
1034 AggSizeType aggDofSizes;
1040 aggDofSizes = AggSizeType(
"agg_dof_sizes", numAggregates + 1);
1042 Kokkos::deep_copy(Kokkos::subview(aggDofSizes, Kokkos::make_pair(
static_cast<size_t>(1), numAggregates + 1)), aggSizes);
1048 ReduceMaxFunctor<LO,
decltype(aggDofSizes)> reduceMax(aggDofSizes);
1049 Kokkos::parallel_reduce(
"MueLu:TentativePF:Build:max_agg_size",
range_type(0, aggDofSizes.extent(0)), reduceMax, maxAggSize);
1053 Kokkos::parallel_scan(
1054 "MueLu:TentativePF:Build:aggregate_sizes:stage1_scan",
range_type(0, numAggregates + 1),
1055 KOKKOS_LAMBDA(
const LO i, LO& update,
const bool& final_pass) {
1056 update += aggDofSizes(i);
1058 aggDofSizes(i) = update;
1063 Kokkos::View<LO*, DeviceType> aggToRowMapLO(Kokkos::ViewAllocateWithoutInitializing(
"aggtorow_map_LO"), numFineBlockRows);
1067 AggSizeType aggOffsets(Kokkos::ViewAllocateWithoutInitializing(
"aggOffsets"), numAggregates);
1068 Kokkos::deep_copy(aggOffsets, Kokkos::subview(aggDofSizes, Kokkos::make_pair(
static_cast<size_t>(0), numAggregates)));
1070 Kokkos::parallel_for(
1071 "MueLu:TentativePF:Build:createAgg2RowMap",
range_type(0, vertex2AggId.extent(0)),
1072 KOKKOS_LAMBDA(
const LO lnode) {
1073 if (procWinner(lnode, 0) == myPID) {
1075 auto aggID = vertex2AggId(lnode, 0);
1077 auto offset = Kokkos::atomic_fetch_add(&aggOffsets(aggID), stridedBlockSize);
1081 for (LO k = 0; k < stridedBlockSize; k++)
1082 aggToRowMapLO(offset + k) = lnode * stridedBlockSize + k;
1089 coarseNullspace = MultiVectorFactory::Build(coarsePointMap, NSDim,
true);
1092 auto fineNS = fineNullspace->getLocalViewDevice(Tpetra::Access::ReadWrite);
1093 auto coarseNS = coarseNullspace->getLocalViewDevice(Tpetra::Access::ReadWrite);
1095 typedef typename Xpetra::Matrix<SC, LO, GO, NO>::local_matrix_device_type local_matrix_type;
1096 typedef typename local_matrix_type::row_map_type::non_const_type rows_type;
1097 typedef typename local_matrix_type::index_type::non_const_type cols_type;
1101 typedef Kokkos::View<int[10], DeviceType> status_type;
1102 status_type status(
"status");
1108 GetOStream(
Runtime1) <<
"TentativePFactory : bypassing local QR phase" << std::endl;
1114 rows_type ia(Kokkos::ViewAllocateWithoutInitializing(
"BlockGraph_rowptr"), numFineBlockRows + 1);
1115 cols_type ja(Kokkos::ViewAllocateWithoutInitializing(
"BlockGraph_colind"), numFineBlockRows);
1117 Kokkos::parallel_for(
1118 "MueLu:TentativePF:BlockCrs:graph_init",
range_type(0, numFineBlockRows),
1119 KOKKOS_LAMBDA(
const LO j) {
1123 if (j == (LO)numFineBlockRows - 1)
1124 ia[numFineBlockRows] = numFineBlockRows;
1128 const Kokkos::TeamPolicy<execution_space> policy(numAggregates, 1);
1129 Kokkos::parallel_for(
1130 "MueLu:TentativePF:BlockCrs:fillGraph", policy,
1131 KOKKOS_LAMBDA(
const typename Kokkos::TeamPolicy<execution_space>::member_type& thread) {
1132 auto agg = thread.league_rank();
1133 Xpetra::global_size_t offset = agg;
1138 for (LO j = 0; j < aggSize; j++) {
1140 const LO localRow = aggToRowMapLO[aggDofSizes[agg] + j];
1141 const size_t rowStart = ia[localRow];
1142 ja[rowStart] = offset;
1152 rows_type i_temp(Kokkos::ViewAllocateWithoutInitializing(
"BlockGraph_rowptr"), numFineBlockRows + 1);
1154 Kokkos::parallel_scan(
1155 "MueLu:TentativePF:BlockCrs:compress_rows",
range_type(0, numFineBlockRows),
1156 KOKKOS_LAMBDA(
const LO i, LO& upd,
const bool&
final) {
1159 for (
auto j = ia[i]; j < ia[i + 1]; j++)
1160 if (ja[j] != INVALID)
1162 if (
final && i == (LO)numFineBlockRows - 1)
1163 i_temp[numFineBlockRows] = upd;
1167 cols_type j_temp(Kokkos::ViewAllocateWithoutInitializing(
"BlockGraph_colind"), nnz);
1169 Kokkos::parallel_for(
1170 "MueLu:TentativePF:BlockCrs:compress_cols",
range_type(0, numFineBlockRows),
1171 KOKKOS_LAMBDA(
const LO i) {
1172 size_t rowStart = i_temp[i];
1174 for (
auto j = ia[i]; j < ia[i + 1]; j++)
1175 if (ja[j] != INVALID) {
1176 j_temp[rowStart + lnnz] = ja[j];
1185 RCP<CrsGraph> BlockGraph = CrsGraphFactory::Build(rowMap, coarseBlockMap, ia, ja);
1189 RCP<ParameterList> FCparams;
1190 if (pL.isSublist(
"matrixmatrix: kernel params"))
1191 FCparams = rcp(
new ParameterList(pL.sublist(
"matrixmatrix: kernel params")));
1193 FCparams = rcp(
new ParameterList);
1195 FCparams->set(
"compute global constants", FCparams->get(
"compute global constants",
false));
1196 std::string levelIDs =
toString(levelID);
1197 FCparams->set(
"Timer Label", std::string(
"MueLu::TentativeP-") + levelIDs);
1198 RCP<const Export> dummy_e;
1199 RCP<const Import> dummy_i;
1200 BlockGraph->expertStaticFillComplete(coarseBlockMap, rowMap, dummy_i, dummy_e, FCparams);
1210 RCP<Xpetra::CrsMatrix<SC, LO, GO, NO>> P_xpetra = Xpetra::CrsMatrixFactory<SC, LO, GO, NO>::BuildBlock(BlockGraph, coarsePointMap, rangeMap, NSDim);
1211 RCP<Xpetra::TpetraBlockCrsMatrix<SC, LO, GO, NO>> P_tpetra = rcp_dynamic_cast<Xpetra::TpetraBlockCrsMatrix<SC, LO, GO, NO>>(P_xpetra);
1212 if (P_tpetra.is_null())
throw std::runtime_error(
"BuildPUncoupled: Matrix factory did not return a Tpetra::BlockCrsMatrix");
1213 RCP<CrsMatrixWrap> P_wrap = rcp(
new CrsMatrixWrap(P_xpetra));
1215 auto values = P_tpetra->getTpetra_BlockCrsMatrix()->getValuesDeviceNonConst();
1216 const LO stride = NSDim * NSDim;
1218 Kokkos::parallel_for(
1219 "MueLu:TentativePF:BlockCrs:main_loop_noqr", policy,
1220 KOKKOS_LAMBDA(
const typename Kokkos::TeamPolicy<execution_space>::member_type& thread) {
1221 auto agg = thread.league_rank();
1225 Xpetra::global_size_t offset = agg * NSDim;
1228 for (LO j = 0; j < aggSize; j++) {
1229 LO localBlockRow = aggToRowMapLO(
aggRows(agg) + j);
1230 LO rowStart = localBlockRow * stride;
1231 for (LO r = 0; r < (LO)NSDim; r++) {
1232 LO localPointRow = localBlockRow * NSDim + r;
1233 for (LO c = 0; c < (LO)NSDim; c++) {
1234 values[rowStart + r * NSDim + c] = fineNSRandom(localPointRow, c);
1240 for (LO j = 0; j < (LO)NSDim; j++)
1244 Ptentative = P_wrap;