From 700b2ee145ead8f274cb6dd59fee9a9657c46ebc Mon Sep 17 00:00:00 2001 From: Alexander Heinlein Date: Wed, 8 Dec 2021 16:10:13 +0100 Subject: [PATCH 01/13] Fix some output. --- .../src/SchwarzOperators/FROSch_GDSWCoarseOperator_def.hpp | 4 ++-- .../FROSch_IPOUHarmonicCoarseOperator_def.hpp | 4 ++-- .../src/SchwarzOperators/FROSch_RGDSWCoarseOperator_def.hpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_GDSWCoarseOperator_def.hpp b/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_GDSWCoarseOperator_def.hpp index 427bdceeb4aa..35bd254b39ca 100644 --- a/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_GDSWCoarseOperator_def.hpp +++ b/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_GDSWCoarseOperator_def.hpp @@ -417,11 +417,11 @@ namespace FROSch { << " | " << setw(41) << blockId << " |" << "\n" << setw(FROSCH_OUTPUT_INDENT) << " " - << "| " << left << setw(41) << "Numer of degrees of freedom per node" << right + << "| " << left << setw(41) << "Spatial dimensions" << right << " | " << setw(41) << dimension << " |" << "\n" << setw(FROSCH_OUTPUT_INDENT) << " " - << "| " << left << setw(41) << "Numer of degrees of freedom per node" << right + << "| " << left << setw(41) << "Number of degrees of freedom per node" << right << " | " << setw(41) << dofsPerNode << " |" << "\n" << setw(FROSCH_OUTPUT_INDENT) << " " diff --git a/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp b/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp index 62356b9bf772..dae17b617932 100644 --- a/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp +++ b/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp @@ -281,11 +281,11 @@ namespace FROSch { << " | " << setw(41) << blockId << " |" << "\n" << setw(FROSCH_OUTPUT_INDENT) << " " - << "| " << left << setw(41) << "Numer of degrees of freedom per node" << right + << "| " << left << setw(41) << "Spatial dimensions" << right << " | " << setw(41) << dimension << " |" << "\n" << setw(FROSCH_OUTPUT_INDENT) << " " - << "| " << left << setw(41) << "Numer of degrees of freedom per node" << right + << "| " << left << setw(41) << "Number of degrees of freedom per node" << right << " | " << setw(41) << dofsPerNode << " |" << "\n" << setw(FROSCH_OUTPUT_INDENT) << " " diff --git a/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_RGDSWCoarseOperator_def.hpp b/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_RGDSWCoarseOperator_def.hpp index a0456f38d271..7262592837d8 100644 --- a/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_RGDSWCoarseOperator_def.hpp +++ b/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_RGDSWCoarseOperator_def.hpp @@ -150,11 +150,11 @@ namespace FROSch { << " | " << setw(41) << blockId << " |" << "\n" << setw(FROSCH_OUTPUT_INDENT) << " " - << "| " << left << setw(41) << "Numer of degrees of freedom per node" << right + << "| " << left << setw(41) << "Spatial dimensions" << right << " | " << setw(41) << dimension << " |" << "\n" << setw(FROSCH_OUTPUT_INDENT) << " " - << "| " << left << setw(41) << "Numer of degrees of freedom per node" << right + << "| " << left << setw(41) << "Number of degrees of freedom per node" << right << " | " << setw(41) << dofsPerNode << " |" << "\n" << setw(FROSCH_OUTPUT_INDENT) << " " From c36f178737e3085d503649802a917cb2bf8706c5 Mon Sep 17 00:00:00 2001 From: Alexander Heinlein Date: Thu, 9 Dec 2021 16:06:27 +0100 Subject: [PATCH 02/13] Fixing some parameters. --- .../FROSch_IPOUHarmonicCoarseOperator_def.hpp | 4 ++-- .../FROSch_TwoLevelBlockPreconditioner_def.hpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp b/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp index dae17b617932..2fbea1030e30 100644 --- a/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp +++ b/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp @@ -342,7 +342,7 @@ namespace FROSch { this->LevelID_, interfacePartitionOfUnity->getDDInterfaceNonConst())); - PartitionOfUnity_->removeDirichletNodes(dirichletBoundaryDofs()); + if (this->ParameterList_->get("Remove Dirichlet Nodes",true)) PartitionOfUnity_->removeDirichletNodes(dirichletBoundaryDofs()); interface = interior; @@ -357,7 +357,7 @@ namespace FROSch { PartitionOfUnity_->computePartitionOfUnity(nodeList); } else { - interfacePartitionOfUnity->removeDirichletNodes(dirichletBoundaryDofs(),nodeList); + if (this->ParameterList_->get("Remove Dirichlet Nodes",true)) interfacePartitionOfUnity->removeDirichletNodes(dirichletBoundaryDofs(),nodeList); interfacePartitionOfUnity->sortInterface(this->K_,nodeList); // Construct Interface and Interior index sets diff --git a/packages/shylu/shylu_dd/frosch/src/SchwarzPreconditioners/FROSch_TwoLevelBlockPreconditioner_def.hpp b/packages/shylu/shylu_dd/frosch/src/SchwarzPreconditioners/FROSch_TwoLevelBlockPreconditioner_def.hpp index 40c130de7106..e29379241865 100644 --- a/packages/shylu/shylu_dd/frosch/src/SchwarzPreconditioners/FROSch_TwoLevelBlockPreconditioner_def.hpp +++ b/packages/shylu/shylu_dd/frosch/src/SchwarzPreconditioners/FROSch_TwoLevelBlockPreconditioner_def.hpp @@ -61,17 +61,17 @@ namespace FROSch { // Set the LevelID in the sublist parameterList->sublist("IPOUHarmonicCoarseOperator").set("Level ID",this->LevelID_); // FROSCH_ASSERT(false,"not implemented for block."); - this->ParameterList_->sublist("IPOUHarmonicCoarseOperator").sublist("InterfacePartitionOfUnity").set("Test Unconnected Interface",true); + // this->ParameterList_->sublist("IPOUHarmonicCoarseOperator").sublist("InterfacePartitionOfUnity").set("Test Unconnected Interface",true); CoarseOperator_ = IPOUHarmonicCoarseOperatorPtr(new IPOUHarmonicCoarseOperator(k,sublist(parameterList,"IPOUHarmonicCoarseOperator"))); } else if (!this->ParameterList_->get("CoarseOperator Type","IPOUHarmonicCoarseOperator").compare("GDSWCoarseOperator")) { // Set the LevelID in the sublist parameterList->sublist("GDSWCoarseOperator").set("Level ID",this->LevelID_); - this->ParameterList_->sublist("GDSWCoarseOperator").set("Test Unconnected Interface",true); + // this->ParameterList_->sublist("GDSWCoarseOperator").set("Test Unconnected Interface",true); CoarseOperator_ = GDSWCoarseOperatorPtr(new GDSWCoarseOperator(k,sublist(parameterList,"GDSWCoarseOperator"))); } else if (!this->ParameterList_->get("CoarseOperator Type","IPOUHarmonicCoarseOperator").compare("RGDSWCoarseOperator")) { // Set the LevelID in the sublist parameterList->sublist("RGDSWCoarseOperator").set("Level ID",this->LevelID_); - this->ParameterList_->sublist("RGDSWCoarseOperator").set("Test Unconnected Interface",true); + // this->ParameterList_->sublist("RGDSWCoarseOperator").set("Test Unconnected Interface",true); CoarseOperator_ = RGDSWCoarseOperatorPtr(new RGDSWCoarseOperator(k,sublist(parameterList,"RGDSWCoarseOperator"))); } else { FROSCH_ASSERT(false,"CoarseOperator Type unkown."); @@ -165,11 +165,11 @@ namespace FROSch { for (UN j=0; jgetNodeNumElements()); } - #ifdef FindOneEntryOnlyRowsGlobal_Matrix +#ifdef FindOneEntryOnlyRowsGlobal_Matrix GOVecPtr dirichletBoundaryDofs = FindOneEntryOnlyRowsGlobal(this->K_.getConst(),repeatedMap); - #else +#else GOVecPtr dirichletBoundaryDofs = FindOneEntryOnlyRowsGlobal(this->K_->getCrsGraph(),repeatedMap); - #endif +#endif for (UN i=0; i 0 ; j--) { From 2677bbd77ee1ca07fee0063b9f5392ff0255f78e Mon Sep 17 00:00:00 2001 From: Alexander Heinlein Date: Wed, 2 Feb 2022 21:01:36 +0100 Subject: [PATCH 03/13] Fixing the null space in the TwoLevelBlockPreconditioner. --- .../FROSch_IPOUHarmonicCoarseOperator_def.hpp | 37 +++++++++++++++---- ...FROSch_TwoLevelBlockPreconditioner_def.hpp | 25 ++++++++----- 2 files changed, 44 insertions(+), 18 deletions(-) diff --git a/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp b/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp index 2fbea1030e30..515766bbeb19 100644 --- a/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp +++ b/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp @@ -218,16 +218,37 @@ namespace FROSch { ConstXMultiVectorPtrVecPtr nodeListVec) { FROSCH_DETAILTIMER_START_LEVELID(buildCoarseSpaceTime,"IPOUHarmonicCoarseOperator::buildCoarseSpace"); + + this->NumberOfBlocks_ = repeatedNodesMapVec.size(); + + FROSCH_ASSERT(dofsPerNodeVec.size()==this->NumberOfBlocks_,"dofsPerNodeVec.size()!=this->NumberOfBlocks_"); + FROSCH_ASSERT(repeatedDofMapsVec.size()==this->NumberOfBlocks_,"repeatedDofMapsVec.size()!=this->NumberOfBlocks_"); + FROSCH_ASSERT(nullSpaceBasisVec.size()==this->NumberOfBlocks_,"nullSpaceBasisVec.size()!=this->NumberOfBlocks_"); + FROSCH_ASSERT(dirichletBoundaryDofsVec.size()==this->NumberOfBlocks_,"dirichletBoundaryDofsVec.size()!=this->NumberOfBlocks_"); + FROSCH_ASSERT(nodeListVec.size()==this->NumberOfBlocks_,"nodeListVec.size()!=this->NumberOfBlocks_"); + // Das könnte man noch ändern // TODO: DAS SOLLTE ALLES IN EINE FUNKTION IN HARMONICCOARSEOPERATOR - for (UN i=0; iGammaDofs_.resize(this->GammaDofs_.size()+1); - this->IDofs_.resize(this->IDofs_.size()+1); - this->InterfaceCoarseSpaces_.resize(this->InterfaceCoarseSpaces_.size()+1); - this->DofsMaps_.resize(this->DofsMaps_.size()+1); - this->DofsPerNode_.resize(this->DofsPerNode_.size()+1); - this->NumberOfBlocks_++; - resetCoarseSpaceBlock(this->NumberOfBlocks_-1,dimension,dofsPerNodeVec[i],repeatedNodesMapVec[i],repeatedDofMapsVec[i],nullSpaceBasisVec[i],dirichletBoundaryDofsVec[i],nodeListVec[i]); + for (UN i=0; iNumberOfBlocks_; i++) { + FROSCH_ASSERT(!repeatedNodesMapVec[i].is_null(),"repeatedNodesMapVec[i].is_null()"); + FROSCH_ASSERT(!repeatedDofMapsVec[i].is_null(),"repeatedDofMapsVec[i].is_null()"); + FROSCH_ASSERT(!nullSpaceBasisVec[i].is_null(),"nullSpaceBasisVec[i].is_null()"); + FROSCH_ASSERT(!dirichletBoundaryDofsVec[i].is_null(),"dirichletBoundaryDofsVec[i].is_null()"); + + this->GammaDofs_.resize(this->GammaDofs_.size()+1); FROSCH_TEST_OUTPUT(this->MpiComm_,this->Verbose_,"TEST2"); + this->IDofs_.resize(this->IDofs_.size()+1); FROSCH_TEST_OUTPUT(this->MpiComm_,this->Verbose_,"TEST3"); + this->InterfaceCoarseSpaces_.resize(this->InterfaceCoarseSpaces_.size()+1); FROSCH_TEST_OUTPUT(this->MpiComm_,this->Verbose_,"TEST4"); + this->DofsMaps_.resize(this->DofsMaps_.size()+1); FROSCH_TEST_OUTPUT(this->MpiComm_,this->Verbose_,"TEST5"); + this->DofsPerNode_.resize(this->DofsPerNode_.size()+1); FROSCH_TEST_OUTPUT(this->MpiComm_,this->Verbose_,"TEST6"); + + resetCoarseSpaceBlock(i, + dimension, + dofsPerNodeVec[i], + repeatedNodesMapVec[i], + repeatedDofMapsVec[i], + nullSpaceBasisVec[i], + dirichletBoundaryDofsVec[i], + nodeListVec[i]); } return 0; } diff --git a/packages/shylu/shylu_dd/frosch/src/SchwarzPreconditioners/FROSch_TwoLevelBlockPreconditioner_def.hpp b/packages/shylu/shylu_dd/frosch/src/SchwarzPreconditioners/FROSch_TwoLevelBlockPreconditioner_def.hpp index e29379241865..a7feabf2b159 100644 --- a/packages/shylu/shylu_dd/frosch/src/SchwarzPreconditioners/FROSch_TwoLevelBlockPreconditioner_def.hpp +++ b/packages/shylu/shylu_dd/frosch/src/SchwarzPreconditioners/FROSch_TwoLevelBlockPreconditioner_def.hpp @@ -206,17 +206,19 @@ namespace FROSch { if (!this->ParameterList_->get("CoarseOperator Type","IPOUHarmonicCoarseOperator").compare("IPOUHarmonicCoarseOperator")) { // Build Null Space if (!this->ParameterList_->get("Null Space Type","Laplace").compare("Laplace")) { - nullSpaceBasisVec.resize(1); - nullSpaceBasisVec[0] = BuildNullSpace(dimension,NullSpaceType::Laplace,repeatedMapVec[0],dofsPerNodeVec[0],dofsMapsVec[0]); + nullSpaceBasisVec.resize(nmbBlocks); + for (UN i = 0; i < nmbBlocks; i++) { + nullSpaceBasisVec[i] = BuildNullSpace(dimension,NullSpaceType::Laplace,repeatedMap,dofsPerNodeVec[i],dofsMapsVec[i]); + } } else if (!this->ParameterList_->get("Null Space Type","Laplace").compare("Linear Elasticity")) { nullSpaceBasisVec.resize(repeatedMapVec.size()); for (int i = 0; iParameterList_->get("Null Space Type","Laplace").compare("Stokes")) { nullSpaceBasisVec.resize(2); - nullSpaceBasisVec[0] = BuildNullSpace(dimension,NullSpaceType::Laplace,repeatedMapVec[0],dofsPerNodeVec[0],dofsMapsVec[0]); - nullSpaceBasisVec[1] = BuildNullSpace(dimension,NullSpaceType::Laplace,repeatedMapVec[1],dofsPerNodeVec[1],dofsMapsVec[1]); + nullSpaceBasisVec[0] = BuildNullSpace(dimension,NullSpaceType::Laplace,repeatedMap,dofsPerNodeVec[0],dofsMapsVec[0]); + nullSpaceBasisVec[1] = BuildNullSpace(dimension,NullSpaceType::Laplace,repeatedMap,dofsPerNodeVec[1],dofsMapsVec[1]); } else if (!this->ParameterList_->get("Null Space Type","Laplace").compare("Input")) { FROSCH_ASSERT(!nullSpaceBasisVec.is_null(),"Null Space Type is 'Input', but nullSpaceBasis.is_null()."); } else { @@ -368,17 +370,20 @@ namespace FROSch { if (!this->ParameterList_->get("CoarseOperator Type","IPOUHarmonicCoarseOperator").compare("IPOUHarmonicCoarseOperator")) { // Build Null Space if (!this->ParameterList_->get("Null Space Type","Laplace").compare("Laplace")) { - nullSpaceBasisVec.resize(1); - nullSpaceBasisVec[0] = BuildNullSpace(dimension,NullSpaceType::Laplace,repeatedMapVec[0],dofsPerNodeVec[0],dofsMapsVec[0]); + nullSpaceBasisVec.resize(nmbBlocks); + for (UN i = 0; i < nmbBlocks; i++) { + // Todo: For now we have to use repeatedMap as the map for the vectors, such that the offsets are consistent with dofsMapsVec[i]. This would not be the case for repeatedMapVec[i]. However, it would be sufficient to use repeatedMapVec[i] with an offset instead + nullSpaceBasisVec[i] = BuildNullSpace(dimension,NullSpaceType::Laplace,repeatedMap,dofsPerNodeVec[i],dofsMapsVec[i]); + } } else if (!this->ParameterList_->get("Null Space Type","Laplace").compare("Linear Elasticity")) { nullSpaceBasisVec.resize(repeatedMapVec.size()); for (int i = 0; iParameterList_->get("Null Space Type","Laplace").compare("Stokes")) { nullSpaceBasisVec.resize(2); - nullSpaceBasisVec[0] = BuildNullSpace(dimension,NullSpaceType::Laplace,repeatedMapVec[0],dofsPerNodeVec[0],dofsMapsVec[0]); - nullSpaceBasisVec[1] = BuildNullSpace(dimension,NullSpaceType::Laplace,repeatedMapVec[1],dofsPerNodeVec[1],dofsMapsVec[1]); + nullSpaceBasisVec[0] = BuildNullSpace(dimension,NullSpaceType::Laplace,repeatedMap,dofsPerNodeVec[0],dofsMapsVec[0]); + nullSpaceBasisVec[1] = BuildNullSpace(dimension,NullSpaceType::Laplace,repeatedMap,dofsPerNodeVec[1],dofsMapsVec[1]); } else if (!this->ParameterList_->get("Null Space Type","Laplace").compare("Input")) { FROSCH_ASSERT(!nullSpaceBasisVec.is_null(),"Null Space Type is 'Input', but nullSpaceBasis.is_null()."); } else { From 66a4b86458a627edce813f441ba5057d92bd002c Mon Sep 17 00:00:00 2001 From: Alexander Heinlein Date: Wed, 2 Feb 2022 21:06:11 +0100 Subject: [PATCH 04/13] Removing one assert. --- .../SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp b/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp index 515766bbeb19..12dc0aa09685 100644 --- a/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp +++ b/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp @@ -233,7 +233,6 @@ namespace FROSch { FROSCH_ASSERT(!repeatedNodesMapVec[i].is_null(),"repeatedNodesMapVec[i].is_null()"); FROSCH_ASSERT(!repeatedDofMapsVec[i].is_null(),"repeatedDofMapsVec[i].is_null()"); FROSCH_ASSERT(!nullSpaceBasisVec[i].is_null(),"nullSpaceBasisVec[i].is_null()"); - FROSCH_ASSERT(!dirichletBoundaryDofsVec[i].is_null(),"dirichletBoundaryDofsVec[i].is_null()"); this->GammaDofs_.resize(this->GammaDofs_.size()+1); FROSCH_TEST_OUTPUT(this->MpiComm_,this->Verbose_,"TEST2"); this->IDofs_.resize(this->IDofs_.size()+1); FROSCH_TEST_OUTPUT(this->MpiComm_,this->Verbose_,"TEST3"); From 02e7f7f160790da990f02812b5562edb6370a18c Mon Sep 17 00:00:00 2001 From: Alexander Heinlein Date: Thu, 3 Feb 2022 10:19:30 +0100 Subject: [PATCH 05/13] Removing some test output. --- .../FROSch_IPOUHarmonicCoarseOperator_def.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp b/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp index 12dc0aa09685..187d13dc2f78 100644 --- a/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp +++ b/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp @@ -234,11 +234,11 @@ namespace FROSch { FROSCH_ASSERT(!repeatedDofMapsVec[i].is_null(),"repeatedDofMapsVec[i].is_null()"); FROSCH_ASSERT(!nullSpaceBasisVec[i].is_null(),"nullSpaceBasisVec[i].is_null()"); - this->GammaDofs_.resize(this->GammaDofs_.size()+1); FROSCH_TEST_OUTPUT(this->MpiComm_,this->Verbose_,"TEST2"); - this->IDofs_.resize(this->IDofs_.size()+1); FROSCH_TEST_OUTPUT(this->MpiComm_,this->Verbose_,"TEST3"); - this->InterfaceCoarseSpaces_.resize(this->InterfaceCoarseSpaces_.size()+1); FROSCH_TEST_OUTPUT(this->MpiComm_,this->Verbose_,"TEST4"); - this->DofsMaps_.resize(this->DofsMaps_.size()+1); FROSCH_TEST_OUTPUT(this->MpiComm_,this->Verbose_,"TEST5"); - this->DofsPerNode_.resize(this->DofsPerNode_.size()+1); FROSCH_TEST_OUTPUT(this->MpiComm_,this->Verbose_,"TEST6"); + this->GammaDofs_.resize(this->GammaDofs_.size()+1); + this->IDofs_.resize(this->IDofs_.size()+1); + this->InterfaceCoarseSpaces_.resize(this->InterfaceCoarseSpaces_.size()+1); + this->DofsMaps_.resize(this->DofsMaps_.size()+1); + this->DofsPerNode_.resize(this->DofsPerNode_.size()+1); resetCoarseSpaceBlock(i, dimension, From 70a16d0fdc840d5467b1e0a41c8fec16dbe974a4 Mon Sep 17 00:00:00 2001 From: Vinh Dang Date: Thu, 17 Feb 2022 10:58:51 -0800 Subject: [PATCH 06/13] Move trisolve symbolic to initialize phase --- packages/ifpack2/src/Ifpack2_RILUK_def.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/ifpack2/src/Ifpack2_RILUK_def.hpp b/packages/ifpack2/src/Ifpack2_RILUK_def.hpp index 863a33f84f41..d3f790f46151 100644 --- a/packages/ifpack2/src/Ifpack2_RILUK_def.hpp +++ b/packages/ifpack2/src/Ifpack2_RILUK_def.hpp @@ -545,8 +545,10 @@ void RILUK::initialize () checkOrderingConsistency (*A_local_); L_solver_->setMatrix (L_); L_solver_->initialize (); + L_solver_->compute ();//NOTE: It makes more sense to have compute here because only the nonzero pattern is involved in trisolve compute U_solver_->setMatrix (U_); U_solver_->initialize (); + U_solver_->compute ();//NOTE: It makes more sense to have compute here because only the nonzero pattern is involved in trisolve compute // Do not call initAllValues. compute() always calls initAllValues to // fill L and U with possibly new numbers. initialize() is concerned @@ -897,9 +899,7 @@ void RILUK::compute () // If L_solver_ or U_solver store modified factors internally, we need to reset those L_solver_->setMatrix (L_); - L_solver_->compute (); U_solver_->setMatrix (U_); - U_solver_->compute (); } else { {//Make sure values in A is picked up even in case of pattern reuse @@ -961,9 +961,7 @@ void RILUK::compute () U_->fillComplete (A_local_->getDomainMap (), U_->getRowMap ()); L_solver_->setMatrix (L_); - L_solver_->compute (); U_solver_->setMatrix (U_); - U_solver_->compute (); } isComputed_ = true; From 97a40186febaf4c804a452e22dceae940a065437 Mon Sep 17 00:00:00 2001 From: Vinh Dang Date: Mon, 7 Mar 2022 23:53:28 -0800 Subject: [PATCH 07/13] Call trisolvers' compute only if the pointers changed --- .../src/Ifpack2_LocalSparseTriangularSolver_def.hpp | 2 ++ packages/ifpack2/src/Ifpack2_RILUK_def.hpp | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/ifpack2/src/Ifpack2_LocalSparseTriangularSolver_def.hpp b/packages/ifpack2/src/Ifpack2_LocalSparseTriangularSolver_def.hpp index 15413d0f123e..39fd4ed92288 100644 --- a/packages/ifpack2/src/Ifpack2_LocalSparseTriangularSolver_def.hpp +++ b/packages/ifpack2/src/Ifpack2_LocalSparseTriangularSolver_def.hpp @@ -558,6 +558,7 @@ compute () "been called by this point, but isInitialized_ is false. " "Please report this bug to the Ifpack2 developers."); + if (! isComputed_) {//Only compute if not computed before if (Teuchos::nonnull (htsImpl_)) htsImpl_->compute (*A_crs_, out_); @@ -590,6 +591,7 @@ compute () isComputed_ = true; ++numCompute_; + } } template diff --git a/packages/ifpack2/src/Ifpack2_RILUK_def.hpp b/packages/ifpack2/src/Ifpack2_RILUK_def.hpp index f9b6fceac685..5c6b5764228b 100644 --- a/packages/ifpack2/src/Ifpack2_RILUK_def.hpp +++ b/packages/ifpack2/src/Ifpack2_RILUK_def.hpp @@ -545,10 +545,10 @@ void RILUK::initialize () checkOrderingConsistency (*A_local_); L_solver_->setMatrix (L_); L_solver_->initialize (); - L_solver_->compute ();//NOTE: It makes more sense to have compute here because only the nonzero pattern is involved in trisolve compute + L_solver_->compute ();//NOTE: It makes sense to do compute here because only the nonzero pattern is involved in trisolve compute U_solver_->setMatrix (U_); U_solver_->initialize (); - U_solver_->compute ();//NOTE: It makes more sense to have compute here because only the nonzero pattern is involved in trisolve compute + U_solver_->compute ();//NOTE: It makes sense to do compute here because only the nonzero pattern is involved in trisolve compute // Do not call initAllValues. compute() always calls initAllValues to // fill L and U with possibly new numbers. initialize() is concerned @@ -899,7 +899,9 @@ void RILUK::compute () // If L_solver_ or U_solver store modified factors internally, we need to reset those L_solver_->setMatrix (L_); + L_solver_->compute ();//NOTE: Only do compute if the pointer changed. Otherwise, do nothing U_solver_->setMatrix (U_); + U_solver_->compute ();//NOTE: Only do compute if the pointer changed. Otherwise, do nothing } else { {//Make sure values in A is picked up even in case of pattern reuse @@ -962,7 +964,9 @@ void RILUK::compute () U_->fillComplete (A_local_->getDomainMap (), U_->getRowMap ()); L_solver_->setMatrix (L_); + L_solver_->compute ();//NOTE: Only do compute if the pointer changed. Otherwise, do nothinig U_solver_->setMatrix (U_); + U_solver_->compute ();//NOTE: Only do compute if the pointer changed. Otherwise, do nothing } isComputed_ = true; From df7dcae91c766c363caf7b0783e22874685340a7 Mon Sep 17 00:00:00 2001 From: Vinh Dang Date: Tue, 8 Mar 2022 00:07:14 -0800 Subject: [PATCH 08/13] Call trisolvers' compute only if the pointers changed --- packages/ifpack2/src/Ifpack2_RILUK_def.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ifpack2/src/Ifpack2_RILUK_def.hpp b/packages/ifpack2/src/Ifpack2_RILUK_def.hpp index 5c6b5764228b..4b9d4b4274ec 100644 --- a/packages/ifpack2/src/Ifpack2_RILUK_def.hpp +++ b/packages/ifpack2/src/Ifpack2_RILUK_def.hpp @@ -964,7 +964,7 @@ void RILUK::compute () U_->fillComplete (A_local_->getDomainMap (), U_->getRowMap ()); L_solver_->setMatrix (L_); - L_solver_->compute ();//NOTE: Only do compute if the pointer changed. Otherwise, do nothinig + L_solver_->compute ();//NOTE: Only do compute if the pointer changed. Otherwise, do nothing U_solver_->setMatrix (U_); U_solver_->compute ();//NOTE: Only do compute if the pointer changed. Otherwise, do nothing } From b1a09b8daf984c3aafcd8fad611bdd40a4887d7e Mon Sep 17 00:00:00 2001 From: Alexander Heinlein Date: Wed, 9 Mar 2022 07:56:26 +0100 Subject: [PATCH 09/13] Adding a missing include. --- .../FROSch_SchwarzPreconditioner_decl.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/shylu/shylu_dd/frosch/src/SchwarzPreconditioners/FROSch_SchwarzPreconditioner_decl.hpp b/packages/shylu/shylu_dd/frosch/src/SchwarzPreconditioners/FROSch_SchwarzPreconditioner_decl.hpp index c28c5004a342..51c1ace41232 100644 --- a/packages/shylu/shylu_dd/frosch/src/SchwarzPreconditioners/FROSch_SchwarzPreconditioner_decl.hpp +++ b/packages/shylu/shylu_dd/frosch/src/SchwarzPreconditioners/FROSch_SchwarzPreconditioner_decl.hpp @@ -45,8 +45,11 @@ #include #include -#include +#include + +#include +#include namespace FROSch { From 927239e1375d0e5cf3f7854ad0942b9c39b350fd Mon Sep 17 00:00:00 2001 From: Alexander Heinlein Date: Wed, 9 Mar 2022 21:00:49 +0100 Subject: [PATCH 10/13] Update FROSch_IPOUHarmonicCoarseOperator_def.hpp Translating some comments --- .../FROSch_IPOUHarmonicCoarseOperator_def.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp b/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp index e44c82bbbbe7..f3be3abfa1c0 100644 --- a/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp +++ b/packages/shylu/shylu_dd/frosch/src/SchwarzOperators/FROSch_IPOUHarmonicCoarseOperator_def.hpp @@ -197,7 +197,7 @@ namespace FROSch { FROSCH_ASSERT(dofsMaps.size()==dofsPerNode,"dofsMaps.size()!=dofsPerNode"); // Das könnte man noch ändern - // LÄNGEN NOCHMAL GEGEN NumberOfBlocks_ checken!!! + // Todo: Check the lengths of the vectors against NumberOfBlocks_ this->GammaDofs_.resize(this->GammaDofs_.size()+1); this->IDofs_.resize(this->IDofs_.size()+1); this->InterfaceCoarseSpaces_.resize(this->InterfaceCoarseSpaces_.size()+1); @@ -227,8 +227,7 @@ namespace FROSch { FROSCH_ASSERT(dirichletBoundaryDofsVec.size()==this->NumberOfBlocks_,"dirichletBoundaryDofsVec.size()!=this->NumberOfBlocks_"); FROSCH_ASSERT(nodeListVec.size()==this->NumberOfBlocks_,"nodeListVec.size()!=this->NumberOfBlocks_"); - // Das könnte man noch ändern - // TODO: DAS SOLLTE ALLES IN EINE FUNKTION IN HARMONICCOARSEOPERATOR + // Todo: Move this to a function in HarmonicCoarseOperator at some point for (UN i=0; iNumberOfBlocks_; i++) { FROSCH_ASSERT(!repeatedNodesMapVec[i].is_null(),"repeatedNodesMapVec[i].is_null()"); FROSCH_ASSERT(!repeatedDofMapsVec[i].is_null(),"repeatedDofMapsVec[i].is_null()"); From 87c2db1a4edf29d407ed130253b4176c45fbf129 Mon Sep 17 00:00:00 2001 From: Mauro Perego Date: Thu, 10 Mar 2022 19:48:21 -0700 Subject: [PATCH 11/13] ROL: Remove calls to deprecated Tpetra code --- .../function/ROL_TpetraBoundConstraint.hpp | 134 +++++++++--------- .../src/vector/ROL_TpetraMultiVector.hpp | 23 +-- .../adapters/tpetra/test/vector/test_01.cpp | 2 +- .../rol/example/PDE-OPT/0ld/TOOLS/PDE_FEM.hpp | 6 +- .../PDE-OPT/0ld/adv-diff-react/data.hpp | 6 +- .../filter.hpp | 4 +- .../rol/example/PDE-OPT/0ld/poisson/data.hpp | 6 +- .../PDE-OPT/0ld/stefan-boltzmann/data.hpp | 6 +- .../PDE-OPT/0ld/stoch-adv-diff/data.hpp | 6 +- .../rol/example/PDE-OPT/TOOLS/sysbuilder.hpp | 12 +- .../utils/ROL_ScalarMinimizationTest01.hpp | 2 +- packages/rol/test/elementwise/test_02.cpp | 2 +- 12 files changed, 103 insertions(+), 106 deletions(-) diff --git a/packages/rol/adapters/tpetra/src/function/ROL_TpetraBoundConstraint.hpp b/packages/rol/adapters/tpetra/src/function/ROL_TpetraBoundConstraint.hpp index 220dfbde05c9..32491a4ca989 100644 --- a/packages/rol/adapters/tpetra/src/function/ROL_TpetraBoundConstraint.hpp +++ b/packages/rol/adapters/tpetra/src/function/ROL_TpetraBoundConstraint.hpp @@ -132,14 +132,14 @@ namespace ROL { //---------------------------------------------------------------------- // // Project x onto the bounds - template + template struct Project { typedef typename V::execution_space execution_space; V X_; // Optimization variable - V L_; // Lower bounds - V U_; // Upper bounds + CV L_; // Lower bounds + CV U_; // Upper bounds - Project(V& X, const V& L, const V& U) : X_(X), L_(L), U_(U) {} + Project(V& X, const CV& L, const CV& U) : X_(X), L_(L), U_(U) {} KOKKOS_INLINE_FUNCTION void operator() (const int i) const { @@ -158,15 +158,15 @@ namespace ROL { //---------------------------------------------------------------------- // // Set variables to zero if they correspond to the lower active set - template + template struct PruneLowerActive { typedef typename V::execution_space execution_space; V Y_; // Variable to be pruned - V X_; // Optimization variable - V L_; // Lower bounds + CV X_; // Optimization variable + CV L_; // Lower bounds Real eps_; - PruneLowerActive(V &Y, const V &X, const V &L, Real eps) : + PruneLowerActive(V &Y, const CV &X, const CV &L, Real eps) : Y_(Y), X_(X), L_(L), eps_(eps) {} KOKKOS_INLINE_FUNCTION @@ -184,15 +184,15 @@ namespace ROL { //---------------------------------------------------------------------- // // Set variables to zero if they correspond to the upper active set - template + template struct PruneUpperActive { typedef typename V::execution_space execution_space; V Y_; // Variable to be pruned - V X_; // Optimization variable - V U_; // Upper bounds + CV X_; // Optimization variable + CV U_; // Upper bounds Real eps_; - PruneUpperActive(V &Y, const V &X, const V &U, Real eps) : + PruneUpperActive(V &Y, const CV &X, const CV &U, Real eps) : Y_(Y), X_(X), U_(U), eps_(eps) {} KOKKOS_INLINE_FUNCTION @@ -210,16 +210,16 @@ namespace ROL { //---------------------------------------------------------------------- // // Set variables to zero if they correspond to the active set - template + template struct PruneActive { typedef typename V::execution_space execution_space; V Y_; // Variable to be pruned - V X_; // Optimization variable - V L_; // Lower bounds - V U_; // Upper bounds + CV X_; // Optimization variable + CV L_; // Lower bounds + CV U_; // Upper bounds Real eps_; - PruneActive(V &Y, const V &X, const V &L, const V &U, Real eps) : + PruneActive(V &Y, const CV &X, const CV &L, const CV &U, Real eps) : Y_(Y), X_(X), L_(L), U_(U), eps_(eps) {} KOKKOS_INLINE_FUNCTION @@ -240,17 +240,17 @@ namespace ROL { //---------------------------------------------------------------------- // // Set variables to zero if they correspond to the lower active set and grad is positive - template + template struct GradPruneLowerActive { typedef typename V::execution_space execution_space; V Y_; // Variable to be pruned - V G_; // Gradient - V X_; // Optimization variable - V L_; // Lower bounds + CV G_; // Gradient + CV X_; // Optimization variable + CV L_; // Lower bounds Real xeps_, geps_; - GradPruneLowerActive(V &Y, const V &G, const V &X, const V &L,Real xeps, Real geps) : + GradPruneLowerActive(V &Y, const CV &G, const CV &X, const CV &L,Real xeps, Real geps) : Y_(Y), G_(G), X_(X), L_(L), xeps_(xeps), geps_(geps) {} KOKKOS_INLINE_FUNCTION @@ -268,17 +268,17 @@ namespace ROL { //---------------------------------------------------------------------- // // Set variables to zero if they correspond to the upper active set and grad is negative - template + template struct GradPruneUpperActive { typedef typename V::execution_space execution_space; V Y_; // Variable to be pruned - V G_; // Gradient - V X_; // Optimization variable - V U_; // Upper bounds + CV G_; // Gradient + CV X_; // Optimization variable + CV U_; // Upper bounds Real xeps_, geps_; - GradPruneUpperActive(V &Y, const V &G, const V &X, const V &U, Real xeps, Real geps) : + GradPruneUpperActive(V &Y, const CV &G, const CV &X, const CV &U, Real xeps, Real geps) : Y_(Y), G_(G), X_(X), U_(U), xeps_(xeps), geps_(geps) {} KOKKOS_INLINE_FUNCTION @@ -296,17 +296,17 @@ namespace ROL { //---------------------------------------------------------------------- // // Set variables to zero if they correspond to the active set - template + template struct GradPruneActive { typedef typename V::execution_space execution_space; V Y_; // Variable to be pruned - V G_; // Gradient - V X_; // Optimization variable - V L_; // Lower bounds - V U_; // Upper bounds + CV G_; // Gradient + CV X_; // Optimization variable + CV L_; // Lower bounds + CV U_; // Upper bounds Real xeps_, geps_; - GradPruneActive(V &Y, const V &G, const V &X, const V &L, const V &U, Real xeps, Real geps) : + GradPruneActive(V &Y, const CV &G, const CV &X, const CV &L, const CV &U, Real xeps, Real geps) : Y_(Y), G_(G), X_(X), L_(L), U_(U), xeps_(xeps), geps_(geps) {} KOKKOS_INLINE_FUNCTION @@ -335,20 +335,18 @@ namespace ROL { typedef Tpetra::MultiVector MV; + typedef Tpetra::MultiVector CMV; typedef ROL::Ptr MVP; - typedef ROL::Ptr CMVP; typedef TpetraMultiVector TMV; typedef ROL::Ptr TMVP; typedef typename MV::dual_view_type::t_dev ViewType; + typedef typename CMV::dual_view_type::t_dev ConstViewType; private: int gblDim_; int lclDim_; - MVP lp_; - MVP up_; - - ViewType l_; // Kokkos view of Lower bounds - ViewType u_; // Kokkos view of Upper bounds + ConstViewType l_; // Kokkos view of Lower bounds + ConstViewType u_; // Kokkos view of Upper bounds Real min_diff_; Real scale_; ROL::Ptr > comm_; @@ -366,14 +364,12 @@ namespace ROL { TpetraBoundConstraint(MVP lp, MVP up, Real scale = 1.0) : gblDim_(lp->getGlobalLength()), lclDim_(lp->getLocalLength()), - lp_(lp), - up_(up), - l_(lp->getLocalViewDevice()), - u_(up->getLocalViewDevice()), + l_(lp->getLocalViewDevice(Tpetra::Access::ReadOnly)), + u_(up->getLocalViewDevice(Tpetra::Access::ReadOnly)), scale_(scale), comm_(lp->getMap()->getComm()) { - KokkosStructs::MinGap findmin(l_,u_); + KokkosStructs::MinGap findmin(l_,u_); Real lclMinGap = 0; // Reduce for this MPI process @@ -393,9 +389,9 @@ namespace ROL { int lclFeasible = 1; - ViewType x_lcl = xp->getLocalViewDevice(); + ConstViewType x_lcl = xp->getLocalViewDevice(Tpetra::Access::ReadOnly); - KokkosStructs::Feasible check(x_lcl, l_, u_); + KokkosStructs::Feasible check(x_lcl, l_, u_); Kokkos::parallel_reduce(lclDim_,check,lclFeasible); @@ -410,9 +406,9 @@ namespace ROL { auto xp = getVector(x); - ViewType x_lcl = xp->getLocalViewDevice(); + ViewType x_lcl = xp->getLocalViewDevice(Tpetra::Access::ReadWrite); - KokkosStructs::Project proj(x_lcl,l_,u_); + KokkosStructs::Project proj(x_lcl,l_,u_); Kokkos::parallel_for(lclDim_,proj); } @@ -424,10 +420,10 @@ namespace ROL { Real epsn = std::min(scale_*eps,this->min_diff_); - ViewType x_lcl = xp->getLocalViewDevice(); - ViewType v_lcl = vp->getLocalViewDevice(); + ConstViewType x_lcl = xp->getLocalViewDevice(Tpetra::Access::ReadOnly); + ViewType v_lcl = vp->getLocalViewDevice(Tpetra::Access::ReadWrite); - KokkosStructs::PruneLowerActive prune(v_lcl,x_lcl,l_,epsn); + KokkosStructs::PruneLowerActive prune(v_lcl,x_lcl,l_,epsn); Kokkos::parallel_for(lclDim_,prune); } @@ -438,10 +434,10 @@ namespace ROL { Real epsn = std::min(scale_*eps,this->min_diff_); - ViewType x_lcl = xp->getLocalViewDevice(); - ViewType v_lcl = vp->getLocalViewDevice(); + ConstViewType x_lcl = xp->getLocalViewDevice(Tpetra::Access::ReadOnly); + ViewType v_lcl = vp->getLocalViewDevice(Tpetra::Access::ReadWrite); - KokkosStructs::PruneUpperActive prune(v_lcl,x_lcl,u_,epsn); + KokkosStructs::PruneUpperActive prune(v_lcl,x_lcl,u_,epsn); Kokkos::parallel_for(lclDim_,prune); } @@ -452,10 +448,10 @@ namespace ROL { Real epsn = std::min(scale_*eps,this->min_diff_); - ViewType x_lcl = xp->getLocalViewDevice(); - ViewType v_lcl = vp->getLocalViewDevice(); + ConstViewType x_lcl = xp->getLocalViewDevice(Tpetra::Access::ReadOnly); + ViewType v_lcl = vp->getLocalViewDevice(Tpetra::Access::ReadWrite); - KokkosStructs::PruneActive prune(v_lcl,x_lcl,l_,u_,epsn); + KokkosStructs::PruneActive prune(v_lcl,x_lcl,l_,u_,epsn); Kokkos::parallel_for(lclDim_,prune); } @@ -466,11 +462,11 @@ namespace ROL { auto vp = getVector(v); Real epsn = std::min(scale_*xeps,this->min_diff_); - ViewType x_lcl = xp->getLocalViewDevice(); - ViewType g_lcl = gp->getLocalViewDevice(); - ViewType v_lcl = vp->getLocalViewDevice(); + ConstViewType x_lcl = xp->getLocalViewDevice(Tpetra::Access::ReadOnly); + ConstViewType g_lcl = gp->getLocalViewDevice(Tpetra::Access::ReadOnly); + ViewType v_lcl = vp->getLocalViewDevice(Tpetra::Access::ReadWrite); - KokkosStructs::GradPruneLowerActive prune(v_lcl,g_lcl,x_lcl,l_,epsn,geps); + KokkosStructs::GradPruneLowerActive prune(v_lcl,g_lcl,x_lcl,l_,epsn,geps); Kokkos::parallel_for(lclDim_,prune); } @@ -481,11 +477,11 @@ namespace ROL { auto vp = getVector(v); Real epsn = std::min(scale_*xeps,this->min_diff_); - ViewType x_lcl = xp->getLocalViewDevice(); - ViewType g_lcl = gp->getLocalViewDevice(); - ViewType v_lcl = vp->getLocalViewDevice(); + ConstViewType x_lcl = xp->getLocalViewDevice(Tpetra::Access::ReadOnly); + ConstViewType g_lcl = gp->getLocalViewDevice(Tpetra::Access::ReadOnly); + ViewType v_lcl = vp->getLocalViewDevice(Tpetra::Access::ReadWrite); - KokkosStructs::GradPruneUpperActive prune(v_lcl,g_lcl,x_lcl,u_,epsn,geps); + KokkosStructs::GradPruneUpperActive prune(v_lcl,g_lcl,x_lcl,u_,epsn,geps); Kokkos::parallel_for(lclDim_,prune); } @@ -496,11 +492,11 @@ namespace ROL { auto vp = getVector(v); Real epsn = std::min(scale_*xeps,this->min_diff_); - ViewType x_lcl = xp->getLocalViewDevice(); - ViewType g_lcl = gp->getLocalViewDevice(); - ViewType v_lcl = vp->getLocalViewDevice(); + ConstViewType x_lcl = xp->getLocalViewDevice(Tpetra::Access::ReadOnly); + ConstViewType g_lcl = gp->getLocalViewDevice(Tpetra::Access::ReadOnly); + ViewType v_lcl = vp->getLocalViewDevice(Tpetra::Access::ReadWrite); - KokkosStructs::GradPruneActive prune(v_lcl,g_lcl,x_lcl,l_,u_,epsn,geps); + KokkosStructs::GradPruneActive prune(v_lcl,g_lcl,x_lcl,l_,u_,epsn,geps); Kokkos::parallel_for(lclDim_,prune); } diff --git a/packages/rol/adapters/tpetra/src/vector/ROL_TpetraMultiVector.hpp b/packages/rol/adapters/tpetra/src/vector/ROL_TpetraMultiVector.hpp index 925dc5f96eaf..b9d4cff10a83 100644 --- a/packages/rol/adapters/tpetra/src/vector/ROL_TpetraMultiVector.hpp +++ b/packages/rol/adapters/tpetra/src/vector/ROL_TpetraMultiVector.hpp @@ -92,12 +92,13 @@ namespace TPMultiVector { class Node=Tpetra::Map<>::node_type > struct binaryFunc { typedef typename Tpetra::MultiVector::dual_view_type::t_dev ViewType; + typedef typename Tpetra::MultiVector::dual_view_type::t_dev ConstViewType; typedef typename ViewType::execution_space execution_space; ViewType X_; - ViewType Y_; + ConstViewType Y_; const Elementwise::BinaryFunction* const f_; - binaryFunc(ViewType& X, const ViewType& Y, const Elementwise::BinaryFunction* const f) + binaryFunc(ViewType& X, const ConstViewType& Y, const Elementwise::BinaryFunction* const f) : X_(X), Y_(Y), f_(f) {} KOKKOS_INLINE_FUNCTION @@ -115,12 +116,12 @@ namespace TPMultiVector { class GO=Tpetra::Map<>::global_ordinal_type, class Node=Tpetra::Map<>::node_type > struct reduceFunc { - typedef typename Tpetra::MultiVector::dual_view_type::t_dev ViewType; - typedef typename ViewType::execution_space execution_space; - ViewType X_; + typedef typename Tpetra::MultiVector::dual_view_type::t_dev ConstViewType; + typedef typename ConstViewType::execution_space execution_space; + ConstViewType X_; const Elementwise::ReductionOp* const r_; - reduceFunc(const ViewType& X, const Elementwise::ReductionOp* const r) + reduceFunc(const ConstViewType& X, const Elementwise::ReductionOp* const r) : X_(X), r_(r) {} KOKKOS_INLINE_FUNCTION @@ -287,10 +288,10 @@ class TpetraMultiVector : public Vector { /*****************************************************************************/ private: typedef typename Tpetra::MultiVector::dual_view_type::t_dev ViewType; - + typedef typename Tpetra::MultiVector::dual_view_type::t_dev ConstViewType; public: void applyUnary( const Elementwise::UnaryFunction &f ) { - ViewType v_lcl = tpetra_vec_->getLocalViewDevice(); + ViewType v_lcl = tpetra_vec_->getLocalViewDevice(Tpetra::Access::ReadWrite); int lclDim = tpetra_vec_->getLocalLength(); TPMultiVector::unaryFunc func(v_lcl, &f); @@ -307,8 +308,8 @@ class TpetraMultiVector : public Vector { const TpetraMultiVector &ex = dynamic_cast(x); Ptr > xp = ex.getVector(); - ViewType v_lcl = tpetra_vec_->getLocalViewDevice(); - ViewType x_lcl = xp->getLocalViewDevice(); + ViewType v_lcl = tpetra_vec_->getLocalViewDevice(Tpetra::Access::ReadWrite); + ConstViewType x_lcl = xp->getLocalViewDevice(Tpetra::Access::ReadOnly); int lclDim = tpetra_vec_->getLocalLength(); @@ -319,7 +320,7 @@ class TpetraMultiVector : public Vector { } Real reduce( const Elementwise::ReductionOp &r ) const { - ViewType v_lcl = tpetra_vec_->getLocalViewDevice(); + ConstViewType v_lcl = tpetra_vec_->getLocalViewDevice(Tpetra::Access::ReadOnly); int lclDim = tpetra_vec_->getLocalLength(); TPMultiVector::reduceFunc func(v_lcl, &r); diff --git a/packages/rol/adapters/tpetra/test/vector/test_01.cpp b/packages/rol/adapters/tpetra/test/vector/test_01.cpp index ff3ff7b08259..7a6f3c095c95 100644 --- a/packages/rol/adapters/tpetra/test/vector/test_01.cpp +++ b/packages/rol/adapters/tpetra/test/vector/test_01.cpp @@ -191,7 +191,7 @@ int main(int argc, char *argv[]) { MVP hv_ptr = ROL::makePtr(map,1,true); MVP ihhv_ptr = ROL::makePtr(map,1,true); - int numElem = map->getNodeNumElements(); + int numElem = map->getLocalNumElements(); for( LO lclRow = 0; lclRow < static_cast (numElem); ++lclRow) { const GO gblRow = map->getGlobalElement(lclRow); diff --git a/packages/rol/example/PDE-OPT/0ld/TOOLS/PDE_FEM.hpp b/packages/rol/example/PDE-OPT/0ld/TOOLS/PDE_FEM.hpp index bc0b57d223b1..8d10b8123aff 100644 --- a/packages/rol/example/PDE-OPT/0ld/TOOLS/PDE_FEM.hpp +++ b/packages/rol/example/PDE-OPT/0ld/TOOLS/PDE_FEM.hpp @@ -278,13 +278,13 @@ class PDE_FEM { // Build maps. myOverlapMap_ = ROL::makePtr>(Teuchos::OrdinalTraits::invalid(), myGlobIds_, 0, commPtr_); - //std::cout << std::endl << myOverlapMap_->getNodeElementList()<getLocalElementList()<(myGlobIds_, commPtr_); to build the overlap map. **/ myUniqueMap_ = Tpetra::createOneToOne(myOverlapMap_); - //std::cout << std::endl << myUniqueMap_->getNodeElementList() << std::endl; + //std::cout << std::endl << myUniqueMap_->getLocalElementList() << std::endl; myCellMap_ = ROL::makePtr>(Teuchos::OrdinalTraits::invalid(), this->myCellIds_, 0, this->commPtr_); } @@ -387,7 +387,7 @@ class PDE_FEM { /****************************************/ Teuchos::ArrayRCP cellDofsArrayRCP = cellDofs_.getData(); - Teuchos::Array graphEntriesPerRow(myUniqueMap_->getNodeNumElements()); + Teuchos::Array graphEntriesPerRow(myUniqueMap_->getLocalNumElements()); for (GO i=0; i>(Teuchos::OrdinalTraits::invalid(), myGlobIds_, 0, comm); - //std::cout << std::endl << myOverlapMap_->getNodeElementList(); + //std::cout << std::endl << myOverlapMap_->getLocalElementList(); /** One can also use the non-member function: myOverlapMap_ = Tpetra::createNonContigMap(myGlobIds_, comm); to build the overlap map. **/ myUniqueMap_ = Tpetra::createOneToOne(myOverlapMap_); - //std::cout << std::endl << myUniqueMap_->getNodeElementList() << std::endl; + //std::cout << std::endl << myUniqueMap_->getLocalElementList() << std::endl; /****************************************************/ /****************************************************/ @@ -433,7 +433,7 @@ class PoissonData { // Assemble graph. Teuchos::ArrayRCP cellDofsArrayRCP = cellDofs.getData(); - Teuchos::Array graphEntriesPerRow(myUniqueMap_->getNodeNumElements()); + Teuchos::Array graphEntriesPerRow(myUniqueMap_->getLocalNumElements()); for (GO i=0; i>(Teuchos::OrdinalTraits::invalid(), myGlobIds_, 0, comm); - //std::cout << std::endl << myOverlapMap_->getNodeElementList(); + //std::cout << std::endl << myOverlapMap_->getLocalElementList(); /** One can also use the non-member function: myOverlapMap_ = Tpetra::createNonContigMap(myGlobIds_, comm); to build the overlap map. **/ myUniqueMap_ = Tpetra::createOneToOne(myOverlapMap_); - //std::cout << std::endl << myUniqueMap_->getNodeElementList() << std::endl; + //std::cout << std::endl << myUniqueMap_->getLocalElementList() << std::endl; myBColumnMap_ = ROL::makePtr>(Teuchos::OrdinalTraits::invalid(), myCellIds_, 0, comm); diff --git a/packages/rol/example/PDE-OPT/0ld/poisson/data.hpp b/packages/rol/example/PDE-OPT/0ld/poisson/data.hpp index be19744c2740..e481ff47ff54 100644 --- a/packages/rol/example/PDE-OPT/0ld/poisson/data.hpp +++ b/packages/rol/example/PDE-OPT/0ld/poisson/data.hpp @@ -244,13 +244,13 @@ class PoissonData { // Build maps. myOverlapMap_ = ROL::makePtr>(Teuchos::OrdinalTraits::invalid(), myGlobIds_, 0, comm); - //std::cout << std::endl << myOverlapMap_->getNodeElementList(); + //std::cout << std::endl << myOverlapMap_->getLocalElementList(); /** One can also use the non-member function: myOverlapMap_ = Tpetra::createNonContigMap(myGlobIds_, comm); to build the overlap map. **/ myUniqueMap_ = Tpetra::createOneToOne(myOverlapMap_); - //std::cout << std::endl << myUniqueMap_->getNodeElementList() << std::endl; + //std::cout << std::endl << myUniqueMap_->getLocalElementList() << std::endl; /****************************************************/ /****************************************************/ @@ -383,7 +383,7 @@ class PoissonData { // Assemble graph. Teuchos::ArrayRCP cellDofsArrayRCP = cellDofs.getData(); - Teuchos::Array graphEntriesPerRow(myUniqueMap_->getNodeNumElements()); + Teuchos::Array graphEntriesPerRow(myUniqueMap_->getLocalNumElements()); for (GO i=0; i>(Teuchos::OrdinalTraits::invalid(), myGlobIds_, 0, comm); - //std::cout << std::endl << myOverlapMap_->getNodeElementList(); + //std::cout << std::endl << myOverlapMap_->getLocalElementList(); /** One can also use the non-member function: myOverlapMap_ = Tpetra::createNonContigMap(myGlobIds_, comm); to build the overlap map. **/ myUniqueMap_ = Tpetra::createOneToOne(myOverlapMap_); - //std::cout << std::endl << myUniqueMap_->getNodeElementList() << std::endl; + //std::cout << std::endl << myUniqueMap_->getLocalElementList() << std::endl; /****************************************************/ /****************************************************/ @@ -405,7 +405,7 @@ class StefanBoltzmannData { // Assemble graph. Teuchos::ArrayRCP cellDofsArrayRCP = cellDofs.getData(); - Teuchos::Array graphEntriesPerRow(myUniqueMap_->getNodeNumElements()); + Teuchos::Array graphEntriesPerRow(myUniqueMap_->getLocalNumElements()); for (GO i=0; i>(Teuchos::OrdinalTraits::invalid(), myGlobIds_, 0, comm); - //std::cout << std::endl << myOverlapMap_->getNodeElementList(); + //std::cout << std::endl << myOverlapMap_->getLocalElementList(); /** One can also use the non-member function: myOverlapMap_ = Tpetra::createNonContigMap(myGlobIds_, comm); to build the overlap map. **/ myUniqueMap_ = Tpetra::createOneToOne(myOverlapMap_); - //std::cout << std::endl << myUniqueMap_->getNodeElementList() << std::endl; + //std::cout << std::endl << myUniqueMap_->getLocalElementList() << std::endl; /****************************************************/ /****************************************************/ @@ -480,7 +480,7 @@ class PoissonData { // Assemble graph. Teuchos::ArrayRCP cellDofsArrayRCP = cellDofs.getData(); - Teuchos::Array graphEntriesPerRow(myUniqueMap_->getNodeNumElements()); + Teuchos::Array graphEntriesPerRow(myUniqueMap_->getLocalNumElements()); for (GO i=0; i > mapRes = A->getRangeMap(); // Get individual indices. - Teuchos::ArrayView idxSim = mapSim->getNodeElementList(); - Teuchos::ArrayView idxOpt = mapOpt->getNodeElementList(); - Teuchos::ArrayView idxRes = mapRes->getNodeElementList(); + Teuchos::ArrayView idxSim = mapSim->getLocalElementList(); + Teuchos::ArrayView idxOpt = mapOpt->getLocalElementList(); + Teuchos::ArrayView idxRes = mapRes->getLocalElementList(); // Get communicator. ROL::Ptr > comm = mapSim->getComm(); @@ -347,9 +347,9 @@ class SysBuilder { ROL::Ptr > mapRes = vecRes->getMap(); // Get individual indices. - Teuchos::ArrayView idxSim = mapSim->getNodeElementList(); - Teuchos::ArrayView idxOpt = mapOpt->getNodeElementList(); - Teuchos::ArrayView idxRes = mapRes->getNodeElementList(); + Teuchos::ArrayView idxSim = mapSim->getLocalElementList(); + Teuchos::ArrayView idxOpt = mapOpt->getLocalElementList(); + Teuchos::ArrayView idxRes = mapRes->getLocalElementList(); // Get communicator. ROL::Ptr > comm = mapSim->getComm(); diff --git a/packages/rol/src/utils/ROL_ScalarMinimizationTest01.hpp b/packages/rol/src/utils/ROL_ScalarMinimizationTest01.hpp index 08c84e21f983..e12233d9ded6 100644 --- a/packages/rol/src/utils/ROL_ScalarMinimizationTest01.hpp +++ b/packages/rol/src/utils/ROL_ScalarMinimizationTest01.hpp @@ -128,7 +128,7 @@ class ScalarMinimizationTest01 : public ScalarMinimizationTest { A = (Real)((i+1)*(i+1)); B = (Real)((i+2)*(i+2)); ScalarMinimizationTest::run(fx,x,nfval,ngrad,*f,A,B); - flag *= std::abs(x-xvector_[i]) < 10.0*std::sqrt(ROL_EPSILON())*xvector_[i]; + flag &= std::abs(x-xvector_[i]) < 10.0*std::sqrt(ROL_EPSILON())*xvector_[i]; stream << " "; stream << std::setw(10) << std::left << (int)A; diff --git a/packages/rol/test/elementwise/test_02.cpp b/packages/rol/test/elementwise/test_02.cpp index fbd548f0ca2c..bf69af043353 100644 --- a/packages/rol/test/elementwise/test_02.cpp +++ b/packages/rol/test/elementwise/test_02.cpp @@ -135,7 +135,7 @@ int main(int argc, char *argv[]) { V z(z_ptr); V z_thresh(z_thresh_ptr); - LO numElements = static_cast( map->getNodeNumElements() ); + LO numElements = static_cast( map->getLocalNumElements() ); for( LO lclRow = 0; lclRow < numElements; ++lclRow ) { const GO gblRow = map->getGlobalElement(lclRow); From 5cd0fa8742c4e536e26fe85e3ba86d751405f8b3 Mon Sep 17 00:00:00 2001 From: Alexander Heinlein Date: Fri, 11 Mar 2022 10:55:49 +0100 Subject: [PATCH 12/13] Adding FROSch_Types.h --- .../shylu/shylu_dd/frosch/src/CMakeLists.txt | 1 + .../FROSch_SchwarzPreconditioner_decl.hpp | 2 +- .../frosch/src/Tools/FROSch_Tools_decl.hpp | 18 +---- .../shylu_dd/frosch/src/Tools/FROSch_Types.h | 74 +++++++++++++++++++ 4 files changed, 77 insertions(+), 18 deletions(-) create mode 100644 packages/shylu/shylu_dd/frosch/src/Tools/FROSch_Types.h diff --git a/packages/shylu/shylu_dd/frosch/src/CMakeLists.txt b/packages/shylu/shylu_dd/frosch/src/CMakeLists.txt index 1efe138e94cb..16074eff4ac9 100644 --- a/packages/shylu/shylu_dd/frosch/src/CMakeLists.txt +++ b/packages/shylu/shylu_dd/frosch/src/CMakeLists.txt @@ -151,6 +151,7 @@ APPEND_SET(HEADERS Tools/FROSch_Timers.h Tools/FROSch_Tools_decl.hpp Tools/FROSch_Tools_def.hpp + Tools/FROSch_Types.h ) # Set sources diff --git a/packages/shylu/shylu_dd/frosch/src/SchwarzPreconditioners/FROSch_SchwarzPreconditioner_decl.hpp b/packages/shylu/shylu_dd/frosch/src/SchwarzPreconditioners/FROSch_SchwarzPreconditioner_decl.hpp index 51c1ace41232..7cd2ca08d99c 100644 --- a/packages/shylu/shylu_dd/frosch/src/SchwarzPreconditioners/FROSch_SchwarzPreconditioner_decl.hpp +++ b/packages/shylu/shylu_dd/frosch/src/SchwarzPreconditioners/FROSch_SchwarzPreconditioner_decl.hpp @@ -47,7 +47,7 @@ #include -#include +#include #include diff --git a/packages/shylu/shylu_dd/frosch/src/Tools/FROSch_Tools_decl.hpp b/packages/shylu/shylu_dd/frosch/src/Tools/FROSch_Tools_decl.hpp index 42304ae7a3aa..2eeb635e64a9 100644 --- a/packages/shylu/shylu_dd/frosch/src/Tools/FROSch_Tools_decl.hpp +++ b/packages/shylu/shylu_dd/frosch/src/Tools/FROSch_Tools_decl.hpp @@ -44,6 +44,7 @@ #include +#include #include #include @@ -71,23 +72,6 @@ namespace FROSch { using namespace Teuchos; using namespace Xpetra; - #if defined HAVE_XPETRA_EPETRA || defined HAVE_TPETRA_INT_INT - typedef int DefaultGlobalOrdinal; - #elif !defined HAVE_TPETRA_INT_LONG_LONG - typedef long DefaultGlobalOrdinal; - #else - typedef long long DefaultGlobalOrdinal; - #endif - - enum DofOrdering {NodeWise=0,DimensionWise=1,Custom=2}; - - enum class NullSpaceType - { - Laplace = 0, - Elasticity = 1 - }; - - enum Verbosity {None=0,All=1}; template diff --git a/packages/shylu/shylu_dd/frosch/src/Tools/FROSch_Types.h b/packages/shylu/shylu_dd/frosch/src/Tools/FROSch_Types.h new file mode 100644 index 000000000000..708cbd6e7479 --- /dev/null +++ b/packages/shylu/shylu_dd/frosch/src/Tools/FROSch_Types.h @@ -0,0 +1,74 @@ +//@HEADER +// ************************************************************************ +// +// ShyLU: Hybrid preconditioner package +// Copyright 2012 Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Alexander Heinlein (alexander.heinlein@uni-koeln.de) +// +// ************************************************************************ +//@HEADER + +#ifndef _FROSCH_TYPES_H +#define _FROSCH_TYPES_H + +#include + + +namespace FROSch { + + using namespace std; + using namespace Teuchos; + using namespace Xpetra; + + #if defined HAVE_XPETRA_EPETRA || defined HAVE_TPETRA_INT_INT + typedef int DefaultGlobalOrdinal; + #elif !defined HAVE_TPETRA_INT_LONG_LONG + typedef long DefaultGlobalOrdinal; + #else + typedef long long DefaultGlobalOrdinal; + #endif + + enum DofOrdering {NodeWise=0,DimensionWise=1,Custom=2}; + + enum class NullSpaceType + { + Laplace = 0, + Elasticity = 1 + }; + + enum Verbosity {None=0,All=1}; + +} + +#endif From e1359d89498e99372aa106e700da27e4e768cf6d Mon Sep 17 00:00:00 2001 From: Chris Siefert Date: Fri, 11 Mar 2022 15:44:57 -0700 Subject: [PATCH 13/13] Ctest: Fixing typo --- cmake/ctest/drivers/lightsaber/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/ctest/drivers/lightsaber/CMakeLists.txt b/cmake/ctest/drivers/lightsaber/CMakeLists.txt index 6750b75854ea..1e6c5d39fc93 100644 --- a/cmake/ctest/drivers/lightsaber/CMakeLists.txt +++ b/cmake/ctest/drivers/lightsaber/CMakeLists.txt @@ -10,7 +10,7 @@ TRILINOS_DRIVER_ADD_DASHBOARD( TRILINOS_DRIVER_ADD_DASHBOARD( SERIAL_RELEASE_FLOAT - ctest_linux_experimental_mpi_release_glosy_lightsaber.cmake + ctest_linux_experimental_mpi_release_float_lightsaber.cmake CTEST_INSTALLER_TYPE release RUN_SERIAL TIMEOUT_MINUTES 330