From fedafca9e5ebdd8957786a90e1f3eeb75d87920a Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 13 Jul 2023 23:53:36 -0500 Subject: [PATCH] =?utf8?q?Test=20mpi/petsc=5Fstep-27:=20make=20sure=20to?= =?utf8?q?=20only=20write=20to=20the=20file=20=C2=BBoutput=C2=AB=20from=20?= =?utf8?q?rank=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- tests/mpi/petsc_step-27.cc | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/tests/mpi/petsc_step-27.cc b/tests/mpi/petsc_step-27.cc index e92b98983e..19344bf924 100644 --- a/tests/mpi/petsc_step-27.cc +++ b/tests/mpi/petsc_step-27.cc @@ -121,8 +121,6 @@ namespace Step27 LA::MPI::Vector system_rhs; const unsigned int max_degree; - - ConditionalOStream pcout; }; @@ -171,8 +169,6 @@ namespace Step27 , triangulation(mpi_communicator) , dof_handler(triangulation) , max_degree(dim <= 2 ? 7 : 5) - , pcout(deallog.get_file_stream(), - (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)) { for (unsigned int degree = 2; degree <= max_degree; ++degree) { @@ -348,8 +344,8 @@ namespace Step27 system_rhs, preconditioner); - pcout << " Solved in " << solver_control.last_step() << " iterations." - << std::endl; + deallog << " Solved in " << solver_control.last_step() << " iterations." + << std::endl; constraints.distribute(completely_distributed_solution); @@ -443,21 +439,21 @@ namespace Step27 { for (unsigned int cycle = 0; cycle < 5; ++cycle) { - pcout << "Cycle " << cycle << ':' << std::endl; + deallog << "Cycle " << cycle << ':' << std::endl; if (cycle == 0) create_coarse_grid(); setup_system(); - pcout << " Number of active cells : " - << triangulation.n_global_active_cells() << std::endl - << " Number of degrees of freedom: " << dof_handler.n_dofs() - << std::endl - << " Number of constraints : " - << Utilities::MPI::sum(constraints.n_constraints(), - mpi_communicator) - << std::endl; + deallog << " Number of active cells : " + << triangulation.n_global_active_cells() << std::endl + << " Number of degrees of freedom: " << dof_handler.n_dofs() + << std::endl + << " Number of constraints : " + << Utilities::MPI::sum(constraints.n_constraints(), + mpi_communicator) + << std::endl; assemble_system(); solve(); @@ -476,9 +472,10 @@ main(int argc, char *argv[]) using namespace Step27; Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); - // This is the right choice (e.g., vs. mpi_initlog()) since the test - // uses ConditionalOStream - initlog(); + + // We need mpi_initlog() in order to make sure to only write to the + // »output« file from rank 0. + mpi_initlog(); LaplaceProblem<2> laplace_problem; laplace_problem.run(); -- 2.39.5