Commit ac9bf1cd authored by Philippe SWARTVAGHER's avatar Philippe SWARTVAGHER
Browse files

Factorize format of computing duration

parent 7527d24c
......@@ -21,6 +21,8 @@
#define PRINTF_RANK0(msg, ...) do { if (rank == 0) { printf(msg, ## __VA_ARGS__); fflush(stdout); } } while (0)
#define COMP_TIME_FORMAT "%6.1f"
enum bench_type {
WARMUP = 0,
......
......@@ -40,15 +40,15 @@ void cursor_print_results()
printf("# cursor results: Time ms (min, avg, max)\n");
if (cursor_bench_done[WARMUP])
{
printf("# warmup %.5f\t%.5f\t%.5f\n", cursor_perfs_warmup[0] / 1000.0f, cursor_perfs_warmup[1] / 1000.0f, cursor_perfs_warmup[2] / 1000.0f);
printf("# warmup "COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\n", cursor_perfs_warmup[0] / 1000.0f, cursor_perfs_warmup[1] / 1000.0f, cursor_perfs_warmup[2] / 1000.0f);
}
if (cursor_bench_done[WITH_COMM])
{
printf("# with communications %.5f\t%.5f\t%.5f\n", cursor_perfs_comm[0] / 1000.0f, cursor_perfs_comm[1] / 1000.0f, cursor_perfs_comm[2] / 1000.0f);
printf("# with communications "COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\n", cursor_perfs_comm[0] / 1000.0f, cursor_perfs_comm[1] / 1000.0f, cursor_perfs_comm[2] / 1000.0f);
}
if (cursor_bench_done[WITHOUT_COMM])
{
printf("# without communications %.5f\t%.5f\t%.5f\n", cursor_perfs_no_comm[0] / 1000.0f, cursor_perfs_no_comm[1] / 1000.0f, cursor_perfs_no_comm[2] / 1000.0f);
printf("# without communications "COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\n", cursor_perfs_no_comm[0] / 1000.0f, cursor_perfs_no_comm[1] / 1000.0f, cursor_perfs_no_comm[2] / 1000.0f);
}
}
......
......@@ -32,7 +32,7 @@ static void print_stream_result_lines(char bench_to_run[4], double results[4][3]
{
if (bench_to_run[i])
{
printf("# %s\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f\n", stream_labels[i], results[i][0], results[i][1], results[i][2], times[i][0]*1000, times[i][1]*1000, times[i][2]*1000);
printf("# %s\t%.3f\t%.3f\t%.3f\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\n", stream_labels[i], results[i][0], results[i][1], results[i][2], times[i][0]*1000, times[i][1]*1000, times[i][2]*1000);
}
}
}
......
......@@ -39,15 +39,15 @@ static void memset_print_results()
printf("# memset results: Time ms (min, avg, max)\n");
if (memset_bench_done[WARMUP])
{
printf("# warmup %.5f\t%.5f\t%.5f\n", memset_perfs_warmup[0] / 1000.0f, memset_perfs_warmup[1] / 1000.0f, memset_perfs_warmup[2] / 1000.0f);
printf("# warmup "COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\n", memset_perfs_warmup[0] / 1000.0f, memset_perfs_warmup[1] / 1000.0f, memset_perfs_warmup[2] / 1000.0f);
}
if (memset_bench_done[WITH_COMM])
{
printf("# with communications %.5f\t%.5f\t%.5f\n", memset_perfs_comm[0] / 1000.0f, memset_perfs_comm[1] / 1000.0f, memset_perfs_comm[2] / 1000.0f);
printf("# with communications "COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\n", memset_perfs_comm[0] / 1000.0f, memset_perfs_comm[1] / 1000.0f, memset_perfs_comm[2] / 1000.0f);
}
if (memset_bench_done[WITHOUT_COMM])
{
printf("# without communications %.5f\t%.5f\t%.5f\n", memset_perfs_no_comm[0] / 1000.0f, memset_perfs_no_comm[1] / 1000.0f, memset_perfs_no_comm[2] / 1000.0f);
printf("# without communications "COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\n", memset_perfs_no_comm[0] / 1000.0f, memset_perfs_no_comm[1] / 1000.0f, memset_perfs_no_comm[2] / 1000.0f);
}
}
......
......@@ -110,15 +110,15 @@ void prime_print_results()
printf("# PRIME results: Time ms (min, avg, max)\n");
if (bench_done[WARMUP])
{
printf("# warmup %.5f\t%.5f\t%.5f\n", prime_perfs_warmup[0] / 1000.0f, prime_perfs_warmup[1] / 1000.0f, prime_perfs_warmup[2] / 1000.0f);
printf("# warmup "COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\n", prime_perfs_warmup[0] / 1000.0f, prime_perfs_warmup[1] / 1000.0f, prime_perfs_warmup[2] / 1000.0f);
}
if (bench_done[WITH_COMM])
{
printf("# with communications %.5f\t%.5f\t%.5f\n", prime_perfs_comm[0] / 1000.0f, prime_perfs_comm[1] / 1000.0f, prime_perfs_comm[2] / 1000.0f);
printf("# with communications "COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\n", prime_perfs_comm[0] / 1000.0f, prime_perfs_comm[1] / 1000.0f, prime_perfs_comm[2] / 1000.0f);
}
if (bench_done[WITHOUT_COMM])
{
printf("# without communications %.5f\t%.5f\t%.5f\n", prime_perfs_no_comm[0] / 1000.0f, prime_perfs_no_comm[1] / 1000.0f, prime_perfs_no_comm[2] / 1000.0f);
printf("# without communications "COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\n", prime_perfs_no_comm[0] / 1000.0f, prime_perfs_no_comm[1] / 1000.0f, prime_perfs_no_comm[2] / 1000.0f);
}
}
......
......@@ -161,17 +161,17 @@ void scalar_print_results()
printf("# scalar results: Time ms (min, avg, max)\n");
if (bench_done[WARMUP])
{
printf("# warmup %10.5f\t%10.5f\t%10.5f\n",
printf("# warmup "COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\n",
scalar_perfs_warmup[0] / 1000.0f, scalar_perfs_warmup[1] / 1000.0f, scalar_perfs_warmup[2] / 1000.0f);
}
if (bench_done[WITH_COMM])
{
printf("# with communications %10.5f\t%10.5f\t%10.5f\n",
printf("# with communications "COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\n",
scalar_perfs_comm[0] / 1000.0f, scalar_perfs_comm[1] / 1000.0f, scalar_perfs_comm[2] / 1000.0f);
}
if (bench_done[WITHOUT_COMM])
{
printf("# without communications %10.5f\t%10.5f\t%10.5f\n",
printf("# without communications "COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\n",
scalar_perfs_no_comm[0] / 1000.0f, scalar_perfs_no_comm[1] / 1000.0f, scalar_perfs_no_comm[2] / 1000.0f);
}
}
......
......@@ -245,17 +245,17 @@ void scalar_avx_print_results()
printf("# scalar_avx results: Time ms (min, avg, max)\n");
if (bench_done[WARMUP])
{
printf("# warmup %10.5f\t%10.5f\t%10.5f\n",
printf("# warmup "COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\n",
scalar_avx_perfs_warmup[0] / 1000.0f, scalar_avx_perfs_warmup[1] / 1000.0f, scalar_avx_perfs_warmup[2] / 1000.0f);
}
if (bench_done[WITH_COMM])
{
printf("# with communications %10.5f\t%10.5f\t%10.5f\n",
printf("# with communications "COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\n",
scalar_avx_perfs_comm[0] / 1000.0f, scalar_avx_perfs_comm[1] / 1000.0f, scalar_avx_perfs_comm[2] / 1000.0f);
}
if (bench_done[WITHOUT_COMM])
{
printf("# without communications %10.5f\t%10.5f\t%10.5f\n",
printf("# without communications "COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\t"COMP_TIME_FORMAT"\n",
scalar_avx_perfs_no_comm[0] / 1000.0f, scalar_avx_perfs_no_comm[1] / 1000.0f, scalar_avx_perfs_no_comm[2] / 1000.0f);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment