Skip to content

Commit

Permalink
Include timing report feature (#51)
Browse files Browse the repository at this point in the history
* Include timing report feature

* Correct clang format
  • Loading branch information
wangvsa authored Jan 20, 2022
1 parent a417eb2 commit 45af02a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
6 changes: 5 additions & 1 deletion examples/haccio.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,17 @@ main(int argc, char **argv)
free(buffers[i]);
}

#if PDC_TIMING == 1
PDC_timing_report("write");
#endif

PDCcont_close(cont_id);
PDCprop_close(cont_prop);
PDCclose(pdc_id);

if (mpi_rank == 0) {
double per_particle = sizeof(float) * 7 + sizeof(int64_t) + sizeof(int16_t);
double bandwidth = per_particle * NUM_PARTICLES * mpi_size / 1024.0 / 1024.0 / time_total;
double bandwidth = per_particle * NUM_PARTICLES / 1024.0 / 1024.0 / time_total * mpi_size;
printf("Bandwidth: %.2fMB/s, total time: %.4f, lock: %.4f, io: %.4f, release: %.4f\n", bandwidth,
time_total, time_lock, time_io, time_release);
}
Expand Down
6 changes: 5 additions & 1 deletion examples/haccio_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,17 @@ main(int argc, char **argv)
free(buffers[i]);
}

#if PDC_TIMING == 1
PDC_timing_report("write");
#endif

PDCcont_close(cont_id);
PDCprop_close(cont_prop);
PDCclose(pdc_id);

if (mpi_rank == 0) {
double per_particle = sizeof(float) * 7 + sizeof(int64_t) + sizeof(int16_t);
double bandwidth = per_particle * NUM_PARTICLES * mpi_size / 1024.0 / 1024.0 / time_total;
double bandwidth = per_particle * NUM_PARTICLES / 1024.0 / 1024.0 / time_total * mpi_size;
printf("Bandwidth: %.2fMB/s, total time: %.4f, create transfer: %.4f, start transfer: %.4f, wait "
"transfer: %.4f\n",
bandwidth, time_total, time_create, time_start, time_wait);
Expand Down
6 changes: 6 additions & 0 deletions examples/tileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,13 @@ main(int argc, char **argv)

// Actual I/O
time_io = MPI_Wtime();
/*
int i;
for (i = 0; i < g_x_ept * g_y_ept; i++) {
local_buffer[i] = i;
}
MPI_Barrier(MPI_COMM_WORLD);
*/
time_io = MPI_Wtime() - time_io;

// Release lock
Expand All @@ -164,6 +166,10 @@ main(int argc, char **argv)
PDCregion_close(global_region_id);
free(local_buffer);

#if PDC_TIMING == 1
PDC_timing_report("write");
#endif

PDCcont_close(cont_id);
PDCprop_close(cont_prop);
PDCclose(pdc_id);
Expand Down
17 changes: 13 additions & 4 deletions examples/tileio_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,14 @@ main(int argc, char **argv)
pdcid_t local_region_id, global_region_id;
pdcid_t transfer_id;

double *local_buffer = (double *)malloc(g_x_ept * g_y_ept * sizeof(double));

uint64_t local_length[1] = {g_x_ept * g_y_ept};
// double * local_buffer = (double *)malloc(g_x_ept * g_y_ept * sizeof(double));
double **local_buffer = (double **)malloc(g_x_ept * sizeof(double *));
int i;
for (i = 0; i < g_x_ept; i++)
local_buffer[i] = malloc(sizeof(double) * g_y_ept);

uint64_t local_length[1] = {g_x_ept * g_y_ept};
// uint64_t local_length[NUM_DIMS] = {g_x_ept, g_y_ept};
uint64_t local_offsets[1] = {0};
uint64_t global_length[NUM_DIMS] = {g_x_ept, g_y_ept};
uint64_t global_offsets[NUM_DIMS] = {g_coords[0] * g_x_ept, g_coords[1] * g_y_ept};
Expand Down Expand Up @@ -142,6 +147,10 @@ main(int argc, char **argv)
time_total = MPI_Wtime() - time_total;
PDCregion_transfer_close(transfer_id);

#if PDC_TIMING == 1
PDC_timing_report("write");
#endif

// TODO delete before close ?
PDCobj_close(obj_id);
PDCprop_close(obj_prop);
Expand All @@ -154,7 +163,7 @@ main(int argc, char **argv)

if (g_mpi_rank == 0) {
double bandwidth =
g_x_tiles * g_y_tiles * g_x_ept * g_y_ept / 1024.0 / 1024.0 * sizeof(double) / time_total;
g_x_ept * g_y_ept / 1024.0 / 1024.0 * g_x_tiles * g_y_tiles * sizeof(double) / time_total;
printf("Bandwidth: %.2fMB/s, total time: %.4f, transfer create: %.4f, transfer start: %.4f, "
"transfert wait: %.4f\n",
bandwidth, time_total, time_create, time_start, time_wait);
Expand Down

0 comments on commit 45af02a

Please sign in to comment.