Add plotting code
This commit is contained in:
parent
533d805d98
commit
cc2614d7d2
@ -11,7 +11,15 @@ int main(int argc, char *argv[]) // ping pong
|
||||
{
|
||||
int size, rank, partner, i, count, r, repetitions;
|
||||
double time, bandwidth;
|
||||
|
||||
|
||||
FILE *fp;
|
||||
fp = fopen("data.dat", "w");
|
||||
if (!fp) {
|
||||
printf("file could not be opened\n");
|
||||
getchar();
|
||||
return -1;
|
||||
}
|
||||
|
||||
MPI_Init(&argc, &argv);
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &size);
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
|
||||
@ -47,8 +55,10 @@ int main(int argc, char *argv[]) // ping pong
|
||||
time = 1e6 * time; // micro-seconds
|
||||
bandwidth = count * sizeof(double) / time; // MByte/s
|
||||
|
||||
if (rank == 0)
|
||||
if (rank == 0) {
|
||||
fprintf(fp, "%12zd %12d %12.2f %12.2f\n", count * sizeof(double), repetitions, time, bandwidth);
|
||||
printf("%12zd %12d %12.2f %12.2f\n", count * sizeof(double), repetitions, time, bandwidth);
|
||||
}
|
||||
count = count * 2;
|
||||
repetitions = repetitions / 2;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user