| 95 | } |
| 96 | |
| 97 | NCatboostCuda::TTreeCtrDataSetsHelper::TTreeCtrDataSetsHelper(const NCatboostCuda::TFeatureParallelDataSet& dataSet, |
| 98 | const NCatboostCuda::TBinarizedFeaturesManager& featuresManager, |
| 99 | ui32 maxDepth, ui32 foldCount, |
| 100 | NCatboostCuda::TFeatureTensorTracker& emptyTracker) |
| 101 | : DataSet(dataSet) |
| 102 | , FeaturesManager(featuresManager) |
| 103 | , EmptyTracker(emptyTracker.Copy()) |
| 104 | , PureTreeCtrTensorTracker(emptyTracker.Copy()) |
| 105 | , MaxDepth(maxDepth) |
| 106 | , FoldCount(foldCount) |
| 107 | { |
| 108 | DepthPermutations.resize(1); |
| 109 | if (LevelBasedCompressedIndex) { |
| 110 | DepthPermutations[0] = dataSet.GetIndices().ConstCopyView(); |
| 111 | } else { |
| 112 | auto tmp = TMirrorBuffer<ui32>::CopyMapping(dataSet.GetIndices()); |
| 113 | MakeSequence(tmp, 0u); |
| 114 | DepthPermutations[0] = tmp.ConstCopyView(); |
| 115 | } |
| 116 | const auto& manager = NCudaLib::GetCudaManager(); |
| 117 | const ui32 devCount = manager.GetDeviceCount(); |
| 118 | DataSets.resize(devCount); |
| 119 | PureTreeCtrDataSets.resize(devCount); |
| 120 | PackSizeEstimators.resize(devCount); |
| 121 | NCudaLib::GetCudaManager().WaitComplete(); |
| 122 | for (ui32 dev = 0; dev < devCount; ++dev) { |
| 123 | auto freeMemory = manager.FreeMemoryMb(dev, false); |
| 124 | PackSizeEstimators[dev] = (MakeHolder<TTreeCtrDataSetMemoryUsageEstimator>(featuresManager, |
| 125 | freeMemory, |
| 126 | dataSet.GetCatFeatures().GetFeatureCount(dev), |
| 127 | FoldCount, |
| 128 | MaxDepth, |
| 129 | static_cast<const ui32>(dataSet.GetDataProvider().GetObjectCount()), |
| 130 | dataSet.GetCatFeatures().GetStorageType() == EGpuCatFeaturesStorage::GpuRam |
| 131 | ? NCudaLib::EPtrType::CudaDevice |
| 132 | : NCudaLib::EPtrType::CudaHost)); |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | void NCatboostCuda::TTreeCtrDataSetsHelper::AddSplit(const NCatboostCuda::TBinarySplit& split, |
| 137 | const TMirrorBuffer<ui32>& docBins) { |
nothing calls this directly
no test coverage detected