From 850b37e8c841506303061d8acb58e80ca16b7968 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 30 Mar 2020 17:56:12 +0300 Subject: [PATCH] Added a switch for generating strong and weak scaling results --- samples/benchmark/main.cc | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/samples/benchmark/main.cc b/samples/benchmark/main.cc index d343bc9..847e872 100644 --- a/samples/benchmark/main.cc +++ b/samples/benchmark/main.cc @@ -30,8 +30,15 @@ #include #include +#include #include +typedef enum { + TEST_STRONG_SCALING, + TEST_WEAK_SCALING, + NUM_TESTS, +} TestType; + int main(void) { @@ -44,6 +51,10 @@ main(void) AcMeshInfo info; acLoadConfig(AC_DEFAULT_CONFIG, &info); + const TestType test = TEST_STRONG_SCALING; + if (test == TEST_WEAK_SCALING) + info.int_params[AC_nz] *= nprocs; + /* AcMesh model, candidate; if (pid == 0) { @@ -109,8 +120,15 @@ main(void) "percentile)--------------------------------------\n", results[nth_percentile * num_iters], 100 * nth_percentile); - const char* path = "strong_scaling.csv"; - FILE* fp = fopen(path, "a"); + char path[4096] = ""; + if (test == TEST_STRONG_SCALING) + strncpy(path, "strong_scaling.csv", sizeof(path)); + else if (test == TEST_WEAK_SCALING) + strncpy(path, "weak_scaling.csv", sizeof(path)); + else + ERROR("Invalid test type"); + + FILE* fp = fopen(path, "a"); ERRCHK_ALWAYS(fp); // Format // nprocs, measured (ms)