0

As MPI_Reduce and MPI_Barrier are costly commands, so I have to reduce some communication among threads. I know the main work of MPI_Reduce and MPI_Barrier. Sometime I observed that MPI_Reduce is reducing all values in one threads as well as it is also doing the work of MPI_Barrier. Is it possible that if I have to use mpi_Reduce then I can skip MPI_Barrier?

1 Answers1

3

No, MPI_Reduce() does not implicitly perform MPI_Barrier().

That being said, MPI_Allreduce() (with non-zero size data) performs an implicit MPI_Barrier(), so that might be a fit for your algorithm.

I am not quite sure of what you mean by MPI_Barrier() is a costly operation. Assuming you have a decent interconnect, the barrier itself should be pretty fast, and most of the time spent should be caused by process imbalance.

Gilles Gouaillardet
  • 8,193
  • 11
  • 24
  • 30