Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp some deadlock analysis for GH #6437

Merged
merged 9 commits into from
Jan 16, 2025
Prev Previous commit
Next Next commit
Deadlock analysis print measurement timescale time bounds
knelli2 committed Jan 16, 2025

Verified

This commit was signed with the committer’s verified signature.
knelli2 Kyle Nelli
commit 95cc58334a0d69f2a2ada7708a98817b9f73b68a
29 changes: 24 additions & 5 deletions src/Evolution/Deadlock/PrintFunctionsOfTime.hpp
Original file line number Diff line number Diff line change
@@ -10,12 +10,18 @@
#include "Domain/FunctionsOfTime/Tags.hpp"
#include "Parallel/GlobalCache.hpp"
#include "Parallel/Info.hpp"
#include "Parallel/ParallelComponentHelpers.hpp"
#include "Parallel/Printf/Printf.hpp"

namespace control_system::Tags {
struct MeasurementTimescales;
} // namespace control_system::Tags

namespace deadlock {
/*!
* \brief Simple action that will print the `domain::Tags::FunctionsOfTime` time
* bounds for each node of a simulation.
* \brief Simple action that will print the `domain::Tags::FunctionsOfTime` and
* `control_system::Tags::MeasurementTimescales` (if it exists) time bounds for
* each node of a simulation.
*/
struct PrintFunctionsOfTime {
template <typename ParallelComponent, typename DbTags, typename Metavariables,
@@ -25,12 +31,25 @@ struct PrintFunctionsOfTime {
const ArrayIndex& /*array_index*/) {
const auto& functions_of_time =
Parallel::get<::domain::Tags::FunctionsOfTime>(cache);

const std::string time_bounds =
::domain::FunctionsOfTime::output_time_bounds(functions_of_time);

Parallel::printf("Node %zu\n%s\n", Parallel::my_node<size_t>(cache),
time_bounds);
if constexpr (Parallel::is_in_global_cache<
Metavariables,
control_system::Tags::MeasurementTimescales>) {
const auto& measurement_timescales =
Parallel::get<control_system::Tags::MeasurementTimescales>(cache);
const std::string measurement_time_bounds =
::domain::FunctionsOfTime::output_time_bounds(measurement_timescales);

Parallel::printf(
"Node %zu\nFunctionsOfTime:\n%s\n\nMeasurementTimescales:\n%s\n",
Parallel::my_node<size_t>(cache), time_bounds,
measurement_time_bounds);
} else {
Parallel::printf("Node %zu\nFunctionsOfTime:%s\n",
Parallel::my_node<size_t>(cache), time_bounds);
}
}
};
} // namespace deadlock