reducer implementation using MPI