Harden mpi reductions

 MPI_Allreduce is apparently unable to accept input and output arguments at the same location.

Fix this by determining when &input=&output and in that case pass MPI_IN_PLACE.