Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MueLu: Cut Drop Behaving Differently on Entries of Equal Value #13377

Open
NyquilDreams opened this issue Aug 21, 2024 · 2 comments
Open

MueLu: Cut Drop Behaving Differently on Entries of Equal Value #13377

NyquilDreams opened this issue Aug 21, 2024 · 2 comments
Labels
pkg: MueLu type: bug The primary issue is a bug in Trilinos code or tests

Comments

@NyquilDreams
Copy link

NyquilDreams commented Aug 21, 2024

Bug Report

@jhux2 @cgcgcg @csiefer2

Description

While testing the Cut Drop Algorithm in MueLu_CoalesceDropFactory_def.hpp using the unit tests in CoalesceDropFactory.cpp, I noticed that some entries with a value of -1 were being kept while other entries that also have a value of -1 were being dropped in the same row. This is caused by a combination of the fact that at least one off diagonal entry must be kept and a corner case when threshold is less than 1 which causes only the first off diagonal entry to be kept. A check for this scenario needs to be added so that entries of the same value are either all kept or all dropped. The unit test should also be modified accordingly.

TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL(CoalesceDropFactory, ClassicalUnScaledCut, Scalar, LocalOrdinal, GlobalOrdinal, Node) {
#include <MueLu_UseShortNames.hpp>
typedef Teuchos::ScalarTraits<SC> STS;
typedef typename STS::magnitudeType real_type;
typedef Xpetra::MultiVector<real_type, LO, GO, NO> RealValuedMultiVector;
MUELU_TESTING_SET_OSTREAM;
MUELU_TESTING_LIMIT_SCOPE(Scalar, GlobalOrdinal, Node);
out << "version: " << MueLu::Version() << std::endl;
RCP<const Teuchos::Comm<int> > comm = Parameters::getDefaultComm();
Level fineLevel;
TestHelpers::TestFactory<SC, LO, GO, NO>::createSingleLevelHierarchy(fineLevel);
RCP<Matrix> A = TestHelpers::TestFactory<SC, LO, GO, NO>::Build1DPoisson(36);
fineLevel.Set("A", A);
Teuchos::ParameterList galeriList;
galeriList.set("nx", Teuchos::as<GlobalOrdinal>(36));
RCP<RealValuedMultiVector> coordinates = Galeri::Xpetra::Utils::CreateCartesianCoordinates<SC, LO, GO, Map, RealValuedMultiVector>("1D", A->getRowMap(), galeriList);
fineLevel.Set("Coordinates", coordinates);
CoalesceDropFactory coalesceDropFact;
coalesceDropFact.SetDefaultVerbLevel(MueLu::Extreme);
// We're dropping all the interior off-diagonal entries.
// dx = 1/36
// L_ij = -36
// L_ii = 72
// criterion for dropping is |L_ij|^2 <= tol^2 * |L_ii*L_jj|
coalesceDropFact.SetParameter("aggregation: drop tol", Teuchos::ParameterEntry(0.51));

for (size_t i = 1; i < n; ++i) {
if (!drop) {
auto const& x = drop_vec[i - 1];
auto const& y = drop_vec[i];
auto a = x.val;
auto b = y.val;
if (a > realThreshold * b) {
drop = true;
#ifdef HAVE_MUELU_DEBUG
if (distanceLaplacianCutVerbose) {
std::cout << "DJS: KEEP, N, ROW: " << i + 1 << ", " << n << ", " << row << std::endl;
}
#endif
}
}
drop_vec[i].drop = drop;
}

@NyquilDreams NyquilDreams added the type: bug The primary issue is a bug in Trilinos code or tests label Aug 21, 2024
Copy link

Automatic mention of the @trilinos/muelu team

NyquilDreams pushed a commit to NyquilDreams/Trilinos that referenced this issue Aug 24, 2024
Issues listed above have been addressed and unit test has been modified to reflect this.
Column ID check in unit tests might need to be fixed.

Signed-off-by: Ian Halim <[email protected]>
@cgcgcg
Copy link
Contributor

cgcgcg commented Sep 4, 2024

Maybe it's easier to not allow the user to set a threshold <= 1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: MueLu type: bug The primary issue is a bug in Trilinos code or tests
Projects
None yet
Development

No branches or pull requests

2 participants