Improvements to samples
This commit is contained in:
@@ -89,33 +89,45 @@ main(void)
|
||||
}
|
||||
}*/
|
||||
|
||||
/*
|
||||
// Basic
|
||||
const size_t num_iters = 100;
|
||||
|
||||
// Warmup
|
||||
for (size_t i = 0; i < 10; ++i)
|
||||
for (size_t i = 0; i < num_iters / 10; ++i)
|
||||
acGridIntegrate(STREAM_DEFAULT, FLT_EPSILON);
|
||||
|
||||
// Benchmark
|
||||
Timer t;
|
||||
const AcReal dt = FLT_EPSILON;
|
||||
const AcReal dt = FLT_EPSILON;
|
||||
|
||||
acGridSynchronizeStream(STREAM_ALL);
|
||||
timer_reset(&t);
|
||||
acGridSynchronizeStream(STREAM_ALL);
|
||||
acGridSynchronizeStream(STREAM_ALL);
|
||||
timer_reset(&t);
|
||||
acGridSynchronizeStream(STREAM_ALL);
|
||||
|
||||
const size_t num_iters = 50;
|
||||
for (size_t i = 0; i < num_iters; ++i)
|
||||
acGridIntegrate(STREAM_DEFAULT, dt);
|
||||
for (size_t i = 0; i < num_iters; ++i)
|
||||
acGridIntegrate(STREAM_DEFAULT, dt);
|
||||
|
||||
acGridSynchronizeStream(STREAM_ALL);
|
||||
if (!pid)
|
||||
timer_diff_print(t);
|
||||
acGridSynchronizeStream(STREAM_ALL);
|
||||
/*
|
||||
acGridSynchronizeStream(STREAM_ALL);
|
||||
if (!pid)
|
||||
timer_diff_print(t);
|
||||
acGridSynchronizeStream(STREAM_ALL);
|
||||
*/
|
||||
|
||||
// Percentiles
|
||||
const size_t num_iters = 100;
|
||||
const double nth_percentile = 0.90;
|
||||
|
||||
std::vector<double> results; // ms
|
||||
results.reserve(num_iters);
|
||||
|
||||
// Warmup
|
||||
for (size_t i = 0; i < num_iters / 10; ++i)
|
||||
acGridIntegrate(STREAM_DEFAULT, FLT_EPSILON);
|
||||
|
||||
// Benchmark
|
||||
Timer t;
|
||||
const AcReal dt = FLT_EPSILON;
|
||||
|
||||
for (size_t i = 0; i < num_iters; ++i) {
|
||||
acGridSynchronizeStream(STREAM_ALL);
|
||||
timer_reset(&t);
|
||||
@@ -123,9 +135,9 @@ main(void)
|
||||
acGridIntegrate(STREAM_DEFAULT, dt);
|
||||
acGridSynchronizeStream(STREAM_ALL);
|
||||
results.push_back(timer_diff_nsec(t) / 1e6);
|
||||
acGridSynchronizeStream(STREAM_ALL);
|
||||
}
|
||||
|
||||
// Write benchmark to file
|
||||
if (!pid) {
|
||||
std::sort(results.begin(), results.end(),
|
||||
[](const double& a, const double& b) { return a < b; });
|
||||
@@ -149,7 +161,49 @@ main(void)
|
||||
fprintf(fp, "%d, %g\n", nprocs, results[nth_percentile * num_iters]);
|
||||
|
||||
fclose(fp);
|
||||
}*/
|
||||
}
|
||||
|
||||
/*
|
||||
const size_t num_iters = 100;
|
||||
const double nth_percentile = 0.90;
|
||||
|
||||
std::vector<double> results; // ms
|
||||
results.reserve(num_iters);
|
||||
|
||||
for (size_t i = 0; i < num_iters; ++i) {
|
||||
acGridSynchronizeStream(STREAM_ALL);
|
||||
timer_reset(&t);
|
||||
acGridSynchronizeStream(STREAM_ALL);
|
||||
acGridIntegrate(STREAM_DEFAULT, dt);
|
||||
acGridSynchronizeStream(STREAM_ALL);
|
||||
results.push_back(timer_diff_nsec(t) / 1e6);
|
||||
}
|
||||
|
||||
// Write benchmark to file
|
||||
if (!pid) {
|
||||
std::sort(results.begin(), results.end(),
|
||||
[](const double& a, const double& b) { return a < b; });
|
||||
fprintf(stdout,
|
||||
"Integration step time %g ms (%gth "
|
||||
"percentile)--------------------------------------\n",
|
||||
results[nth_percentile * num_iters], 100 * nth_percentile);
|
||||
|
||||
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)
|
||||
fprintf(fp, "%d, %g\n", nprocs, results[nth_percentile * num_iters]);
|
||||
|
||||
fclose(fp);
|
||||
}*/
|
||||
|
||||
acGridQuit();
|
||||
MPI_Finalize();
|
||||
|
Reference in New Issue
Block a user