Commit 82c6984c authored by tammam.alsoleman's avatar tammam.alsoleman

ADD calculating run time (Tcomm + Tcomp)

parent 28e3521b
......@@ -7,6 +7,10 @@ public class MPI_AVG {
public static void main(String[] args) throws Exception {
MPI.Init(args);
// Ensure all processes are ready before starting the clock
MPI.COMM_WORLD.Barrier();
long startTime = System.nanoTime();
int rank = MPI.COMM_WORLD.Rank();
int size = MPI.COMM_WORLD.Size();
......@@ -76,6 +80,14 @@ public class MPI_AVG {
System.out.println("========================================\n");
}
MPI.COMM_WORLD.Barrier();
long endTime = System.nanoTime();
if (rank == 0) {
double duration = (endTime - startTime) / 1_000_000.0;
System.out.println("Execution Time for " + size + " processes: " + duration + " ms");
}
MPI.Finalize();
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment