11/* *
2- * Copyright 2020-2024 , XGBoost Contributors
2+ * Copyright 2020-2025 , XGBoost Contributors
33 */
44#include < thrust/binary_search.h>
55#include < thrust/execution_policy.h>
@@ -565,6 +565,8 @@ void SketchContainer::AllReduce(Context const* ctx, bool is_column_split) {
565565 allworkers.emplace_back (sketch);
566566 offset += length_as_bytes;
567567 }
568+ // Stop the timer early to avoid interference from the new sketch container.
569+ timer_.Stop (__func__);
568570
569571 // Merge them into a new sketch.
570572 SketchContainer new_sketch (this ->feature_types_ , num_bins_, this ->num_columns_ , global_sum_rows,
@@ -578,7 +580,6 @@ void SketchContainer::AllReduce(Context const* ctx, bool is_column_split) {
578580 }
579581
580582 *this = std::move (new_sketch);
581- timer_.Stop (__func__);
582583}
583584
584585namespace {
@@ -595,13 +596,13 @@ struct InvalidCatOp {
595596} // anonymous namespace
596597
597598void SketchContainer::MakeCuts (Context const * ctx, HistogramCuts* p_cuts, bool is_column_split) {
598- timer_.Start (__func__);
599599 curt::SetDevice (ctx->Ordinal ());
600600 p_cuts->min_vals_ .Resize (num_columns_);
601601
602602 // Sync between workers.
603603 this ->AllReduce (ctx, is_column_split);
604604
605+ timer_.Start (__func__);
605606 // Prune to final number of bins.
606607 this ->Prune (ctx, num_bins_ + 1 );
607608 this ->FixError ();
0 commit comments