Skip to content

Commit 34ed70e

Browse files
authored
[EM] Small tests for the no-concat option. (#11566)
- Update document for the new adaptive cache.
1 parent 29ada72 commit 34ed70e

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

python-package/xgboost/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ class DataIter(ABC): # pylint: disable=too-many-instance-attributes
540540
with GPU-based :py:class:`ExtMemQuantileDMatrix`. When using GPU-based external
541541
memory with the data cached in the host memory, XGBoost can concatenate the
542542
pages internally to increase the batch size for the GPU. The default page size
543-
is about 1/8 of the total device memory. Users can manually set the value based
543+
is about 1/16 of the total device memory. Users can manually set the value based
544544
on the actual hardware and datasets. Set this to 0 to disable page
545545
concatenation.
546546

src/data/data.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include "../data/iterative_dmatrix.h" // for IterativeDMatrix
3636
#include "./sparse_page_dmatrix.h" // for SparsePageDMatrix
3737
#include "array_interface.h" // for ArrayInterfaceHandler, ArrayInterface, Dispa...
38-
#include "batch_utils.h" // for MatchingPageBytes
3938
#include "cat_container.h" // for CatContainer
4039
#include "dmlc/base.h" // for BeginPtr
4140
#include "dmlc/common.h" // for OMPException

tests/cpp/data/test_ellpack_page_raw_format.cu

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ TEST(EllpackPageRawFormat, DevicePageConcat) {
198198
EXPECT_TRUE(page.Impl()->IsDense());
199199
CalcCacheMapping(&ctx, page.Impl()->IsDense(), cuts, min_cache_page_bytes, ext_info, false,
200200
&cinfo);
201-
EXPECT_EQ(cinfo.buffer_rows.size(), 4ul);
201+
if (min_cache_page_bytes == ::xgboost::cuda_impl::MatchingPageBytes()) {
202+
EXPECT_EQ(cinfo.NumBatchesCc(), ext_info.n_batches);
203+
} else {
204+
EXPECT_EQ(cinfo.buffer_rows.size(), 4ul);
205+
}
202206
policy.SetCuts(page.Impl()->CutsShared(), ctx.Device(), std::move(cinfo));
203207
}
204208

@@ -219,6 +223,11 @@ TEST(EllpackPageRawFormat, DevicePageConcat) {
219223
return mem_cache;
220224
};
221225

226+
{
227+
auto mem_cache =
228+
test(::xgboost::cuda_impl::MatchingPageBytes(), ::xgboost::cuda_impl::AutoHostRatio());
229+
ASSERT_EQ(mem_cache->d_pages.size(), 8);
230+
}
222231
{
223232
auto mem_cache = test(n_features * n_samples, ::xgboost::cuda_impl::AutoHostRatio());
224233
ASSERT_EQ(mem_cache->h_pages.size(), 4);

tests/cpp/data/test_extmem_quantile_dmatrix.cu

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class EllpackHostCacheTest : public ::testing::TestWithParam<std::tuple<double,
7474
auto p_fmat = RandomDataGenerator{NumSamples(), NumFeatures(), sparsity}
7575
.Device(ctx.Device())
7676
.GenerateDMatrix();
77-
bst_idx_t min_page_cache_bytes = 0;
77+
bst_idx_t min_page_cache_bytes = ::xgboost::cuda_impl::MatchingPageBytes();
7878
if (is_concat) {
7979
min_page_cache_bytes =
8080
p_fmat->GetBatches<EllpackPage>(&ctx, param).begin().Page()->Impl()->MemCostBytes() / 3;
@@ -111,9 +111,8 @@ class EllpackHostCacheTest : public ::testing::TestWithParam<std::tuple<double,
111111
};
112112

113113
TEST_P(EllpackHostCacheTest, Basic) {
114-
auto ctx = MakeCUDACtx(0);
115-
auto [sparsity, min_page_cache_bytes, cache_host_ratio] = this->GetParam();
116-
this->Run(sparsity, min_page_cache_bytes, cache_host_ratio);
114+
auto [sparsity, is_concat, cache_host_ratio] = this->GetParam();
115+
this->Run(sparsity, is_concat, cache_host_ratio);
117116
}
118117

119118
INSTANTIATE_TEST_SUITE_P(

0 commit comments

Comments
 (0)