| 70 | |
| 71 | |
| 72 | void CompareHistograms(HistogramBinEntry* h1, HistogramBinEntry* h2, size_t size, int feature_id) { |
| 73 | size_t i; |
| 74 | Float_t a, b; |
| 75 | for (i = 0; i < size; ++i) { |
| 76 | a.f = h1[i].sum_gradients; |
| 77 | b.f = h2[i].sum_gradients; |
| 78 | int32_t ulps = Float_t::ulp_diff(a, b); |
| 79 | if (fabs(h1[i].cnt - h2[i].cnt != 0)) { |
| 80 | printf("%d != %d\n", h1[i].cnt, h2[i].cnt); |
| 81 | goto err; |
| 82 | } |
| 83 | if (ulps > 0) { |
| 84 | // printf("grad %g != %g (%d ULPs)\n", h1[i].sum_gradients, h2[i].sum_gradients, ulps); |
| 85 | // goto err; |
| 86 | } |
| 87 | a.f = h1[i].sum_hessians; |
| 88 | b.f = h2[i].sum_hessians; |
| 89 | ulps = Float_t::ulp_diff(a, b); |
| 90 | if (ulps > 0) { |
| 91 | // printf("hessian %g != %g (%d ULPs)\n", h1[i].sum_hessians, h2[i].sum_hessians, ulps); |
| 92 | // goto err; |
| 93 | } |
| 94 | } |
| 95 | return; |
| 96 | err: |
| 97 | Log::Warning("Mismatched histograms found for feature %d at location %lu.", feature_id, i); |
| 98 | std::cin.get(); |
| 99 | PrintHistograms(h1, size); |
| 100 | printf("\n"); |
| 101 | PrintHistograms(h2, size); |
| 102 | std::cin.get(); |
| 103 | } |
| 104 | #endif |
| 105 | |
| 106 | int GPUTreeLearner::GetNumWorkgroupsPerFeature(data_size_t leaf_num_data) { |
no test coverage detected