| 269 | |
| 270 | template <class TMapping> |
| 271 | void CheckStats(const TOptimizationSubsets<TMapping>& subsets, |
| 272 | const TVector<float>& gatheredTarget, |
| 273 | const TVector<float>& gatheredWeights, |
| 274 | const TCudaBuffer<TPartitionStatistics, TMapping>& partStats) { |
| 275 | auto currentParts = TSubsetsHelper<TMapping>::CurrentPartsView(subsets); |
| 276 | |
| 277 | for (ui32 dev = 0; dev < NCudaLib::GetCudaManager().GetDeviceCount(); ++dev) { |
| 278 | TVector<TPartitionStatistics> cpuStat; |
| 279 | partStats.DeviceView(dev).Read(cpuStat); |
| 280 | |
| 281 | TVector<TDataPartition> cpuParts; |
| 282 | auto devSlice = subsets.Indices.GetMapping().DeviceSlice(dev); |
| 283 | auto devParts = currentParts.DeviceView(dev); |
| 284 | devParts.Read(cpuParts); |
| 285 | // currentParts.Read(cpuParts); |
| 286 | |
| 287 | { |
| 288 | for (ui32 partId = 0; partId < cpuParts.size(); ++partId) { |
| 289 | auto& part = cpuParts[partId]; |
| 290 | |
| 291 | double sum = 0; |
| 292 | double weight = 0; |
| 293 | |
| 294 | for (ui32 i = 0; i < part.Size; ++i) { |
| 295 | sum += gatheredTarget[devSlice.Left + part.Offset + i]; |
| 296 | weight += gatheredWeights[devSlice.Left + part.Offset + i]; |
| 297 | } |
| 298 | |
| 299 | UNIT_ASSERT_DOUBLES_EQUAL_C(cpuStat[partId].Weight, weight, 1e-5, "PartCount " << cpuParts.size() << " device " << dev); |
| 300 | UNIT_ASSERT_DOUBLES_EQUAL(cpuStat[partId].Sum, sum, 1e-5); |
| 301 | } |
| 302 | } |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | template <class TLayout = TFeatureParallelLayout> |
| 307 | void CheckResultsForCompressedDataSet(const typename TSharedCompressedIndex<TLayout>::TCompressedDataSet& features, |
no test coverage detected