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

Improve performance of logging #19

Open
ashton314 opened this issue May 18, 2023 · 1 comment
Open

Improve performance of logging #19

ashton314 opened this issue May 18, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@ashton314
Copy link
Member

Working on this code in FloatTrackerExamples:

using FloatTracker: TrackedFloat16, TrackedFloat32, write_out_logs, set_inject_nan, set_exclude_stacktrace, set_logger
using ShallowWaters, PyPlot

set_logger(filename="pretty_nan_tf", buffersize=100000, cstg=true, cstgArgs=true, cstgLineNum=true)
set_exclude_stacktrace([:prop,:gen]) # Props and kills take the lion share of the perf hit
# set_exclude_stacktrace([:prop,:kill,:gen])

P = run_model(T=TrackedFloat32,
              nx=100, L_ratio=1, bc="nonperiodic", wind_forcing_x="double_gyre",
              topography="seamount",cfl=2,Ndays=300)

pcolormesh(P.η')
savefig("height_pretty_nan_tf.png")

speed = sqrt.(Ix(P.u.^2)[:,2:end-1] + Iy(P.v.^2)[2:end-1,:])
pcolormesh(speed')
savefig("speed_pretty_nan_tf.png")

Dialing the buffer size up really high reduced runtime from 65s → 50s. Turning off kill logs dropped the runtime to just 14s. This suggests to me that part of where FloatTracker gets slow is writing (or just formatting?) the logs. I bet we could easily improve the performance here.

@bennn
Copy link
Member

bennn commented Jun 3, 2023

NB: setting maxLogs (#28 ) is a quick way to improve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants