Skip to content

Commit 45af02a

Browse files
authored
Include timing report feature (#51)
* Include timing report feature * Correct clang format
1 parent a417eb2 commit 45af02a

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

examples/haccio.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,17 @@ main(int argc, char **argv)
188188
free(buffers[i]);
189189
}
190190

191+
#if PDC_TIMING == 1
192+
PDC_timing_report("write");
193+
#endif
194+
191195
PDCcont_close(cont_id);
192196
PDCprop_close(cont_prop);
193197
PDCclose(pdc_id);
194198

195199
if (mpi_rank == 0) {
196200
double per_particle = sizeof(float) * 7 + sizeof(int64_t) + sizeof(int16_t);
197-
double bandwidth = per_particle * NUM_PARTICLES * mpi_size / 1024.0 / 1024.0 / time_total;
201+
double bandwidth = per_particle * NUM_PARTICLES / 1024.0 / 1024.0 / time_total * mpi_size;
198202
printf("Bandwidth: %.2fMB/s, total time: %.4f, lock: %.4f, io: %.4f, release: %.4f\n", bandwidth,
199203
time_total, time_lock, time_io, time_release);
200204
}

examples/haccio_v2.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,17 @@ main(int argc, char **argv)
173173
free(buffers[i]);
174174
}
175175

176+
#if PDC_TIMING == 1
177+
PDC_timing_report("write");
178+
#endif
179+
176180
PDCcont_close(cont_id);
177181
PDCprop_close(cont_prop);
178182
PDCclose(pdc_id);
179183

180184
if (mpi_rank == 0) {
181185
double per_particle = sizeof(float) * 7 + sizeof(int64_t) + sizeof(int16_t);
182-
double bandwidth = per_particle * NUM_PARTICLES * mpi_size / 1024.0 / 1024.0 / time_total;
186+
double bandwidth = per_particle * NUM_PARTICLES / 1024.0 / 1024.0 / time_total * mpi_size;
183187
printf("Bandwidth: %.2fMB/s, total time: %.4f, create transfer: %.4f, start transfer: %.4f, wait "
184188
"transfer: %.4f\n",
185189
bandwidth, time_total, time_create, time_start, time_wait);

examples/tileio.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,13 @@ main(int argc, char **argv)
137137

138138
// Actual I/O
139139
time_io = MPI_Wtime();
140+
/*
140141
int i;
141142
for (i = 0; i < g_x_ept * g_y_ept; i++) {
142143
local_buffer[i] = i;
143144
}
144145
MPI_Barrier(MPI_COMM_WORLD);
146+
*/
145147
time_io = MPI_Wtime() - time_io;
146148

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

169+
#if PDC_TIMING == 1
170+
PDC_timing_report("write");
171+
#endif
172+
167173
PDCcont_close(cont_id);
168174
PDCprop_close(cont_prop);
169175
PDCclose(pdc_id);

examples/tileio_v2.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,14 @@ main(int argc, char **argv)
100100
pdcid_t local_region_id, global_region_id;
101101
pdcid_t transfer_id;
102102

103-
double *local_buffer = (double *)malloc(g_x_ept * g_y_ept * sizeof(double));
104-
105-
uint64_t local_length[1] = {g_x_ept * g_y_ept};
103+
// double * local_buffer = (double *)malloc(g_x_ept * g_y_ept * sizeof(double));
104+
double **local_buffer = (double **)malloc(g_x_ept * sizeof(double *));
105+
int i;
106+
for (i = 0; i < g_x_ept; i++)
107+
local_buffer[i] = malloc(sizeof(double) * g_y_ept);
108+
109+
uint64_t local_length[1] = {g_x_ept * g_y_ept};
110+
// uint64_t local_length[NUM_DIMS] = {g_x_ept, g_y_ept};
106111
uint64_t local_offsets[1] = {0};
107112
uint64_t global_length[NUM_DIMS] = {g_x_ept, g_y_ept};
108113
uint64_t global_offsets[NUM_DIMS] = {g_coords[0] * g_x_ept, g_coords[1] * g_y_ept};
@@ -142,6 +147,10 @@ main(int argc, char **argv)
142147
time_total = MPI_Wtime() - time_total;
143148
PDCregion_transfer_close(transfer_id);
144149

150+
#if PDC_TIMING == 1
151+
PDC_timing_report("write");
152+
#endif
153+
145154
// TODO delete before close ?
146155
PDCobj_close(obj_id);
147156
PDCprop_close(obj_prop);
@@ -154,7 +163,7 @@ main(int argc, char **argv)
154163

155164
if (g_mpi_rank == 0) {
156165
double bandwidth =
157-
g_x_tiles * g_y_tiles * g_x_ept * g_y_ept / 1024.0 / 1024.0 * sizeof(double) / time_total;
166+
g_x_ept * g_y_ept / 1024.0 / 1024.0 * g_x_tiles * g_y_tiles * sizeof(double) / time_total;
158167
printf("Bandwidth: %.2fMB/s, total time: %.4f, transfer create: %.4f, transfer start: %.4f, "
159168
"transfert wait: %.4f\n",
160169
bandwidth, time_total, time_create, time_start, time_wait);

0 commit comments

Comments
 (0)