-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
reduce the buffer when using high dimensional data in distributed mode. #2485
Merged
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a67f686
reduce the buffer when using high dimensional data in distributed mode.
guolinke 958ecfb
Update dataset_loader.cpp
guolinke 3d2b82a
Merge remote-tracking branch 'origin/master' into dist-memory-reduce
guolinke fc3e573
refix
guolinke e363201
typo
guolinke b1598a0
fix number of bin accumulation.
guolinke 1618260
avoid overflow
guolinke 7e4f2ab
fix warning
guolinke affcc88
efficient solution.
guolinke 3b59e76
Update dataset.h
guolinke 96db1a6
fix bin count output
guolinke a73d4fd
fix warning
guolinke c25557c
bug in dist number of feature check
guolinke 1847238
fix possible edge case
guolinke 3152a3c
Update dataset.cpp
guolinke 25ac715
possible bug fix
guolinke 7e1e11d
fix
guolinke 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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -594,7 +594,22 @@ Dataset* DatasetLoader::CostructFromSampleData(double** sample_values, | |||||
|
||||||
const data_size_t filter_cnt = static_cast<data_size_t>( | ||||||
static_cast<double>(config_.min_data_in_leaf * total_sample_size) / num_data); | ||||||
if (Network::num_machines() == 1) { | ||||||
|
||||||
bool force_findbin_in_single_machine = false; | ||||||
if (Network::num_machines() > 1) { | ||||||
int total_num_feature = Network::GlobalSyncUpByMin(num_col); | ||||||
size_t esimate_sync_size = BinMapper::SizeForSpecificBin(config_.max_bin) * total_num_feature; | ||||||
const size_t max_buf_size = 2 << 31; | ||||||
if (esimate_sync_size >= max_buf_size) { | ||||||
if (config_.pre_partition) { | ||||||
Log::Warning("Too many features for distributed model, it is better to pass categorical feature directly instead of sparse high dimensional feature vectors."); | ||||||
} else { | ||||||
force_findbin_in_single_machine = true; | ||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
if (Network::num_machines() == 1 || force_findbin_in_single_machine) { | ||||||
// if only one machine, find bin locally | ||||||
OMP_INIT_EX(); | ||||||
#pragma omp parallel for schedule(guided) | ||||||
|
@@ -933,8 +948,22 @@ void DatasetLoader::ConstructBinMappersFromTextData(int rank, int num_machines, | |||||
const data_size_t filter_cnt = static_cast<data_size_t>( | ||||||
static_cast<double>(config_.min_data_in_leaf* sample_data.size()) / dataset->num_data_); | ||||||
|
||||||
bool force_findbin_in_single_machine = false; | ||||||
if (Network::num_machines() > 1) { | ||||||
int total_num_feature = Network::GlobalSyncUpByMin(dataset->num_total_features_); | ||||||
size_t esimate_sync_size = BinMapper::SizeForSpecificBin(config_.max_bin) * total_num_feature; | ||||||
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. Same as above, avoids overflow.
Suggested change
|
||||||
const size_t max_buf_size = 2 << 31; | ||||||
if (esimate_sync_size >= max_buf_size) { | ||||||
if (config_.pre_partition) { | ||||||
Log::Warning("Too many features for distributed model, it is better to pass categorical feature directly instead of sparse high dimensional feature vectors."); | ||||||
} else { | ||||||
force_findbin_in_single_machine = true; | ||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
// start find bins | ||||||
if (num_machines == 1) { | ||||||
if (num_machines == 1 || force_findbin_in_single_machine) { | ||||||
// if only one machine, find bin locally | ||||||
OMP_INIT_EX(); | ||||||
#pragma omp parallel for schedule(guided) | ||||||
|
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.
This will still lead to overflow, need to cast the operands before assigning to a wider type.