Skip to content

Commit

Permalink
fix GC GPU & docs typo
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremiedb committed Oct 26, 2022
1 parent a786e19 commit 660dd6c
Showing 4 changed files with 46 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [EvoTress.jl](https://github.com/Evovest/EvoTrees.jl)
# [EvoTrees.jl](https://github.com/Evovest/EvoTrees.jl)

A Julia implementation of boosted trees with CPU and GPU support. Efficient histogram based algorithms with support for multiple loss functions, including various regressions, multi-classification and Gaussian max likelihood.

41 changes: 41 additions & 0 deletions experiments/benchmarks_v2-gpu.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using Revise
using Statistics
using StatsBase: sample
using EvoTrees
using BenchmarkTools
using CUDA

nrounds = 200
nthread = Base.Threads.nthreads()

@info nthread

# EvoTrees params
params_evo = EvoTreeRegressor(
T=Float32,
loss="linear",
nrounds=nrounds,
alpha=0.5,
lambda=0.0,
gamma=0.0,
eta=0.05,
max_depth=6,
min_weight=1.0,
rowsample=1.0,
colsample=1.0,
nbins=64,
device = "gpu"
)

nobs = Int(11_664_400)
num_feat = Int(36)
@info "testing with: $nobs observations | $num_feat features."
x_train = rand(nobs, num_feat)
y_train = rand(size(x_train, 1))

@info "evotrees train GPU:"
@time m_evo_gpu = fit_evotree(params_evo; x_train, y_train);
for i in 1:5
@time m_evo_gpu = fit_evotree(params_evo; x_train, y_train);
end
# @time m_evo = fit_evotree(params_evo; x_train, y_train, x_eval=x_train, y_eval=y_train, metric=metric_evo, print_every_n=100);
4 changes: 4 additions & 0 deletions src/fit.jl
Original file line number Diff line number Diff line change
@@ -393,6 +393,10 @@ function fit_evotree(
model.metric.iter = metric_best.iter
model.metric.metric = metric_best.metric
end
if params.device == "gpu"
GC.gc(true)
CUDA.reclaim()
end
params.nrounds = nrounds_max
return model
end
1 change: 0 additions & 1 deletion src/gpu/fit_gpu.jl
Original file line number Diff line number Diff line change
@@ -135,7 +135,6 @@ function grow_evotree!(evotree::GBTreeGPU{L,T,S}, cache) where {L,T,S}
predict!(cache.pred, tree, cache.x, cache.K)
end # end of nrounds
cache.params.nrounds = params.nrounds
CUDA.reclaim()
return evotree
end

0 comments on commit 660dd6c

Please sign in to comment.