Skip to content

Commit

Permalink
Merge #259
Browse files Browse the repository at this point in the history
259: Add allocation percentage change info string r=valeriabarra a=valeriabarra

## Purpose 
This quick PR improves the allocation percentage change info string. I personally find the percentage increase/decrease easier to understand than the delta.


## Content
- Updated the ``@info`` string showing an allocation percentage increase or decrease 


Review checklist

I have:
- followed the codebase contribution guide: https://clima.github.io/ClimateMachine.jl/latest/Contributing/
- followed the style guide: https://clima.github.io/ClimateMachine.jl/latest/DevDocs/CodeStyle/
- followed the documentation policy: https://github.com/CliMA/policies/wiki/Documentation-Policy
- checked that this PR does not duplicate an open PR.

In the Content, I have included 
- relevant unit tests, and integration tests, 
- appropriate docstrings on all functions, structs, and modules, and included relevant documentation.

- [x] I have read and checked the items on the review checklist.


Co-authored-by: Valeria Barra <[email protected]>
  • Loading branch information
bors[bot] and valeriabarra authored Feb 13, 2023
2 parents 1d8694f + cfe5dd5 commit b50046f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion perf/flame.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ end

# We're grouping allocation tests here for convenience.

buffer = 1 # increase slightly for (nondeterministic) threaded runs
buffer = 1.2 # increase slightly for (nondeterministic) threaded runs

# profile the coupling loop
allocs = @allocated step_coupler!(cs, n_samples)
Expand All @@ -98,6 +98,12 @@ end

Δallocs = allocs / allocs_limit[run_name]
@info "Allocation change (allocs/allocs_limit): $Δallocs"
percent_alloc_change = (1 - Δallocs) * 100
if percent_alloc_change 0
@info "Allocations improved by: $percent_alloc_change %"
else
@info "Allocations worsened by: $percent_alloc_change %"
end

@testset "Allocations limit" begin
@test allocs allocs_limit[run_name]
Expand Down

0 comments on commit b50046f

Please sign in to comment.