Skip to content

Commit 1d4d108

Browse files
authored
[Common] add local patch count to timestep report (#1383)
1 parent c49ab9b commit 1d4d108

4 files changed

Lines changed: 29 additions & 10 deletions

File tree

src/shammodels/common/include/shammodels/common/timestep_report.hpp

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,21 @@
2828
namespace shammodels {
2929

3030
inline std::string report_perf_timestep(
31-
f64 rate, u64 nobj, f64 tcompute, f64 mpi_timer, f64 alloc_time, size_t max_mem) {
31+
f64 rate,
32+
u64 nobj,
33+
u64 npatch,
34+
f64 tcompute,
35+
f64 mpi_timer,
36+
f64 alloc_time,
37+
size_t max_mem) {
3238

3339
std::string log_rank_rate = shambase::format(
34-
"\n| {:<4} | {:.4e} | {:11} | {:.3e} | {:3.0f} % | {:3.0f} % | {:>10s} |",
40+
"\n| {:<4} | {:.4e} | {:11} | {:6} | {:.3e} | {:3.0f} % | {:3.0f} % | "
41+
"{:>10s} |",
3542
shamcomm::world_rank(),
3643
rate,
3744
nobj,
45+
npatch,
3846
tcompute,
3947
100 * (mpi_timer / tcompute),
4048
100 * (alloc_time / tcompute),
@@ -44,16 +52,19 @@ namespace shammodels {
4452
shamcomm::gather_str(log_rank_rate, gathered);
4553

4654
u64 obj_total = shamalgs::collective::allreduce_sum(nobj);
55+
u64 npatch_total = shamalgs::collective::allreduce_sum(npatch);
4756
f64 max_t = shamalgs::collective::allreduce_max(tcompute);
4857
f64 sum_t = shamalgs::collective::allreduce_sum(tcompute);
4958
f64 sum_mpi = shamalgs::collective::allreduce_sum(mpi_timer);
5059
f64 sum_alloc = shamalgs::collective::allreduce_sum(alloc_time);
5160
size_t sum_mem_total = shamalgs::collective::allreduce_sum(max_mem);
5261

5362
std::string log_all_rate = shambase::format(
54-
"\n| all | {:.4e} | {:11} | {:.3e} | {:3.0f} % | {:3.0f} % | {:>10s} |",
63+
"\n| all | {:.4e} | {:11} | {:6} | {:.3e} | {:3.0f} % | {:3.0f} % | "
64+
"{:>10s} |",
5565
f64(obj_total) / max_t,
5666
obj_total,
67+
npatch_total,
5768
max_t,
5869
100 * (sum_mpi / sum_t),
5970
100 * (sum_alloc / sum_t),
@@ -64,19 +75,18 @@ namespace shammodels {
6475
// clang-format off
6576
if (shamcomm::world_rank() == 0) {
6677
print = "processing rate infos : \n";
67-
print += ("---------------------------------------------------------------------------------------\n");
68-
print += ("| rank | rate (N.s^-1) | Nobj | t compute (s) | MPI | alloc | mem (max) |\n");
78+
print += ("-----------------------------------------------------------------------------------------------\n");
79+
print += ("| rank | rate (N.s^-1) | Nobj | Npatch | t compute (s) | MPI | alloc | mem (max) |\n");
6980
if (shamcomm::world_size() > 1) {
70-
print += ("------------------------------------- Per ranks ---------------------------------------");
81+
print += ("----------------------------------------- Per ranks --------------------------------------------");
7182
print += (gathered) + "\n";
72-
//print += ("| rank | rate (N.s^-1) | Nobj | t compute (s) | interf | alloc | mem (max) |\n");
73-
print += ("---------<sum N>/<max t> ----- <sum> ------- <max> ------ <avg> -- <avg> --- <sum> ----");
83+
print += ("---------<sum N>/<max t> ----- <sum> ------- <sum> -- <max> ------ <avg> -- <avg> --- <sum> ----");
7484
print += (log_all_rate) + "\n";
7585
}else{
76-
print += ("---------------------------------------------------------------------------------------");
86+
print += ("------------------------------------------------------------------------------------------------");
7787
print += (gathered) + "\n";
7888
}
79-
print += ("---------------------------------------------------------------------------------------");
89+
print += ("------------------------------------------------------------------------------------------------");
8090
}
8191
// clang-format on
8292

src/shammodels/ramses/src/Solver.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,9 +1547,12 @@ void shammodels::basegodunov::Solver<Tvec, TgridVec>::evolve_once() {
15471547
u64 rank_count = scheduler().get_rank_count() * AMRBlock::block_size;
15481548
f64 rate = f64(rank_count) / tstep.elasped_sec();
15491549

1550+
u64 npatch = scheduler().patch_list.local.size();
1551+
15501552
std::string log_step = report_perf_timestep(
15511553
rate,
15521554
rank_count,
1555+
npatch,
15531556
tstep.elasped_sec(),
15541557
delta_mpi_timer,
15551558
t_dev_alloc,

src/shammodels/sph/src/Solver.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,11 +2121,14 @@ shammodels::sph::TimestepLog shammodels::sph::Solver<Tvec, Kern>::evolve_once()
21212121
u64 rank_count = scheduler().get_rank_count();
21222122
f64 rate = f64(rank_count) / tstep.elasped_sec();
21232123

2124+
u64 npatch = scheduler().patch_list.local.size();
2125+
21242126
// logger::info_ln("SPHSolver", "process rate : ", rate, "particle.s-1");
21252127

21262128
std::string log_step = report_perf_timestep(
21272129
rate,
21282130
rank_count,
2131+
npatch,
21292132
tstep.elasped_sec(),
21302133
delta_mpi_timer,
21312134
t_dev_alloc,

src/shammodels/zeus/src/Solver.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,12 @@ auto shammodels::zeus::Solver<Tvec, TgridVec>::evolve_once(Tscal t_current, Tsca
568568
u64 rank_count = scheduler().get_rank_count() * AMRBlock::block_size;
569569
f64 rate = f64(rank_count) / tstep.elasped_sec();
570570

571+
u64 npatch = scheduler().patch_list.local.size();
572+
571573
std::string log_step = report_perf_timestep(
572574
rate,
573575
rank_count,
576+
npatch,
574577
tstep.elasped_sec(),
575578
delta_mpi_timer,
576579
t_dev_alloc,

0 commit comments

Comments
 (0)