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

massively reduce CPU allocation #186

Merged
merged 1 commit into from
Nov 2, 2022
Merged

Conversation

Moelf
Copy link
Contributor

@Moelf Moelf commented Nov 2, 2022

setup:

julia> x_train = rand(10^4, 60);

julia> y_train = rand(size(x_train, 1));

julia> config = EvoTreeRegressor(
               loss=:logistic,
               nrounds=100,
               lambda=0.5, gamma=0.0, eta=0.05,
               max_depth=6, min_weight=1.0,
               rowsample=1.0, colsample=0.5, nbins=64);
[ Info: Following 5 arguments were not provided and will be set to default: alpha, T, rng, device, monotone_constraints.

Before

julia> @time fit_evotree(config; x_train, y_train);
  0.330572 seconds (440.90 k allocations: 218.696 MiB, 9.79% gc time)

After this PR

julia> @time fit_evotree(config; x_train, y_train);
  0.242588 seconds (343.28 k allocations: 54.385 MiB, 6.30% gc time)

@codecov-commenter
Copy link

codecov-commenter commented Nov 2, 2022

Codecov Report

Base: 50.36% // Head: 50.56% // Increases project coverage by +0.19% 🎉

Coverage data is based on head (3a18d0c) compared to base (875e93f).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #186      +/-   ##
==========================================
+ Coverage   50.36%   50.56%   +0.19%     
==========================================
  Files          17       17              
  Lines        1487     1493       +6     
==========================================
+ Hits          749      755       +6     
  Misses        738      738              
Impacted Files Coverage Δ
src/fit.jl 94.37% <100.00%> (+0.21%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Moelf
Copy link
Contributor Author

Moelf commented Nov 2, 2022

@jeremiedb btw, I think for all the Vector{Vector{}} stuff, you should use https://github.com/JuliaArrays/ArraysOfArrays.jl

its supports syntax of Vector{Vector{}} while also providing flattenview which can help you quickly updates all the underlying values in node (without pointer chasing) and also GPU friendly.

@jeremiedb jeremiedb merged commit 040a210 into Evovest:main Nov 2, 2022
@Moelf Moelf deleted the reduce_allocation branch November 2, 2022 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants