|
41 | 41 |
|
42 | 42 | #include "fmt/color.h" // fmt::fg, fmt::color::orange |
43 | 43 | #include "fmt/format.h" // fmt::format |
| 44 | +#include "fmt/ranges.h" // fmt::join |
44 | 45 | #include "igor/igor.hpp" // igor::parser |
45 | 46 |
|
46 | 47 | #include <algorithm> // std::max_element, std::all_of |
47 | 48 | #include <chrono> // std::chrono::{time_point, steady_clock, duration_cast} |
48 | 49 | #include <cstddef> // std::size_t |
| 50 | +#include <cstdint> // std::int64_t |
49 | 51 | #include <limits> // std::numeric_limits::lowest |
50 | 52 | #include <memory> // std::unique_ptr |
51 | 53 | #include <optional> // std::optional, std::make_optional, std::nullopt |
@@ -967,10 +969,22 @@ std::tuple<aos_matrix<real_type>, std::vector<real_type>, std::vector<unsigned l |
967 | 969 | const auto assembly_duration = std::chrono::duration_cast<std::chrono::milliseconds>(assembly_end_time - assembly_start_time); |
968 | 970 |
|
969 | 971 | if (used_solver != solver_type::cg_implicit) { |
970 | | - detail::log(verbosity_level::full | verbosity_level::timing, |
971 | | - comm_, |
972 | | - "Assembled the kernel matrix in {}.\n", |
973 | | - assembly_duration); |
| 972 | + if (comm_.size() > 1) { |
| 973 | + // gather kernel matrix assembly runtimes from each MPI rank |
| 974 | + const std::vector<std::chrono::milliseconds> durations = comm_.gather(assembly_duration); |
| 975 | + |
| 976 | + detail::log(verbosity_level::full | verbosity_level::timing, |
| 977 | + comm_, |
| 978 | + "Assembled the kernel matrix in {} ({}).\n", |
| 979 | + *std::max_element(durations.cbegin(), durations.cend()), |
| 980 | + fmt::join(durations, "|")); |
| 981 | + |
| 982 | + } else { |
| 983 | + detail::log(verbosity_level::full | verbosity_level::timing, |
| 984 | + comm_, |
| 985 | + "Assembled the kernel matrix in {}.\n", |
| 986 | + assembly_duration); |
| 987 | + } |
974 | 988 | } |
975 | 989 | PLSSVM_DETAIL_TRACKING_PERFORMANCE_TRACKER_ADD_TRACKING_ENTRY((detail::tracking::tracking_entry{ "kernel_matrix", "kernel_matrix_assembly", assembly_duration })); |
976 | 990 |
|
|
0 commit comments