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
17
21#include <stdexcept>
22
23f64 shammodels::SolverLog::get_last_rate() {
24
25 if (step_logs.size() == 0) {
27 }
28
29 u64 last_id = step_logs.size() - 1;
30
31 u64 obj_loc = step_logs[last_id].rank_count;
32 f64 time_loc = step_logs[last_id].elasped_sec;
33
34 u64 obj_total = shamalgs::collective::allreduce_sum(obj_loc);
35 f64 max_t = shamalgs::collective::allreduce_max(time_loc);
36
37 return f64(obj_total) / max_t;
38}
39
40u64 shammodels::SolverLog::get_last_obj_count() {
41
42 if (step_logs.size() == 0) {
44 }
45
46 u64 last_id = step_logs.size() - 1;
47
48 u64 cnt_loc = step_logs[last_id].rank_count;
49
50 u64 cnt_tot = shamalgs::collective::allreduce_sum(cnt_loc);
51
52 return cnt_tot;
53}
54
55shamsys::SystemMetrics shammodels::SolverLog::get_last_system_metrics() {
56
57 if (step_logs.size() == 0) {
59 }
60
61 auto &last_log = step_logs.back();
62
63 auto rank_metrics = shamsys::gather_rank_metrics(last_log.system_metrics);
64 return shamsys::aggregate_rank_metrics(rank_metrics);
65}
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.
ExcptTypes make_except_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Create an exception with a message and a location.