Skip to content

Commit

Permalink
When we catch an exception, print it to stderr before calling MPI.Abort
Browse files Browse the repository at this point in the history
Previously, we were printing to stdout, but this makes it more likely
for the error message and stack trace to get lost, e.g. when
`quietoutput()` is used in the tests.
  • Loading branch information
johnomotani committed Sep 16, 2024
1 parent cab2c90 commit 5b036b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions moment_kinetics/src/moment_kinetics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ function run_moment_kinetics(to::Union{TimerOutput,Nothing}, input_dict=Dict();
# Stop code from hanging when running on multiple processes if only one of them
# throws an error
if global_size[] > 1
println("$(typeof(e)) on process $(global_rank[]):")
showerror(stdout, e, catch_backtrace())
println(stderr, "$(typeof(e)) on process $(global_rank[]):")
showerror(stderr, e, catch_backtrace())
flush(stdout)
flush(stderr)
MPI.Abort(comm_world, 1)
Expand Down

0 comments on commit 5b036b8

Please sign in to comment.