| 638 | } |
| 639 | |
| 640 | [[nodiscard]] std::shared_ptr<DMatrix> GetExternalMemoryDMatrixFromData( |
| 641 | HostDeviceVector<float> const& x, bst_idx_t n_samples, bst_feature_t n_features, |
| 642 | const common::TemporaryDirectory& tempdir, bst_idx_t n_batches) { |
| 643 | Context ctx; |
| 644 | auto iter = NumpyArrayIterForTest{&ctx, x, n_samples / n_batches, n_features, n_batches}; |
| 645 | |
| 646 | auto prefix = tempdir.Path() / "temp"; |
| 647 | auto config = ExtMemConfig{ |
| 648 | prefix.string(), |
| 649 | false, |
| 650 | ::xgboost::cuda_impl::AutoHostRatio(), |
| 651 | ::xgboost::cuda_impl::AutoCachePageBytes(), |
| 652 | std::numeric_limits<float>::quiet_NaN(), |
| 653 | Context{}.Threads(), |
| 654 | }; |
| 655 | std::shared_ptr<DMatrix> p_fmat{ |
| 656 | DMatrix::Create(static_cast<DataIterHandle>(&iter), iter.Proxy(), Reset, Next, config)}; |
| 657 | return p_fmat; |
| 658 | } |
| 659 | |
| 660 | std::unique_ptr<GradientBooster> CreateTrainedGBM(std::string name, Args kwargs, size_t kRows, |
| 661 | size_t kCols, |