dmlc / dmlc/xgboost

SketchBatchNumElements minor bugs

Open
#9,716 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
28.8k
Forks
8.9k
Avg merge
1d 12h
Merged PRs (30d)
54

Description

1) In xgboost/blob/master/src/common/hist_util.cu, SketchBatchNumElements,

auto avail = dh::AvailableMemory(device) * 0.8;
this is a **double**, and this function returns size_t.
return value, return **std::min**(sketch_batch_num_elements, kIntMax);

2) In xgboost/blob/master/tests/cpp/common/test_hist_util.cu, TEST(HistUtil, SketchBatchNumElements),

auto avail = static_cast(dh::AvailableMemory(device) * 0.8);
this is correct, not double. However, "avail_elem" isn't compared with KIntMax, which can be a very large integer. It causes the following code fails,

"ASSERT_EQ(batch, avail_elem);"

Thanks.

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect SketchBatchNumElements in src/common/hist_util.cu and the corresponding TEST(HistUtil, SketchBatchNumElements) in tests/cpp/common/test_hist_util.cu. Compare the available-memory calculation and the kIntMax handling in both places, then run the named test to confirm the expected batch value and that it passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
machine-learning, testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.