2 Dec
2010
2 Dec
'10
10:37 p.m.
Hi Phillip,
On Thu, Dec 2, 2010 at 7:08 PM, Kraus Philipp
how can I use the mpi::all_reduce with std::accumulate? I would reduce the values of each process with a sum function
You can use mpi::all_reduce like this:: int local_value = ...; // local computation int global_value = 0; mpi::all_reduce(comm_, local_value, global_value, std::plus<int>()); // now `global_value` holds the sum of `local_value` of all MPI ranks where `comm_` is an instance of mpi::communicator; other binary operations are available besides std::plus (or you can define your own). Best regards, Riccardo