MCPcopy Create free account
hub / github.com/catboost/catboost / AddDataSetPacks

Method AddDataSetPacks

catboost/cuda/methods/tree_ctrs.cpp:306–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304}
305
306void NCatboostCuda::TTreeCtrDataSetsHelper::AddDataSetPacks(const NCatboostCuda::TFeatureTensor& baseTensor,
307 const TSingleBuffer<const ui32>& baseTensorIndices,
308 ui32 deviceId,
309 TVector<NCatboostCuda::TTreeCtrDataSetsHelper::TTreeCtrDataSetPtr>& dst) {
310 const auto& catFeatures = DataSet.GetCatFeatures();
311 auto& devFeatures = catFeatures.GetDeviceFeatures(deviceId);
312 if (devFeatures.size() == 0) {
313 return;
314 }
315 const ui32 maxPackSize = PackSizeEstimators[deviceId]->GetMaxPackSize();
316 CB_ENSURE(maxPackSize, "Error: not enough memory for building ctrs");
317
318 const ui32 currentDstSize = static_cast<const ui32>(dst.size());
319 dst.push_back(MakeHolder<TTreeCtrDataSet>(FeaturesManager,
320 baseTensor,
321 baseTensorIndices));
322
323 ui32 packSize = 0;
324 for (auto feature : devFeatures) {
325 auto& nextDataSet = dst.back();
326 auto tensor = baseTensor;
327 tensor.AddCatFeature(feature);
328 if (tensor == baseTensor || !FeaturesManager.UseForTreeCtr(tensor)) {
329 continue;
330 }
331 nextDataSet->AddCatFeature(feature);
332 ++packSize;
333
334 if (packSize >= maxPackSize) {
335 dst.push_back(MakeHolder<TTreeCtrDataSet>(FeaturesManager,
336 baseTensor,
337 baseTensorIndices));
338 packSize = 0;
339 }
340 }
341
342 if (dst.back()->CatFeatures.size() == 0) {
343 dst.pop_back();
344 }
345 for (ui32 i = currentDstSize; i < dst.size(); ++i) {
346 dst[i]->BuildFeatureIndex();
347 }
348}
349
350NCatboostCuda::TFeatureTensorTracker NCatboostCuda::TTreeCtrDataSetsHelper::CreateEmptyTrackerForTensor(const NCatboostCuda::TFeatureTensor& tensor) {
351 ui64 maxSize = 0;

Callers

nothing calls this directly

Calls 9

GetCatFeaturesMethod · 0.80
GetMaxPackSizeMethod · 0.80
UseForTreeCtrMethod · 0.80
BuildFeatureIndexMethod · 0.80
sizeMethod · 0.45
push_backMethod · 0.45
backMethod · 0.45
AddCatFeatureMethod · 0.45
pop_backMethod · 0.45

Tested by

no test coverage detected