Skip to content

Commit

Permalink
Fix a bug in phase durations
Browse files Browse the repository at this point in the history
  • Loading branch information
range3 committed Mar 23, 2023
1 parent 05515b4 commit 817d0da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
15 changes: 11 additions & 4 deletions src/rdbench/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 817d0da

Please sign in to comment.