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

Function SyncFeatureType

src/data/quantile_dmatrix.cc:68–85  ·  view source on GitHub ↗

Synchronize feature type in case of empty DMatrix

Source from the content-addressed store, hash-verified

66namespace cpu_impl {
67// Synchronize feature type in case of empty DMatrix
68void SyncFeatureType(Context const* ctx, std::vector<FeatureType>* p_h_ft) {
69 if (!collective::IsDistributed()) {
70 return;
71 }
72 auto& h_ft = *p_h_ft;
73 bst_idx_t n_ft = h_ft.size();
74 collective::SafeColl(collective::Allreduce(ctx, &n_ft, collective::Op::kMax));
75 if (!h_ft.empty()) {
76 // Check correct size if this is not an empty DMatrix.
77 CHECK_EQ(h_ft.size(), n_ft);
78 }
79 if (n_ft > 0) {
80 h_ft.resize(n_ft);
81 auto ptr = reinterpret_cast<std::underlying_type_t<FeatureType>*>(h_ft.data());
82 collective::SafeColl(
83 collective::Allreduce(ctx, linalg::MakeVec(ptr, h_ft.size()), collective::Op::kMax));
84 }
85}
86
87void GetDataShape(Context const* ctx, DMatrixProxy* proxy,
88 DataIterProxy<DataIterResetCallback, XGDMatrixCallbackNext>* iter, float missing,

Callers 1

MakeSketchesFunction · 0.85

Calls 8

IsDistributedFunction · 0.85
SafeCollFunction · 0.85
MakeVecFunction · 0.85
resizeMethod · 0.80
AllreduceFunction · 0.50
sizeMethod · 0.45
emptyMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected