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

Optimization of EvaluateSplit function #5138

Merged
merged 1 commit into from
Dec 31, 2019
Merged

Conversation

SmirnovEgorRu
Copy link
Contributor

EvaluateSplit was optimized by processing many tree nodes in the same time.
Foe details look at the issue #5104

To implement this ParallelFor2d was introduced to support nested parallelism. This function will be used for optimizations of other functions BuildHist and ApplySplit.
In previous implementation the main source of code complexity was blocking for nested parallelism. Now common code for this was aggregated and moved in common threading utils. So, further PRs should be more light-weight.

I will provide performance numbers a bit later.

CC: @hcho3, @RAMitchell, @trivialfis

@RAMitchell
Copy link
Member

This looks much better than before, also PR is about the right size. I will leave others to comment on algorithm correctness.

@hcho3 hcho3 self-assigned this Dec 19, 2019
@SmirnovEgorRu
Copy link
Contributor Author

Looks like errors in CI contain are not related to my changes:
[2019-12-19T21:54:43.782Z] Connecting to apache.osuosl.org (apache.osuosl.org)|64.50.236.52|:80... connected.
[2019-12-19T21:54:44.174Z] HTTP request sent, awaiting response... 404 Not Found
[2019-12-19T21:54:44.174Z] 2019-12-19 21:54:43 ERROR 404: Not Found.

@trivialfis
Copy link
Member

Please rebase it to master branch or merge the latest commits.

@SmirnovEgorRu SmirnovEgorRu force-pushed the opt_1 branch 3 times, most recently from a7e49bd to ec65580 Compare December 21, 2019 17:12
@SmirnovEgorRu
Copy link
Contributor Author

@hcho3, here is a breakdown for Airline data set, now performance for EvaluateSplit is similar to how it was before reverting:

airline-ohe ApplySplit EvaluateSplit BuildHist SyncHistogram Prediction Total, sec
Master 26 27 67 12 2 157
Before reverting 9.0 6.1 28.8 0.0 0.7 63.7
This PR 25.8 5.4 67.3 11.6 1.5 135.3

src/tree/updater_quantile_hist.cc Show resolved Hide resolved
this->EvaluateSplit(0, gmat, hist_, *p_fmat, *p_tree);
qexpand_loss_guided_->push(ExpandEntry(0, p_tree->GetDepth(0),
snode_[0].best.loss_chg, timestamp++));
ExpandEntry node(0, p_tree->GetDepth(0), snode_[0].best.loss_chg, timestamp++);
Copy link
Member

@trivialfis trivialfis Dec 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The depth of root node is determined I believe. Please help removing it as legacy support for root_index is now removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed 0 to ExpandEntry::kRootNid const, if I correctly understand the comment.

src/tree/updater_quantile_hist.cc Outdated Show resolved Hide resolved
@trivialfis
Copy link
Member

Will run some bench on my own today. For other reviews I will leave it up to @hcho3

Copy link
Collaborator

@hcho3 hcho3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your valuable contribution. In particular, I appreciate the introduction of new abstraction BlockedSpace2d and ParallelFor2d. It improved code legibility tremendously. I have some minor comments, but otherwise LGTM.

src/tree/updater_quantile_hist.cc Outdated Show resolved Hide resolved
src/tree/updater_quantile_hist.cc Outdated Show resolved Hide resolved
src/tree/updater_quantile_hist.cc Outdated Show resolved Hide resolved
src/tree/updater_quantile_hist.h Outdated Show resolved Hide resolved
@hcho3
Copy link
Collaborator

hcho3 commented Dec 31, 2019

@trivialfis Can we merge this now?

@trivialfis
Copy link
Member

Will try merging it today.

@trivialfis
Copy link
Member

Running benchmarks.

@trivialfis
Copy link
Member

@SmirnovEgorRu Thanks for the optimization!

@trivialfis trivialfis merged commit 7b17e76 into dmlc:master Dec 31, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants