Added a switch for generating strong and weak scaling results

This commit is contained in:
jpekkila
2020-03-30 17:56:12 +03:00
parent d4eb3e0d35
commit 850b37e8c8

View File

@@ -30,8 +30,15 @@
#include <mpi.h> #include <mpi.h>
#include <algorithm> #include <algorithm>
#include <string.h>
#include <vector> #include <vector>
typedef enum {
TEST_STRONG_SCALING,
TEST_WEAK_SCALING,
NUM_TESTS,
} TestType;
int int
main(void) main(void)
{ {
@@ -44,6 +51,10 @@ main(void)
AcMeshInfo info; AcMeshInfo info;
acLoadConfig(AC_DEFAULT_CONFIG, &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; AcMesh model, candidate;
if (pid == 0) { if (pid == 0) {
@@ -109,8 +120,15 @@ main(void)
"percentile)--------------------------------------\n", "percentile)--------------------------------------\n",
results[nth_percentile * num_iters], 100 * nth_percentile); results[nth_percentile * num_iters], 100 * nth_percentile);
const char* path = "strong_scaling.csv"; char path[4096] = "";
FILE* fp = fopen(path, "a"); 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); ERRCHK_ALWAYS(fp);
// Format // Format
// nprocs, measured (ms) // nprocs, measured (ms)