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

reset threads also when initializing the summary callback #1587

Merged
merged 2 commits into from
Jul 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/callbacks_step/summary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ Create and return a callback that prints a human-readable summary of the simulat
beginning of a simulation and then resets the timer. When the returned callback is executed
directly, the current timer values are shown.
"""
function SummaryCallback()
function SummaryCallback(reset_threads = true)
function initialize(cb, u, t, integrator)
initialize_summary_callback(cb, u, t, integrator;
reset_threads)
end
DiscreteCallback(summary_callback, summary_callback,
save_positions = (false, false),
initialize = initialize_summary_callback)
initialize = initialize)
end

function Base.show(io::IO, cb::DiscreteCallback{<:Any, <:typeof(summary_callback)})
Expand Down Expand Up @@ -139,7 +143,15 @@ end

# Print information about the current simulation setup
# Note: This is called *after* all initialization is done, but *before* the first time step
function initialize_summary_callback(cb::DiscreteCallback, u, t, integrator)
function initialize_summary_callback(cb::DiscreteCallback, u, t, integrator;
reset_threads = true)
# Optionally reset Polyester.jl threads. See
# https://github.com/trixi-framework/Trixi.jl/issues/1583
# https://github.com/JuliaSIMD/Polyester.jl/issues/30
if reset_threads
Polyester.reset_threads!()
end

mpi_isroot() || return nothing

print_startup_message()
Expand Down