Benchmarking mit -b

This commit is contained in:
Johannes Winklehner 2016-06-18 17:16:40 +02:00
parent dadb581ed1
commit cb39db61ce

View file

@ -91,7 +91,51 @@ int main(int argc, char* argv[]) {
//fill(a, size, sizeof(int));
if (benchmark) {
int *red;
MPI_Alloc_mem(size * sizeof(int), MPI_INFO_NULL, &red);
double start, end, global_end;
MPI_Barrier(MPI_COMM_WORLD);
start = MPI_Wtime();
MPI_Reduce(a, red, size, MPI_INT, op, 0, MPI_COMM_WORLD);
end = MPI_Wtime();
MPI_Reduce(&end, &global_end, 1, MPI_DOUBLE, MPI_MAX, 0,
MPI_COMM_WORLD);
if (r == 0) {
printf("%f, ", global_end - start);
}
MPI_Barrier(MPI_COMM_WORLD);
start = MPI_Wtime();
Fib_Reduce(a, red, size, MPI_INT, op, 0, MPI_COMM_WORLD);
end = MPI_Wtime();
MPI_Reduce(&end, &global_end, 1, MPI_DOUBLE, MPI_MAX, 0,
MPI_COMM_WORLD);
if (r == 0) {
printf("%f, ", global_end - start);
}
MPI_Barrier(MPI_COMM_WORLD);
start = MPI_Wtime();
Bin_Reduce(a, red, size, MPI_INT, op, 0, MPI_COMM_WORLD);
end = MPI_Wtime();
MPI_Reduce(&end, &global_end, 1, MPI_DOUBLE, MPI_MAX, 0,
MPI_COMM_WORLD);
if (r == 0) {
printf("%f, ", global_end - start);
}
MPI_Barrier(MPI_COMM_WORLD);
start = MPI_Wtime();
Binom_Reduce(a, red, size, MPI_INT, op, 0, MPI_COMM_WORLD);
end = MPI_Wtime();
MPI_Reduce(&end, &global_end, 1, MPI_DOUBLE, MPI_MAX, 0,
MPI_COMM_WORLD);
if (r == 0) {
printf("%f\n", global_end - start);
}
MPI_Free_mem(red);
} else {
int *red;
int *rfib;