MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / CompareHistograms

Function CompareHistograms

src/treelearner/gpu_tree_learner.cpp:72–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70
71
72void 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;
96err:
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
106int GPUTreeLearner::GetNumWorkgroupsPerFeature(data_size_t leaf_num_data) {

Callers 1

ConstructHistogramsMethod · 0.70

Calls 3

ulp_diffFunction · 0.70
PrintHistogramsFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected