From 61c2cbea94cddea0e760b8b66c94ab49734163dd Mon Sep 17 00:00:00 2001 From: Zimin Li Date: Mon, 6 Jul 2026 03:23:19 +0000 Subject: [PATCH] style: rename `Timer.elapsed_ms()` method to `Timer.ElapsedMs()` --- examples/mpi/all_gather.cc | 2 +- examples/mpi/all_reduce.cc | 2 +- examples/mpi/all_to_all.cc | 2 +- examples/mpi/broadcast.cc | 2 +- examples/mpi/gather.cc | 2 +- examples/mpi/reduce.cc | 2 +- examples/mpi/reduce_scatter.cc | 2 +- examples/mpi/scatter.cc | 2 +- examples/mpi/send_recv.cc | 2 +- examples/utils.h | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/mpi/all_gather.cc b/examples/mpi/all_gather.cc index 3254268..c0f1a62 100644 --- a/examples/mpi/all_gather.cc +++ b/examples/mpi/all_gather.cc @@ -109,7 +109,7 @@ void RunAllGatherExample(int argc, char **argv, int warmup_iter, CHECK_RT(Rt, Rt::Memcpy(h_recv.data(), d_recv, recv_bytes, Rt::MemcpyDeviceToHost)); - double elapsed = timer.elapsed_ms() / static_cast(profile_iter); + double elapsed = timer.ElapsedMs() / static_cast(profile_iter); // Result Validation bool correct = true; diff --git a/examples/mpi/all_reduce.cc b/examples/mpi/all_reduce.cc index 67f2eba..9f56f67 100644 --- a/examples/mpi/all_reduce.cc +++ b/examples/mpi/all_reduce.cc @@ -108,7 +108,7 @@ void RunAllReduceExample(int argc, char **argv, int warmup_iter, } CHECK_RT(Rt, Rt::StreamSynchronize(nullptr)); - double elapsed = timer.elapsed_ms() / static_cast(profile_iter); + double elapsed = timer.ElapsedMs() / static_cast(profile_iter); // Result Validation float expected = 0.0f; diff --git a/examples/mpi/all_to_all.cc b/examples/mpi/all_to_all.cc index 5952e7c..a1347ca 100644 --- a/examples/mpi/all_to_all.cc +++ b/examples/mpi/all_to_all.cc @@ -120,7 +120,7 @@ void RunAllToAllExample(int argc, char **argv, int warmup_iter, CHECK_RT(Rt, Rt::StreamSynchronize(nullptr)); CHECK_RT(Rt, Rt::Memcpy(h_recv.data(), d_recv, total_bytes, Rt::MemcpyDeviceToHost)); - double elapsed = timer.elapsed_ms() / static_cast(profile_iter); + double elapsed = timer.ElapsedMs() / static_cast(profile_iter); // Result Validation // recv `block[src]` on rank r should come from `src`'s send `block[dst=r]`. diff --git a/examples/mpi/broadcast.cc b/examples/mpi/broadcast.cc index 81efef9..8a0d66e 100644 --- a/examples/mpi/broadcast.cc +++ b/examples/mpi/broadcast.cc @@ -113,7 +113,7 @@ void RunBroadcastExample(int argc, char **argv, int warmup_iter, CHECK_INFINI(collective_call()); } CHECK_RT(Rt, Rt::StreamSynchronize(nullptr)); - double elapsed = timer.elapsed_ms() / static_cast(profile_iter); + double elapsed = timer.ElapsedMs() / static_cast(profile_iter); // Validation Validator::ValidateResult(h_recv.data(), kNumElements, kRootMagicValue, diff --git a/examples/mpi/gather.cc b/examples/mpi/gather.cc index c0749e0..b488df9 100644 --- a/examples/mpi/gather.cc +++ b/examples/mpi/gather.cc @@ -109,7 +109,7 @@ void RunGatherExample(int argc, char **argv, int warmup_iter, int profile_iter, } CHECK_RT(Rt, Rt::StreamSynchronize(nullptr)); - double elapsed = timer.elapsed_ms() / static_cast(profile_iter); + double elapsed = timer.ElapsedMs() / static_cast(profile_iter); // Result Validation (only meaningful on `root`). if (rank == kRoot) { diff --git a/examples/mpi/reduce.cc b/examples/mpi/reduce.cc index 428a135..a998b7f 100644 --- a/examples/mpi/reduce.cc +++ b/examples/mpi/reduce.cc @@ -113,7 +113,7 @@ void RunReduceExample(int argc, char **argv, int warmup_iter, int profile_iter, } CHECK_RT(Rt, Rt::StreamSynchronize(nullptr)); - double elapsed = timer.elapsed_ms() / static_cast(profile_iter); + double elapsed = timer.ElapsedMs() / static_cast(profile_iter); // Result Validation (only meaningful on `root`). if (rank == kRoot) { diff --git a/examples/mpi/reduce_scatter.cc b/examples/mpi/reduce_scatter.cc index 3f7fe03..f1dbb4f 100644 --- a/examples/mpi/reduce_scatter.cc +++ b/examples/mpi/reduce_scatter.cc @@ -119,7 +119,7 @@ void RunReduceScatterExample(int argc, char **argv, int warmup_iter, CHECK_RT(Rt, Rt::Memcpy(h_recv.data(), d_recv, recv_bytes, Rt::MemcpyDeviceToHost)); - double elapsed = timer.elapsed_ms() / static_cast(profile_iter); + double elapsed = timer.ElapsedMs() / static_cast(profile_iter); // Result Validation: float expected = 0.0f; diff --git a/examples/mpi/scatter.cc b/examples/mpi/scatter.cc index a0bd874..2c16577 100644 --- a/examples/mpi/scatter.cc +++ b/examples/mpi/scatter.cc @@ -114,7 +114,7 @@ void RunScatterExample(int argc, char **argv, int warmup_iter, int profile_iter, } CHECK_RT(Rt, Rt::StreamSynchronize(nullptr)); - double elapsed = timer.elapsed_ms() / static_cast(profile_iter); + double elapsed = timer.ElapsedMs() / static_cast(profile_iter); // Result Validation: every rank should receive its own `(rank + 1)` block. CHECK_RT(Rt, Rt::Memcpy(h_recv.data(), d_recv, recv_bytes, diff --git a/examples/mpi/send_recv.cc b/examples/mpi/send_recv.cc index 21405e2..3dd6617 100644 --- a/examples/mpi/send_recv.cc +++ b/examples/mpi/send_recv.cc @@ -127,7 +127,7 @@ void RunSendRecvExample(int argc, char **argv, int warmup_iter, Rt::MemcpyDeviceToHost)); } - double elapsed = timer.elapsed_ms() / static_cast(profile_iter); + double elapsed = timer.ElapsedMs() / static_cast(profile_iter); if (rank == kReceiver) { bool correct = Validator::ValidateResult( diff --git a/examples/utils.h b/examples/utils.h index 2fab3cf..0c1e7df 100644 --- a/examples/utils.h +++ b/examples/utils.h @@ -28,7 +28,7 @@ class Timer { public: Timer() : start(std::chrono::high_resolution_clock::now()) {} - double elapsed_ms() const { + double ElapsedMs() const { auto end = std::chrono::high_resolution_clock::now(); return std::chrono::duration(end - start).count(); }