MCPcopy Create free account
hub / github.com/dmlc/xgboost / TestSparsePageDMatrixDeterminism

Function TestSparsePageDMatrixDeterminism

tests/cpp/data/test_sparse_page_dmatrix.cc:345–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343}
344
345auto TestSparsePageDMatrixDeterminism(std::int32_t n_threads) {
346 std::vector<float> sparse_data;
347 std::vector<size_t> sparse_rptr;
348 std::vector<bst_feature_t> sparse_cids;
349
350 common::TemporaryDirectory tmpdir;
351 auto prefix = (tmpdir.Path() / "temp").string();
352 auto dmat = RandomDataGenerator{4096, 64, 0.0}.Batches(4).GenerateSparsePageDMatrix(prefix, true);
353
354 auto config = ExtMemConfig{prefix,
355 false,
356 ::xgboost::cuda_impl::AutoHostRatio(),
357 cuda_impl::MatchingPageBytes(),
358 std::numeric_limits<float>::quiet_NaN(),
359 n_threads};
360 CHECK(dmat->Ctx()->Threads() == n_threads || dmat->Ctx()->Threads() == AllThreadsForTest());
361
362 DMatrixToCSR(dmat.get(), &sparse_data, &sparse_rptr, &sparse_cids);
363
364 auto cache_name =
365 data::MakeId(prefix, dynamic_cast<data::SparsePageDMatrix *>(dmat.get())) + ".row.page";
366 auto cache = common::LoadSequentialFile(cache_name);
367 return cache;
368}
369
370TEST(SparsePageDMatrix, Determinism) {
371#if defined(_MSC_VER)

Callers 1

TESTFunction · 0.85

Calls 11

AutoHostRatioFunction · 0.85
MatchingPageBytesFunction · 0.85
AllThreadsForTestFunction · 0.85
DMatrixToCSRFunction · 0.85
MakeIdFunction · 0.85
LoadSequentialFileFunction · 0.85
BatchesMethod · 0.80
ThreadsMethod · 0.80
CtxMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected