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

Function MakeExtMemForTest

tests/cpp/c_api/test_c_api.cc:458–479  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456}
457
458auto MakeExtMemForTest(bst_idx_t n_samples, bst_feature_t n_features, Json dconfig) {
459 std::size_t n_batches{4};
460 NumpyArrayIterForTest iter_0{0.0f, n_samples, n_features, n_batches};
461 std::string s_dconfig;
462 dconfig["cache_prefix"] = String{"cache"};
463 Json::Dump(dconfig, &s_dconfig);
464 DMatrixHandle p_fmat;
465 CHECK_EQ(XGDMatrixCreateFromCallback(static_cast<DataIterHandle>(&iter_0), iter_0.Proxy(), Reset,
466 Next, s_dconfig.c_str(), &p_fmat),
467 0);
468
469 NumpyArrayIterForTest iter_1{0.0f, n_samples, n_features, n_batches};
470 auto config = ExtMemConfig{"",
471 false,
472 cuda_impl::AutoHostRatio(),
473 cuda_impl::MatchingPageBytes(),
474 std::numeric_limits<float>::quiet_NaN(),
475 0};
476 auto Xy = std::make_shared<data::SparsePageDMatrix>(&iter_1, iter_1.Proxy(), Reset, Next, config);
477 MakeLabelForTest(Xy, p_fmat);
478 return std::pair{p_fmat, Xy};
479}
480
481template <typename Page>
482void CheckResult(Context const *ctx, bst_feature_t n_features, std::shared_ptr<DMatrix> Xy,

Callers 1

Calls 6

AutoHostRatioFunction · 0.85
MatchingPageBytesFunction · 0.85
MakeLabelForTestFunction · 0.85
c_strMethod · 0.80
ProxyMethod · 0.45

Tested by

no test coverage detected