ShyLU: Frosch tests incorrectly allow *petra objects to persist past MPI_Finalize
Created by: mhoemmen
Frosch (not sure if capitalized right) tests incorrectly allow Epetra and Tpetra objects to persist past MPI_Finalize. They also call MPI_Comm_split
without calling MPI_Comm_free
on the resulting communicator. This may be causing errors that hinder progress on #2483. Frosch tests may be failing on processes other than Process 0, but the tests do not correctly use the Teuchos unit test framework in order to catch errors on other processes.
@trilinos/tpetra @trilinos/epetra @trilinos/belos @trilinos/shylu @MicheldeMessieres
Examples
The following test creates both Epetra and Tpetra objects at the same scope as main()
:
Other Frosch tests also do this.
Recommended fix
- Never create *petra objects at the same scope as main(). Always create them in an inner scope, so they fall out of scope before
MPI_Finalize
,Kokkos::finalize
, orTpetra::finalize
are called. For example:
int main (int argc, char* argv[]) {
MPI_Init (&argc, &argv);
{
Epetra_MpiComm epetraComm (MPI_COMM_WORLD);
// ... the rest of your test goes here ...
}
// no Trilinos object may exist past here --
// no *petra object, no Belos solver, NOTHING
MPI_Finalize ();
return EXIT_SUCCESS;
}
-
Always call
MPI_Comm_free
on anMPI_Comm
created using one of the communicator constructors likeMPI_Comm_split
. Here is an example of a Frosch test that violates this requirement. -
Make the tests catch errors on processes other than Process 0. For example, do an all-reduce on a success code. (Another option would be to rewrite the tests using the Teuchos unit test framework, and tell the test to do an all-reduce at the end. Here is an example.)
Motivation and Context
This blocks #2483.
Related Issues
- Blocks #2483