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: Potential typing mistake in BelosXpetraStatusTestGenResSubNorm (edited) #6082

Closed
kliegeois opened this issue Oct 11, 2019 · 2 comments
Labels
pkg: MueLu pkg: Xpetra type: bug The primary issue is a bug in Trilinos code or tests

Comments

@kliegeois
Copy link
Contributor

Bug Report

@trilinos/muelu
@tawiesn

Description

There is, from time to time, a seg fault in file BelosXpetraStatusTestGenResSubNorm.hpp in the block of lines 289-306:

    for (; p2<curLSIdx_.end(); ++p2) {
      // Check if this index is valid
      if (*p != -1) {
        // Check if any of the residuals are larger than the tolerance.
        if (testvector_[ *p2 ] > tolerance_) {
          // do nothing.
        } else if (testvector_[ *p2 ] == Teuchos::ScalarTraits<Scalar>::magnitude(Teuchos::ScalarTraits<Scalar>::zero())) {
          reset();
        } else if (testvector_[ *p2 ] <= tolerance_) {
          ind_[have] = *p2;
          have++;
        } else {
          // Throw an std::exception if a NaN is found.
          status_ = Failed;
          TEUCHOS_TEST_FOR_EXCEPTION(true,StatusTestError,"StatusTestGenResSubNorm::checkStatus(): NaN has been detected.");
        }
      }
    }

It seems that the seg fault is due to testvector_[ *p2 ] and that *p2 is equal to -1.

I think that the test if (*p != -1) should be replaced by if (*p2 != -1) as BelosXpetraStatusTestGenResSubNorm.hpp is a template specialization of BelosStatusTestGenResSubNorm.hpp where the test is indeed if (*p2 != -1).

@kliegeois kliegeois added type: bug The primary issue is a bug in Trilinos code or tests pkg: MueLu pkg: Xpetra labels Oct 11, 2019
@kliegeois
Copy link
Contributor Author

My bad, the seg fault was coming from another instruction.
Nevertheless, I think that if (*p != -1) is potentially a typing mistake.

@kliegeois kliegeois changed the title MueLu: Segmentation fault in BelosXpetraStatusTestGenResSubNorm MueLu: Potential typing mistake in BelosXpetraStatusTestGenResSubNorm (edited) Oct 11, 2019
kliegeois added a commit to kliegeois/Trilinos that referenced this issue Feb 10, 2020
kliegeois added a commit that referenced this issue Feb 24, 2020
@kliegeois
Copy link
Contributor Author

Resolved by #6834 .

jmgate pushed a commit to tcad-charon/Trilinos that referenced this issue Feb 25, 2020
…s:develop' (667c3c1).

* trilinos-develop:
  MueLu Ifpack2Smoother: Check if Ifpack2 smoother is supported before construction
  Ifpack2 Factory: add `isSupported` method
  Verify that the directory exists before cleaning
  Xpetra: Fix incorrect assumption in Map tests
  Xpetra: Fix test build errors with Scalar=complex<float>
  Tpetra: Factor out createPrefix; add verbose output to Map
  Added point evaulation objective function.
  Fixed multiple compiler warnings.
  tpetra:  For trilinos#6796, adding test of environment variable to test.
  Xpetra: compute the static size of a blockedCrsMatrix to allocate the required memory when merging
  Removed RHS definition from PDE since RHS is zero.
  MueLu: correction of a typo highlighted in trilinos#6082
  Commented out reset of firstSolve_.
  Added example from Leyffer et al paper with TV regularizer.
jmgate pushed a commit to tcad-charon/Trilinos that referenced this issue Feb 25, 2020
…s:develop' (667c3c1).

* trilinos-develop:
  MueLu Ifpack2Smoother: Check if Ifpack2 smoother is supported before construction
  Ifpack2 Factory: add `isSupported` method
  Verify that the directory exists before cleaning
  Xpetra: Fix incorrect assumption in Map tests
  Xpetra: Fix test build errors with Scalar=complex<float>
  Tpetra: Factor out createPrefix; add verbose output to Map
  Added point evaulation objective function.
  Fixed multiple compiler warnings.
  tpetra:  For trilinos#6796, adding test of environment variable to test.
  Xpetra: compute the static size of a blockedCrsMatrix to allocate the required memory when merging
  Removed RHS definition from PDE since RHS is zero.
  MueLu: correction of a typo highlighted in trilinos#6082
  Commented out reset of firstSolve_.
  Added example from Leyffer et al paper with TV regularizer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: MueLu pkg: Xpetra type: bug The primary issue is a bug in Trilinos code or tests
Projects
None yet
Development

No branches or pull requests

1 participant