| 410 | |
| 411 | namespace { |
| 412 | void DoPropertyDistributedQuantile(ContainerCase const& c) { |
| 413 | Context ctx; |
| 414 | auto const world = collective::GetWorldSize(); |
| 415 | auto ft = FeatureTypes(c); |
| 416 | auto rank = collective::GetRank(); |
| 417 | auto full_m = RandomDataGenerator{c.rows * static_cast<std::size_t>(world), c.cols, c.sparsity} |
| 418 | .Seed(c.seed) |
| 419 | .Lower(.0f) |
| 420 | .Upper(1.0f) |
| 421 | .Type(ft) |
| 422 | .MaxCategory(13) |
| 423 | .GenerateDMatrix(); |
| 424 | if (c.weights == WeightKind::kRow) { |
| 425 | full_m->Info().weights_.HostVector() = |
| 426 | GenerateWeights(c.rows * static_cast<std::size_t>(world), c.seed + 4096); |
| 427 | } |
| 428 | std::vector<std::int32_t> ridxs(c.rows); |
| 429 | auto row_begin = static_cast<std::size_t>(rank) * c.rows; |
| 430 | std::iota(ridxs.begin(), ridxs.end(), static_cast<std::int32_t>(row_begin)); |
| 431 | std::shared_ptr<DMatrix> m{full_m->Slice(Span<std::int32_t const>{ridxs.data(), ridxs.size()})}; |
| 432 | |
| 433 | std::vector<bst_idx_t> column_size(c.cols, c.rows); |
| 434 | std::vector<float> hessian(c.rows, 1.0f); |
| 435 | auto hess = Span<float const>{hessian}; |
| 436 | HostSketchContainer row_sketch(&ctx, c.max_bin, m->Info().feature_types.ConstHostSpan(), |
| 437 | column_size, false); |
| 438 | for (auto const& page : m->GetBatches<SparsePage>(&ctx)) { |
| 439 | row_sketch.PushRowPage(page, m->Info(), hess); |
| 440 | } |
| 441 | auto row_cuts = row_sketch.MakeCuts(&ctx, m->Info()); |
| 442 | |
| 443 | HostSketchContainer sorted_sketch(&ctx, c.max_bin, m->Info().feature_types.ConstHostSpan(), |
| 444 | column_size, false); |
| 445 | for (auto const& page : m->GetBatches<SortedCSCPage>(&ctx)) { |
| 446 | sorted_sketch.PushColPage(page, m->Info(), hess); |
| 447 | } |
| 448 | auto sorted_cuts = sorted_sketch.MakeCuts(&ctx, m->Info()); |
| 449 | |
| 450 | collective::Finalize(); |
| 451 | CHECK_EQ(collective::GetWorldSize(), 1); |
| 452 | auto columns = CollectWeightedColumns(full_m.get()); |
| 453 | ValidateContainerCuts(c, row_cuts, full_m.get(), columns); |
| 454 | ValidateContainerCuts(c, sorted_cuts, full_m.get(), columns); |
| 455 | } |
| 456 | |
| 457 | void DoSameOnAllWorkersDistributedQuantile(ContainerCase const& c) { |
| 458 | Context ctx; |
no test coverage detected