Created
March 8, 2016 18:40
-
-
Save adhithyan15/3fcd34c6d9d07d0611ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <mpi.h> | |
#include "tournament.h" | |
#include <sys/time.h> | |
int main(int argc, char **argv) | |
{ | |
int process_number, total_number_of_processes; | |
struct timeval start, end; | |
int t1, t2; | |
int t3, t4; | |
gettimeofday(&start, NULL); | |
t3 = start.tv_usec; | |
MPI_Init(&argc, &argv); | |
MPI_Comm_size(MPI_COMM_WORLD, &total_number_of_processes); | |
MPI_Comm_rank(MPI_COMM_WORLD, &process_number); | |
initialize_tournament_barrier(total_number_of_processes); | |
printf("0-Hello World from processes %d of %d\n", process_number, total_number_of_processes); | |
fflush(stdout); | |
gettimeofday(&start, NULL); | |
t1 = start.tv_usec; | |
barrier(); | |
gettimeofday(&end, NULL); | |
t2 = end.tv_usec; | |
printf("0-Goodbye World from processes %d of %d\n", process_number, total_number_of_processes); | |
fflush(stdout); | |
MPI_Finalize(); | |
gettimeofday(&end, NULL); | |
t4 = end.tv_usec; | |
printf("Time spent on barrier: %d\n", t2-t1); | |
printf("Total time elapsed: %d\n", t4-t3); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment