Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
SolverLog.cpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
20#include <stdexcept>
21
22f64 shammodels::sph::SolverLog::get_last_rate() {
23
24 if (step_logs.size() == 0) {
26 }
27
28 u64 last_id = step_logs.size() - 1;
29
30 u64 obj_loc = step_logs[last_id].rank_count;
31 f64 time_loc = step_logs[last_id].elasped_sec;
32
33 u64 obj_total = shamalgs::collective::allreduce_sum(obj_loc);
34 f64 max_t = shamalgs::collective::allreduce_max(time_loc);
35
36 return f64(obj_total) / max_t;
37}
38
39u64 shammodels::sph::SolverLog::get_last_obj_count() {
40
41 if (step_logs.size() == 0) {
43 }
44
45 u64 last_id = step_logs.size() - 1;
46
47 u64 cnt_loc = step_logs[last_id].rank_count;
48
49 u64 cnt_tot = shamalgs::collective::allreduce_sum(cnt_loc);
50
51 return cnt_tot;
52}
53
54shamsys::SystemMetrics shammodels::sph::SolverLog::get_last_system_metrics() {
55
56 if (step_logs.size() == 0) {
58 }
59
60 auto &last_log = step_logs.back();
61
62 auto rank_metrics = shamsys::gather_rank_metrics(last_log.system_metrics);
63 return shamsys::aggregate_rank_metrics(rank_metrics);
64}
double f64
Alias for double.
std::uint64_t u64
64 bit unsigned integer
This header file contains utility functions related to exception handling in the code.
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.