Skip to content

Commit

Permalink
switched to reduce for time print
Browse files Browse the repository at this point in the history
  • Loading branch information
tureture committed May 10, 2023
1 parent 46d1f0d commit 7c85531
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions A3/quicksort.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,18 +389,11 @@ int main(int argc, char *argv[])
}

/* FIND LONGEST TIME */
double timings[size];
MPI_Gather(&local_execution_time, 1, MPI_DOUBLE, timings, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD);
double max;
MPI_Reduce(&local_execution_time, &max, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);

if (rank == 0)
{
double max = 0;
for (int i=0; i<size;i++)
{
double time = timings[i];
if (time>max)
max = time;
}
printf("%f\n", max);
}

Expand Down

0 comments on commit 7c85531

Please sign in to comment.