From 817d0da31765a67db8409602190f95a224d57c6d Mon Sep 17 00:00:00 2001 From: range3 Date: Thu, 23 Mar 2023 01:40:00 +0000 Subject: [PATCH] Fix a bug in phase durations --- CMakeLists.txt | 2 +- src/rdbench/main.cpp | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5647d40..086a822 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.14...3.22) # Note: update this to your new project's name and version project( Rdbench - VERSION 0.10.0 + VERSION 0.10.1 LANGUAGES CXX C ) diff --git a/src/rdbench/main.cpp b/src/rdbench/main.cpp index 5bf3c50..564fd79 100644 --- a/src/rdbench/main.cpp +++ b/src/rdbench/main.cpp @@ -679,26 +679,33 @@ int main(int argc, char *argv[]) { phase_durations.emplace_back(RdbenchPhase::Write, stopwatch.get_and_reset()); } + Stopwatch::duration acc_comm{}; + Stopwatch::duration acc_calc{}; for (step = 1; step <= info.total_steps; step++) { if (step & 1) { sendrecv_halo(u, info); sendrecv_halo(v, info); - phase_durations.emplace_back(RdbenchPhase::Comm, stopwatch.get_and_reset()); + acc_comm += stopwatch.get_and_reset(); calc(u, v, u2, v2, info); + acc_calc += stopwatch.get_and_reset(); } else { sendrecv_halo(u2, info); sendrecv_halo(v2, info); - phase_durations.emplace_back(RdbenchPhase::Comm, stopwatch.get_and_reset()); + acc_comm += stopwatch.get_and_reset(); calc(u2, v2, u, v, info); + acc_calc += stopwatch.get_and_reset(); } if (info.interval != 0 && step % info.interval == 0) { - phase_durations.emplace_back(RdbenchPhase::Calc, stopwatch.get_and_reset()); + phase_durations.emplace_back(RdbenchPhase::Comm, acc_comm); + phase_durations.emplace_back(RdbenchPhase::Calc, acc_calc); + acc_comm = acc_calc = Stopwatch::duration::zero(); write_file(step & 1 ? u : u2, file_idx++, info); phase_durations.emplace_back(RdbenchPhase::Write, stopwatch.get_and_reset()); } } if (info.interval == 0 || info.total_steps % info.interval != 0) { - phase_durations.emplace_back(RdbenchPhase::Calc, stopwatch.get_and_reset()); + phase_durations.emplace_back(RdbenchPhase::Comm, acc_comm); + phase_durations.emplace_back(RdbenchPhase::Calc, acc_calc); } if (info.validate) {