Skip to content

SketchBatchNumElements minor bugs #9716

@hliuca

Description

@hliuca
  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<size_t>(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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions