Skip to content

Commit

Permalink
HG perf: print reg and dereg times when -R option is used
Browse files Browse the repository at this point in the history
Reduce column size

Fix bulk permission flag in hg_bw_read
  • Loading branch information
soumagne committed Oct 15, 2024
1 parent 3fb1442 commit dab61ce
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 24 deletions.
21 changes: 17 additions & 4 deletions Testing/perf/hg/hg_bw_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ hg_perf_run(const struct hg_test_info *hg_test_info,
size_t comm_rank = (size_t) hg_test_info->na_test_info.mpi_info.rank,
comm_size = (size_t) hg_test_info->na_test_info.mpi_info.size,
loop = (size_t) hg_test_info->na_test_info.loop;
hg_time_t t1, t2;
hg_time_t t1, t2, t3, t4, t_reg = hg_time_from_ms(0),
t_dereg = hg_time_from_ms(0);
hg_return_t ret;
size_t i;

Expand All @@ -55,14 +56,20 @@ hg_perf_run(const struct hg_test_info *hg_test_info,
}

if (hg_test_info->na_test_info.force_register) {
if (i >= skip)
hg_time_get_current(&t3);
for (j = 0; j < info->handle_max; j++) {
hg_size_t bulk_size = info->buf_size_max * info->bulk_count;
ret = HG_Bulk_create(info->hg_class, 1, &info->bulk_bufs[j],
&bulk_size, HG_BULK_READ_ONLY,
&bulk_size, HG_BULK_WRITE_ONLY,
&info->local_bulk_handles[j]);
HG_TEST_CHECK_HG_ERROR(error, ret,
"HG_Bulk_create() failed (%s)", HG_Error_to_string(ret));
}
if (i >= skip) {
hg_time_get_current(&t4);
t_reg = hg_time_add(t_reg, hg_time_subtract(t4, t3));
}
}

for (j = 0; j < info->handle_max; j++) {
Expand Down Expand Up @@ -99,10 +106,16 @@ hg_perf_run(const struct hg_test_info *hg_test_info,
}

if (hg_test_info->na_test_info.force_register) {
if (i >= skip)
hg_time_get_current(&t3);
for (j = 0; j < info->handle_max; j++) {
(void) HG_Bulk_free(info->local_bulk_handles[j]);
info->local_bulk_handles[j] = HG_BULK_NULL;
}
if (i >= skip) {
hg_time_get_current(&t4);
t_dereg = hg_time_add(t_dereg, hg_time_subtract(t4, t3));
}
}
}

Expand All @@ -112,8 +125,8 @@ hg_perf_run(const struct hg_test_info *hg_test_info,
hg_time_get_current(&t2);

if (comm_rank == 0)
hg_perf_print_bw(
hg_test_info, info, buf_size, hg_time_subtract(t2, t1));
hg_perf_print_bw(hg_test_info, info, buf_size, hg_time_subtract(t2, t1),
t_reg, t_dereg);

return HG_SUCCESS;

Expand Down
19 changes: 16 additions & 3 deletions Testing/perf/hg/hg_bw_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ hg_perf_run(const struct hg_test_info *hg_test_info,
size_t comm_rank = (size_t) hg_test_info->na_test_info.mpi_info.rank,
comm_size = (size_t) hg_test_info->na_test_info.mpi_info.size,
loop = (size_t) hg_test_info->na_test_info.loop;
hg_time_t t1, t2;
hg_time_t t1, t2, t3, t4, t_reg = hg_time_from_ms(0),
t_dereg = hg_time_from_ms(0);
hg_return_t ret;
size_t i;

Expand All @@ -55,6 +56,8 @@ hg_perf_run(const struct hg_test_info *hg_test_info,
}

if (hg_test_info->na_test_info.force_register) {
if (i >= skip)
hg_time_get_current(&t3);
for (j = 0; j < info->handle_max; j++) {
hg_size_t bulk_size = info->buf_size_max * info->bulk_count;
ret = HG_Bulk_create(info->hg_class, 1, &info->bulk_bufs[j],
Expand All @@ -63,6 +66,10 @@ hg_perf_run(const struct hg_test_info *hg_test_info,
HG_TEST_CHECK_HG_ERROR(error, ret,
"HG_Bulk_create() failed (%s)", HG_Error_to_string(ret));
}
if (i >= skip) {
hg_time_get_current(&t4);
t_reg = hg_time_add(t_reg, hg_time_subtract(t4, t3));
}
}

for (j = 0; j < info->handle_max; j++) {
Expand All @@ -85,10 +92,16 @@ hg_perf_run(const struct hg_test_info *hg_test_info,
HG_Error_to_string(ret));

if (hg_test_info->na_test_info.force_register) {
if (i >= skip)
hg_time_get_current(&t3);
for (j = 0; j < info->handle_max; j++) {
(void) HG_Bulk_free(info->local_bulk_handles[j]);
info->local_bulk_handles[j] = HG_BULK_NULL;
}
if (i >= skip) {
hg_time_get_current(&t4);
t_dereg = hg_time_add(t_dereg, hg_time_subtract(t4, t3));
}
}
}

Expand All @@ -98,8 +111,8 @@ hg_perf_run(const struct hg_test_info *hg_test_info,
hg_time_get_current(&t2);

if (comm_rank == 0)
hg_perf_print_bw(
hg_test_info, info, buf_size, hg_time_subtract(t2, t1));
hg_perf_print_bw(hg_test_info, info, buf_size, hg_time_subtract(t2, t1),
t_reg, t_dereg);

return HG_SUCCESS;

Expand Down
51 changes: 35 additions & 16 deletions Testing/perf/hg/mercury_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"." XSTRING(HG_VERSION_MINOR) "." XSTRING(HG_VERSION_PATCH)

#define NDIGITS 2
#define NWIDTH 27
#define NWIDTH 20

/************************************/
/* Local Type and Struct Definition */
Expand Down Expand Up @@ -841,31 +841,36 @@ hg_perf_print_header_bw(const struct hg_test_info *hg_test_info,
info->handle_max, (size_t) info->bulk_count);
if (info->verify)
printf("# WARNING verifying data, output will be slower\n");
if (hg_test_info->na_test_info.force_register)
if (hg_test_info->na_test_info.force_register) {
printf("# WARNING forcing registration on every iteration\n");
if (hg_test_info->na_test_info.mbps)
printf("%-*s%*s%*s\n", 10, "# Size", NWIDTH, "Bandwidth (MB/s)", NWIDTH,
"Time (us)");
else
printf("%-*s%*s%*s\n", 10, "# Size", NWIDTH, "Bandwidth (MiB/s)",
NWIDTH, "Time (us)");
if (hg_test_info->na_test_info.mbps)
printf("%-*s%*s%*s%*s\n", 10, "# Size", NWIDTH, "Bandwidth (MB/s)",
NWIDTH, "Reg Time (us)", NWIDTH, "Dereg Time (us)");
else
printf("%-*s%*s%*s%*s\n", 10, "# Size", NWIDTH, "Bandwidth (MiB/s)",
NWIDTH, "Reg Time (us)", NWIDTH, "Dereg Time (us)");
} else {
if (hg_test_info->na_test_info.mbps)
printf("%-*s%*s%*s\n", 10, "# Size", NWIDTH, "Bandwidth (MB/s)",
NWIDTH, "Time (us)");
else
printf("%-*s%*s%*s\n", 10, "# Size", NWIDTH, "Bandwidth (MiB/s)",
NWIDTH, "Time (us)");
}
fflush(stdout);
}

/*---------------------------------------------------------------------------*/
void
hg_perf_print_bw(const struct hg_test_info *hg_test_info,
const struct hg_perf_class_info *info, size_t buf_size, hg_time_t t)
const struct hg_perf_class_info *info, size_t buf_size, hg_time_t t,
hg_time_t t_reg, hg_time_t t_dereg)
{
size_t loop = (size_t) hg_test_info->na_test_info.loop,
mpi_comm_size = (size_t) hg_test_info->na_test_info.mpi_info.size,
handle_max = (size_t) info->handle_max,
buf_count = (size_t) info->bulk_count;
double avg_time, avg_bw;

avg_time = hg_time_to_double(t) * 1e6 /
(double) (loop * handle_max * mpi_comm_size * buf_count);
avg_bw =
double avg_bw =
(double) (buf_size * loop * handle_max * mpi_comm_size * buf_count) /
hg_time_to_double(t);

Expand All @@ -874,8 +879,22 @@ hg_perf_print_bw(const struct hg_test_info *hg_test_info,
else
avg_bw /= (1024 * 1024); /* MiB/s */

printf("%-*zu%*.*f%*.*f\n", 10, buf_size, NWIDTH, NDIGITS, avg_bw, NWIDTH,
NDIGITS, avg_time);
if (hg_test_info->na_test_info.force_register) {
double reg_time =
hg_time_to_double(t_reg) * 1e6 / (double) (loop * handle_max);
double dereg_time =
hg_time_to_double(t_dereg) * 1e6 / (double) (loop * handle_max);

printf("%-*zu%*.*f%*.*f%*.*f\n", 10, buf_size, NWIDTH, NDIGITS, avg_bw,
NWIDTH, NDIGITS, reg_time, NWIDTH, NDIGITS, dereg_time);
} else {
double avg_time =
hg_time_to_double(t) * 1e6 /
(double) (loop * handle_max * mpi_comm_size * buf_count);

printf("%-*zu%*.*f%*.*f\n", 10, buf_size, NWIDTH, NDIGITS, avg_bw,
NWIDTH, NDIGITS, avg_time);
}
}

/*---------------------------------------------------------------------------*/
Expand Down
3 changes: 2 additions & 1 deletion Testing/perf/hg/mercury_perf.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ hg_perf_print_header_bw(const struct hg_test_info *hg_test_info,

void
hg_perf_print_bw(const struct hg_test_info *hg_test_info,
const struct hg_perf_class_info *info, size_t buf_size, hg_time_t t);
const struct hg_perf_class_info *info, size_t buf_size, hg_time_t t,
hg_time_t t_reg, hg_time_t t_dereg);

hg_return_t
hg_perf_send_done(struct hg_perf_class_info *info);
Expand Down

0 comments on commit dab61ce

Please sign in to comment.