]> https://gitweb.dealii.org/ - dealii.git/commit
Fix the frequently-failing trilinos/solver_control_06 test. 18143/head
authorDavid Wells <drwells@email.unc.edu>
Mon, 17 Feb 2025 16:22:50 +0000 (11:22 -0500)
committerDavid Wells <drwells@email.unc.edu>
Mon, 17 Feb 2025 16:33:47 +0000 (11:33 -0500)
commitbe28dcd04008880cc5a2977b9a6b92af6d066f4b
tree7c1c031cb921e3f551ff447c14e053362297513b
parent41720a6c44145d7b1ebf0a4247a08b78593ae194
Fix the frequently-failing trilinos/solver_control_06 test.

The main problem here is

    // Trilinos dumps the output into std::cout
    // We catch this output and it is written to the stdout logfile
    // Since we're interested in this output we read it back in and
    // write parts of it to the logstream
    // We can only do this reliably if we are not running in parallel (sometimes
    // stdout is not written yet otherwise)
    if (Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD) == 1)
      {
        std::ifstream inputfile;
        inputfile.open("stdout");
        Assert(inputfile.good() && inputfile.is_open(), ExcIO());
        std::string       line;
        const std::string key = "*****";
        while (std::getline(inputfile, line))
          {
            if (line.find(key) != std::string::npos)
              deallog << line << std::endl;
          }
        inputfile.close();
      }
    deallog << "OK" << std::endl;

which falsely assumes that, at the point we hit that check, all buffered
output has been written. In general we cannot guarantee this until the
end of the program since we are actively, during program execution,
piping stdout and sterr to output files.

We don't really need to check this output (Trilinos' residuals) anyway -
we already know, if the solver converges, that we got close enough.
Hence, this patch replaces all of this with our standard
check_solver_within_range() macro which is vastly more robust.
tests/trilinos/solver_control_06.cc
tests/trilinos/solver_control_06.with_p4est=true.mpirun=1.output
tests/trilinos/solver_control_06.with_p4est=true.mpirun=1.output.2 [deleted file]
tests/trilinos/solver_control_06.with_p4est=true.mpirun=1.output.3 [deleted file]
tests/trilinos/solver_control_06.with_p4est=true.mpirun=2.output
tests/trilinos/solver_control_06.with_p4est=true.mpirun=2.output.2 [deleted file]
tests/trilinos/solver_control_06.with_p4est=true.mpirun=2.output.3 [deleted file]

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.