Is it safe to use the same input and output buffer for MPI_Allreduce
in general? It seems that openmpi still works with that on Linux/Ubuntu.
int max_quantities = ...;
MPI_Allreduce(&max_quantities, &max_quantities, 1, MPI_DOUBLE, MPI_MAX, comm);
You should never "alias" buffers. Some MPI implementations explicitly give you an error about it. Instead use MPI_IN_PLACE
:
MPI_Allreduce(MPI_IN_PLACE, &max_quantities, 1, MPI_DOUBLE, MPI_MAX, comm);
```
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.