From 6689af7c9a65cdfcd6b7d41fefccba5293aafb0c Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 8 Mar 2018 07:41:43 -0700 Subject: [PATCH] Better document a piece of code. --- source/lac/petsc_parallel_vector.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/lac/petsc_parallel_vector.cc b/source/lac/petsc_parallel_vector.cc index 08c2c8e89b..859a952b9a 100644 --- a/source/lac/petsc_parallel_vector.cc +++ b/source/lac/petsc_parallel_vector.cc @@ -378,13 +378,18 @@ namespace PETScWrappers else out.setf (std::ios::fixed, std::ios::floatfield); + // let each processor produce its output in turn. this requires + // synchronizing output between processors using a barrier -- + // which is clearly slow, but nobody is going to print a whole + // matrix this way on a regular basis for production runs, so + // the slowness of the barrier doesn't matter for ( unsigned int i = 0; i < Utilities::MPI::n_mpi_processes(communicator); i++) { - // This is slow, but most likely only used to debug. const int mpi_ierr = MPI_Barrier(communicator); AssertThrowMPI(mpi_ierr); + if (i == Utilities::MPI::this_mpi_process(communicator)) { if (across) -- 2.39.5