changed MPI_Allreduce to an array operation