Skip to content

Commit 8c94e75

Browse files
authored
Fix timer nvtx annotation for distributed training. (dmlc#11276)
1 parent 853e3d5 commit 8c94e75

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/common/quantile.cu

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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

584585
namespace {
@@ -595,13 +596,13 @@ struct InvalidCatOp {
595596
} // anonymous namespace
596597

597598
void 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();

src/data/batch_utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2023-2024, XGBoost Contributors
2+
* Copyright 2023-2025, XGBoost Contributors
33
*/
44
#ifndef XGBOOST_DATA_BATCH_UTILS_H_
55
#define XGBOOST_DATA_BATCH_UTILS_H_
@@ -43,7 +43,7 @@ constexpr std::int64_t MatchingPageBytes() { return 0; }
4343
constexpr std::int32_t MaxNumDevicePages() { return 1; }
4444
// Default size of the cached page
4545
constexpr double CachePageRatio() { return 0.125; }
46-
// Indicator for XGBoost to not concatenate any page.
46+
// Indicator for XGBoost to automatically concatenate pages.
4747
constexpr std::int64_t AutoCachePageBytes() { return -1; }
4848
// Use two batch for prefecting. There's always one batch being worked on, while the other
4949
// batch being transferred.

0 commit comments

Comments
 (0)