简体   繁体   中英

Is MPI_Reduce also does the work of MPI_Barrier?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM