-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Gradient based sampling for external memory mode on GPU #5093
Merged
Merged
Changes from 13 commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
51b50da
add skeleton gradient-based sampler
rongou ebd67c1
change gpu_hist to use sampling in external memory mode
rongou a2c446c
add failing tests
rongou 9e91871
wip: poisson sampling
rongou ed322cc
sample and scale gradient pairs
rongou 9377014
calculate max number of sample rows
rongou f26415c
add sampler constructor
rongou f2dd928
collect all pages in memory if they fit
rongou 2e5494c
optimize finalize position
rongou 7fca606
done with sampling
rongou f661df0
add some docs
rongou 6513f8a
Merge branch 'master' into gradient-based-sampler
rongou 14361af
formatting
rongou 70276f1
explicit constructor
rongou d7770b4
no need for gmock
rongou 6a29c38
test ellpackpage copy and compact
rongou 967ff16
use subsample to control gradient sampler
rongou 494b179
Merge branch 'master' into gradient-based-sampler
rongou ecd2419
Merge branch 'master' into gradient-based-sampler
rongou 73ba5af
implement sequential poisson sampling
rongou d2f2f69
fix compact bug
rongou 827c988
fix cpp test
rongou 9350ec5
Merge branch 'master' into gradient-based-sampler
rongou 4482181
Merge branch 'master' into gradient-based-sampler
rongou 857c9c7
finally working
rongou 7de1620
add uniform sampling
rongou d3a3dbf
better estimate of sample rows
rongou 780f5e6
Merge branch 'master' into gradient-based-sampler
rongou f728623
more agressive memory allocation
rongou c206880
add some documentation
rongou 5652b3b
use mvs
rongou 8ba43fb
Merge branch 'master' into gradient-based-sampler
rongou a5b57b1
fix windows
rongou 62a9ead
address review comments
rongou ca64413
Merge branch 'master' into gradient-based-sampler
rongou 2409ecb
add sampling method param
rongou 3b16e66
gradient-based sampling in in-memory mode
rongou 0745686
Merge branch 'master' into gradient-based-sampler
rongou e41496b
fix clang tidy warning
rongou fd458c6
add tests for in-core
rongou 6e3a7fa
remove unused code
rongou cb608a5
Merge branch 'master' into gradient-based-sampler
rongou 4daffbf
relax tests
rongou 5dd01e7
Merge branch 'master' into gradient-based-sampler
rongou 35ac5a7
Merge branch 'master' into gradient-based-sampler
rongou 9aaa9ba
add test to verify sampling
rongou 83fb791
Merge branch 'master' into gradient-based-sampler
rongou 0eccff9
Merge branch 'master' into gradient-based-sampler
rongou 10fce05
inverse probability weighting estimation
rongou 55bbe74
combine weight calculation and gpair scaling
rongou 85d2ec9
Merge branch 'master' into gradient-based-sampler
rongou be163b7
fix tests
rongou 3a0fd99
review feedback
rongou c9eb5c9
Merge branch 'master' into gradient-based-sampler
rongou 9680a69
calculate threshold
rongou c93f20d
tweak test
rongou d684148
Merge branch 'master' into gradient-based-sampler
rongou 09864ed
more accurate threshold
rongou 7675a9e
Merge branch 'master' into gradient-based-sampler
rongou f8b7dbf
tweak test tolerance
rongou 3aaae89
wip: refactor the code to disintangle sampling methods
rongou a83f13e
Merge branch 'master' into gradient-based-sampler
rongou 5cbca76
done with refactoring
rongou 7cf9110
fix tests
rongou 71b21c6
Merge branch 'master' into gradient-based-sampler
rongou 3a734a9
release device memory
rongou 55b36f2
remove scaling in uniform sampling
rongou 97ae33d
Merge branch 'master' into gradient-based-sampler
rongou df96394
Merge branch 'master' into gradient-based-sampler
rongou 7fd7c31
revert rabit
rongou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,10 @@ struct EllpackInfo { | |
size_t row_stride, | ||
const common::HistogramCuts& hmat, | ||
dh::BulkAllocator* ba); | ||
|
||
inline size_t NumSymbols() const { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for inline. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
return n_bins + 1; | ||
} | ||
}; | ||
|
||
/** \brief Struct for accessing and manipulating an ellpack matrix on the | ||
|
@@ -200,6 +204,14 @@ class EllpackPageImpl { | |
*/ | ||
EllpackPageImpl() = default; | ||
|
||
/*! | ||
* \brief Constructor from an existing EllpackInfo. | ||
* | ||
* This is used in the sampling case. The ELLPACK page is constructed from an existing EllpackInfo | ||
* and the given number of rows. | ||
*/ | ||
explicit EllpackPageImpl(int device, EllpackInfo info, size_t n_rows); | ||
|
||
/*! | ||
* \brief Constructor from an existing DMatrix. | ||
* | ||
|
@@ -208,6 +220,23 @@ class EllpackPageImpl { | |
*/ | ||
explicit EllpackPageImpl(DMatrix* dmat, const BatchParam& parm); | ||
|
||
/*! \brief Copy the elements of the given ELLPACK page into this page. | ||
* | ||
* @param device The GPU device to use. | ||
* @param page The ELLPACK page to copy from. | ||
* @param offset The number of elements to skip before copying. | ||
* @returns The number of elements copied. | ||
*/ | ||
size_t Copy(int device, EllpackPageImpl* page, size_t offset); | ||
|
||
/*! \brief Compact the given ELLPACK page into the current page. | ||
* | ||
* @param device The GPU device to use. | ||
* @param page The ELLPACK page to compact from. | ||
* @param row_indexes Row indexes for the compacted page. | ||
*/ | ||
void Compact(int device, EllpackPageImpl* page, common::Span<size_t> row_indexes); | ||
|
||
/*! | ||
* \brief Initialize the EllpackInfo contained in the EllpackMatrix. | ||
* | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be careful for 0 division.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out don't really need these. Removed.