From bcfe532e10ec0e4fd7f144b609f4b9172aa7e9dc Mon Sep 17 00:00:00 2001 From: Jerry Watkins Date: Tue, 7 Sep 2021 17:26:54 -0600 Subject: [PATCH] MueLu: Clean up SemiCoarsenP factories --- .../MueLu_SemiCoarsenPFactory_def.hpp | 16 +++------ .../MueLu_SemiCoarsenPFactory_kokkos_def.hpp | 34 ++++--------------- 2 files changed, 10 insertions(+), 40 deletions(-) diff --git a/packages/muelu/src/Transfers/SemiCoarsen/MueLu_SemiCoarsenPFactory_def.hpp b/packages/muelu/src/Transfers/SemiCoarsen/MueLu_SemiCoarsenPFactory_def.hpp index 586b504afeaf..687c9cb00e9e 100644 --- a/packages/muelu/src/Transfers/SemiCoarsen/MueLu_SemiCoarsenPFactory_def.hpp +++ b/packages/muelu/src/Transfers/SemiCoarsen/MueLu_SemiCoarsenPFactory_def.hpp @@ -74,11 +74,11 @@ namespace MueLu { #undef SET_VALID_ENTRY validParamList->set< RCP >("A", Teuchos::null, "Generating factory of the matrix A"); validParamList->set< RCP >("Nullspace", Teuchos::null, "Generating factory of the nullspace"); - validParamList->set< RCP >("Coordinates", Teuchos::null, "Generating factory for coorindates"); + validParamList->set< RCP >("Coordinates", Teuchos::null, "Generating factory for coordinates"); - validParamList->set< RCP >("LineDetection_VertLineIds", Teuchos::null, "Generating factory for LineDetection information"); - validParamList->set< RCP >("LineDetection_Layers", Teuchos::null, "Generating factory for LineDetection information"); - validParamList->set< RCP >("CoarseNumZLayers", Teuchos::null, "Generating factory for LineDetection information"); + validParamList->set< RCP >("LineDetection_VertLineIds", Teuchos::null, "Generating factory for LineDetection vertical line ids"); + validParamList->set< RCP >("LineDetection_Layers", Teuchos::null, "Generating factory for LineDetection layer ids"); + validParamList->set< RCP >("CoarseNumZLayers", Teuchos::null, "Generating factory for number of coarse z-layers"); return validParamList; } @@ -108,7 +108,6 @@ namespace MueLu { if (myCoordsFact == Teuchos::null) { myCoordsFact = fineLevel.GetFactoryManager()->GetFactory("Coordinates"); } if (fineLevel.IsAvailable("Coordinates", myCoordsFact.get())) { fineLevel.DeclareInput("Coordinates", myCoordsFact.get(), this); - bTransferCoordinates_ = true; } } } @@ -174,7 +173,6 @@ namespace MueLu { // transfer coordinates if(bTransferCoordinates_) { - //Teuchos::FancyOStream> out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); typedef Xpetra::MultiVector::coordinateType,LO,GO,NO> xdMV; RCP fineCoords = Teuchos::null; if (fineLevel.GetLevelID() == 0 && @@ -222,12 +220,6 @@ namespace MueLu { LO numVertLines = Nnodes / FineNumZLayers; LO numLocalCoarseNodes = numVertLines * myCoarseZLayers; - //std::cout << "rowMap elements: " << rowMap->getNodeNumElements() << std::endl; - //std::cout << "fineCoords: " << fineCoords->getNodeNumElements() << std::endl; - //std::cout << "TVertLineId.size(): " << TVertLineId.size() << std::endl; - //std::cout << "numVertLines=" << numVertLines << std::endl; - //std::cout << "numLocalCoarseNodes=" << numLocalCoarseNodes << std::endl; - RCP coarseCoordMap = MapFactory::Build (fineCoords->getMap()->lib(), Teuchos::OrdinalTraits::invalid(), diff --git a/packages/muelu/src/Transfers/SemiCoarsen/MueLu_SemiCoarsenPFactory_kokkos_def.hpp b/packages/muelu/src/Transfers/SemiCoarsen/MueLu_SemiCoarsenPFactory_kokkos_def.hpp index 242c4354029b..7a7632b46309 100644 --- a/packages/muelu/src/Transfers/SemiCoarsen/MueLu_SemiCoarsenPFactory_kokkos_def.hpp +++ b/packages/muelu/src/Transfers/SemiCoarsen/MueLu_SemiCoarsenPFactory_kokkos_def.hpp @@ -46,7 +46,6 @@ #ifndef MUELU_SEMICOARSENPFACTORY_KOKKOS_DEF_HPP #define MUELU_SEMICOARSENPFACTORY_KOKKOS_DEF_HPP -#define HAVE_MUELU_KOKKOS_REFACTOR #ifdef HAVE_MUELU_KOKKOS_REFACTOR #include @@ -81,26 +80,24 @@ SemiCoarsenPFactory_kokkos>::GetValidParameterList() const { RCP validParamList = rcp(new ParameterList()); -#define SET_VALID_ENTRY(name) \ - validParamList->setEntry(name, MasterList::getEntry(name)) - SET_VALID_ENTRY("semicoarsen: coarsen rate"); -#undef SET_VALID_ENTRY + std::string name = "semicoarsen: coarsen rate"; + validParamList->setEntry(name, MasterList::getEntry(name)); validParamList->set>( "A", Teuchos::null, "Generating factory of the matrix A"); validParamList->set>( "Nullspace", Teuchos::null, "Generating factory of the nullspace"); validParamList->set>( - "Coordinates", Teuchos::null, "Generating factory for coorindates"); + "Coordinates", Teuchos::null, "Generating factory for coordinates"); validParamList->set>( "LineDetection_VertLineIds", Teuchos::null, - "Generating factory for LineDetection information"); + "Generating factory for LineDetection vertical line ids"); validParamList->set>( "LineDetection_Layers", Teuchos::null, - "Generating factory for LineDetection information"); + "Generating factory for LineDetection layer ids"); validParamList->set>( "CoarseNumZLayers", Teuchos::null, - "Generating factory for LineDetection information"); + "Generating factory for number of coarse z-layers"); return validParamList; } @@ -136,7 +133,6 @@ void SemiCoarsenPFactory_kokkos< } if (fineLevel.IsAvailable("Coordinates", myCoordsFact.get())) { fineLevel.DeclareInput("Coordinates", myCoordsFact.get(), this); - bTransferCoordinates_ = true; } } } @@ -215,8 +211,6 @@ void SemiCoarsenPFactory_kokkos out = - // Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); typedef Xpetra::MultiVector< typename Teuchos::ScalarTraits::coordinateType, LO, GO, NO> xdMV; @@ -292,13 +286,6 @@ void SemiCoarsenPFactory_kokkosgetNodeNumElements() << - // std::endl; std::cout << "fineCoords: " << - // fineCoords->getDataNonConst(0).size() << std::endl; std::cout << - // "TVertLineId.size(): " << TVertLineId.size() << std::endl; std::cout << - // "numVertLines=" << numVertLines << std::endl; std::cout << - // "numLocalCoarseNodes=" << numLocalCoarseNodes << std::endl; - RCP coarseCoordMap = MapFactory::Build( fineCoords->getMap()->lib(), Teuchos::OrdinalTraits::invalid(), @@ -376,13 +363,10 @@ void SemiCoarsenPFactory_kokkos< for (int row = 0; row < NFRows; row++) localTempHost(row, 0) = LayerId[row / DofsPerNode]; const auto localTempView = localTemp->getDeviceLocalView(); - // const auto localTempView = localTemp->template getLocalView(); Kokkos::deep_copy(localTempView, localTempHost); FCol2LayerVector->doImport(*localTemp, *(importer), Xpetra::INSERT); } const auto FCol2LayerView = FCol2LayerVector->getDeviceLocalView(); - // const auto FCol2LayerView = - // FCol2LayerVector->template getLocalView(); const auto FCol2Layer = Kokkos::subview(FCol2LayerView, Kokkos::ALL(), 0); // Construct a map from fine level column to local dof per node id (including @@ -395,12 +379,10 @@ void SemiCoarsenPFactory_kokkos< for (int row = 0; row < NFRows; row++) localTempHost(row, 0) = row % DofsPerNode; const auto localTempView = localTemp->getDeviceLocalView(); - // const auto localTempView = localTemp->template getLocalView(); Kokkos::deep_copy(localTempView, localTempHost); FCol2DofVector->doImport(*localTemp, *(importer), Xpetra::INSERT); } const auto FCol2DofView = FCol2DofVector->getDeviceLocalView(); - // const auto FCol2DofView = FCol2DofVector->template getLocalView(); const auto FCol2Dof = Kokkos::subview(FCol2DofView, Kokkos::ALL(), 0); // Compute NVertLines @@ -691,10 +673,6 @@ void SemiCoarsenPFactory_kokkos< const int numVectors = fineNullspace->getNumVectors(); const auto fineNullspaceView = fineNullspace->getDeviceLocalView(); const auto coarseNullspaceView = coarseNullspace->getDeviceLocalView(); - // const auto fineNullspaceView = - // fineNullspace->template getLocalView(); - // const auto coarseNullspaceView = - // coarseNullspace->template getLocalView(); using range_policy = Kokkos::RangePolicy; Kokkos::parallel_for( "MueLu::SemiCoarsenPFactory_kokkos::BuildSemiCoarsenP Inject Nullspace",