From 3adce996f068575ffca7eb0aa9d194087de5e659 Mon Sep 17 00:00:00 2001 From: josh Date: Mon, 1 Dec 2008 00:27:26 +0000 Subject: [PATCH] changed MPI_Gatherv to MPI_Gather git-svn-id: svn://anubis/gvsu@306 45c1a28c-8058-47b2-ae61-ca45b979098e --- cs677/pa4/maximum-parsimony.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cs677/pa4/maximum-parsimony.cc b/cs677/pa4/maximum-parsimony.cc index 70b4934..a26458f 100644 --- a/cs677/pa4/maximum-parsimony.cc +++ b/cs677/pa4/maximum-parsimony.cc @@ -108,9 +108,16 @@ int main(int argc, char * argv[]) /* after all processes have evaluated their trees, figure out * which process discovered the lowest cost tree */ int processes_lowest_costs[world_size]; - MPI_Gather(&lowest_cost, 1, MPI_INT, - &processes_lowest_costs[0], world_size, MPI_INT, - 0, MPI_COMM_WORLD); + int recvcnts[world_size]; + int displs[world_size]; + for (int i = 0; i < world_size; i++) + { + recvcnts[i] = 1; + displs[i] = i; + } + MPI_Gatherv(&lowest_cost, 1, MPI_INT, + &processes_lowest_costs[0], &recvcnts[0], &displs[0], + MPI_INT, 0, MPI_COMM_WORLD); int min_process = 0; if (my_rank == 0) {