From 007839ab7922528863ec667ff235c00fd77013b3 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sat, 17 Aug 2019 21:10:20 -0600 Subject: [PATCH] Use MPI_Exscan instead of MPI_Scan. --- source/base/data_out_base.cc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index a127c0c249..8f00b4fbc5 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -7946,8 +7946,7 @@ DataOutBase::write_hdf5_parallel( hid_t pt_data_dataspace, pt_data_dataset, pt_data_file_dataspace, pt_data_memory_dataspace; herr_t status; - unsigned int local_node_cell_count[2], global_node_cell_count[2], - global_node_cell_offsets[2]; + unsigned int local_node_cell_count[2]; hsize_t count[2], offset[2], node_ds_dim[2], cell_ds_dim[2]; std::vector node_data_vec; std::vector cell_data_vec; @@ -7980,6 +7979,10 @@ DataOutBase::write_hdf5_parallel( // Compute the global total number of nodes/cells and determine the offset of // the data for this process + + unsigned int global_node_cell_count[2] = {0, 0}; + unsigned int global_node_cell_offsets[2] = {0, 0}; + # ifdef DEAL_II_WITH_MPI ierr = MPI_Allreduce(local_node_cell_count, global_node_cell_count, @@ -7988,15 +7991,13 @@ DataOutBase::write_hdf5_parallel( MPI_SUM, comm); AssertThrowMPI(ierr); - ierr = MPI_Scan(local_node_cell_count, - global_node_cell_offsets, - 2, - MPI_UNSIGNED, - MPI_SUM, - comm); + ierr = MPI_Exscan(local_node_cell_count, + global_node_cell_offsets, + 2, + MPI_UNSIGNED, + MPI_SUM, + comm); AssertThrowMPI(ierr); - global_node_cell_offsets[0] -= local_node_cell_count[0]; - global_node_cell_offsets[1] -= local_node_cell_count[1]; # else global_node_cell_count[0] = local_node_cell_count[0]; global_node_cell_count[1] = local_node_cell_count[1]; -- 2.39.5