From b885101e161a564b6992b9c3480510da55d049c2 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Sat, 9 Jul 2022 17:58:37 -0400 Subject: [PATCH] address comment --- source/base/data_out_base.cc | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index e9b8d0f37c..6589ae87ce 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -7649,8 +7649,10 @@ namespace DataOutBase n_ranks, n_patches}; - // rank 0 also collects and writes the size of the data from each rank in - // bytes: + // Rank 0 also collects and writes the size of the data from each + // rank in bytes. The static_cast for the destination buffer looks + // useless, but without it clang-tidy will complain about a wrong + // MPI type. std::vector chunk_sizes(n_ranks); int ierr = MPI_Gather(&my_size, 1, @@ -7672,30 +7674,32 @@ namespace DataOutBase ierr = MPI_Info_free(&info); AssertThrowMPI(ierr); - ierr = MPI_File_set_size(fh, 0); // delete the file contents + // Delete the file contents: + ierr = MPI_File_set_size(fh, 0); AssertThrowMPI(ierr); - // this barrier is necessary, because otherwise others might already write + // This barrier is necessary, because otherwise others might already write // while one core is still setting the size to zero. ierr = MPI_Barrier(comm); AssertThrowMPI(ierr); - // write header + // Write the two parts of the header on rank 0: if (my_rank == 0) { ierr = Utilities::MPI::LargeCount::File_write_at_c( fh, 0, &header, sizeof(header), MPI_CHAR, MPI_STATUS_IGNORE); AssertThrowMPI(ierr); - ierr = Utilities::MPI::LargeCount::File_write_at_c(fh, - sizeof(header), - chunk_sizes.data(), - chunk_sizes.size(), - MPI_UINT64_T, - MPI_STATUS_IGNORE); + ierr = Utilities::MPI::LargeCount::File_write_at_c( + fh, + /* offset = */ sizeof(header), + chunk_sizes.data(), + chunk_sizes.size(), + MPI_UINT64_T, + MPI_STATUS_IGNORE); AssertThrowMPI(ierr); } - // wite main part + // Write the main part on each rank: { std::uint64_t prefix_sum = 0; ierr = MPI_Exscan(&my_size, &prefix_sum, 1, MPI_UINT64_T, MPI_SUM, comm); -- 2.39.5