diff --git a/exercise3/wave_1d_parallel.c b/exercise3/wave_1d_parallel.c index ef9847c..39dd771 100644 --- a/exercise3/wave_1d_parallel.c +++ b/exercise3/wave_1d_parallel.c @@ -160,7 +160,17 @@ int main(int argc, char **argv) { // TASK: T2 // Time your code // BEGIN: T2 + if (comm_rank == ROOT) + gettimeofday(&t_start, NULL); simulate(); + MPI_Barrier(MPI_COMM_WORLD); + + if (comm_rank == ROOT) { + gettimeofday(&t_end, NULL); + + printf("Total elapsed time: %lf seconds\n", + WALLTIME(t_end) - WALLTIME(t_start)); + } // END: T2 domain_finalize();