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

Fix Histogram allocation. #4347

Merged
merged 2 commits into from
Apr 10, 2019
Merged

Fix Histogram allocation. #4347

merged 2 commits into from
Apr 10, 2019

Conversation

trivialfis
Copy link
Member

nidx_map is cleared after Reset, but histogram data size isn't changed hence
histogram recycling is used in later iterations. After a reset(building new
tree), newly allocated node will start from 0, while recycling always choose
the node with smallest index, which happens to be our newly allocated node 0.

close #4330.

@trivialfis trivialfis requested a review from RAMitchell April 9, 2019 10:41
nidx_map is cleared after `Reset`, but histogram data size isn't changed hence
histogram recycling is used in later iterations.  After a reset(building new
tree), newly allocated node will start from 0, while recycling always choose
the node with smallest index, which happens to be our newly allocated node 0.
@trivialfis
Copy link
Member Author

Removed doubling data size in allocation. This is done inside thrust::device_vector, see thrust/detail/vector_base.inl: vector_base::append(size_type n).

@RAMitchell
Copy link
Member

Removed doubling data size in allocation. This is done inside thrust::device_vector, see thrust/detail/vector_base.inl: vector_base::append(size_type n).

There is a performance penalty for this, thrust must launch a kernel on resize in order to initialise new values. This means kernels get redundantly launched every time a node is added, hence why my original implementation.

@trivialfis
Copy link
Member Author

@RAMitchell Done.

@RAMitchell
Copy link
Member

LGTM, I assume you have checked it solves #4330?

@trivialfis
Copy link
Member Author

@RAMitchell Yep. It's solved.

@trivialfis trivialfis merged commit 5c25755 into dmlc:master Apr 10, 2019
@trivialfis trivialfis deleted the fix/hist-exist branch April 10, 2019 11:21
@hcho3 hcho3 mentioned this pull request Apr 21, 2019
18 tasks
@lock lock bot locked as resolved and limited conversation to collaborators Jul 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check failed: this->HistogramExists(nidx)
2 participants