Skip to content

Commit

Permalink
add a prefixing to benchmarks (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
seabbs authored Aug 5, 2024
1 parent 4183796 commit bc99b2e
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions benchmark/make_epiaware_suite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,28 @@
"""
function make_epiaware_suite(model; check = true,
adbackends = [:forwarddiff, :reversediff, :reversediff_compiled])
suite = TuringBenchmarking.make_turing_suite(
model; check = check, adbackends = adbackends)
suite = prefix_warnings(
() -> TuringBenchmarking.make_turing_suite(
model; check = check, adbackends = adbackends),
model
)
return suite
end

function prefix_warnings(f, g)
original_stderr = stderr
(read_pipe, write_pipe) = redirect_stderr()
result = nothing
try
result = f()
finally
redirect_stderr(original_stderr)
close(write_pipe)
output = String(read(read_pipe))
if !isempty(output)
println(stderr, "\nWarnings from $(g):")
println(stderr, output)
end
end
return result
end

0 comments on commit bc99b2e

Please sign in to comment.