| 1068 | } |
| 1069 | |
| 1070 | void GPUTreeLearner::Split(Tree* tree, int best_Leaf, int* left_leaf, int* right_leaf) { |
| 1071 | const SplitInfo& best_split_info = best_split_per_leaf_[best_Leaf]; |
| 1072 | #if GPU_DEBUG >= 2 |
| 1073 | printf("Splitting leaf %d with feature %d thresh %d gain %f stat %f %f %f %f\n", best_Leaf, best_split_info.feature, best_split_info.threshold, best_split_info.gain, best_split_info.left_sum_gradient, best_split_info.right_sum_gradient, best_split_info.left_sum_hessian, best_split_info.right_sum_hessian); |
| 1074 | #endif |
| 1075 | SerialTreeLearner::Split(tree, best_Leaf, left_leaf, right_leaf); |
| 1076 | if (Network::num_machines() == 1) { |
| 1077 | // do some sanity check for the GPU algorithm |
| 1078 | if (best_split_info.left_count < best_split_info.right_count) { |
| 1079 | if ((best_split_info.left_count != smaller_leaf_splits_->num_data_in_leaf()) || |
| 1080 | (best_split_info.right_count!= larger_leaf_splits_->num_data_in_leaf())) { |
| 1081 | Log::Fatal("Bug in GPU histogram! split %d: %d, smaller_leaf: %d, larger_leaf: %d\n", best_split_info.left_count, best_split_info.right_count, smaller_leaf_splits_->num_data_in_leaf(), larger_leaf_splits_->num_data_in_leaf()); |
| 1082 | } |
| 1083 | } else { |
| 1084 | double smaller_min = smaller_leaf_splits_->min_constraint(); |
| 1085 | double smaller_max = smaller_leaf_splits_->max_constraint(); |
| 1086 | double larger_min = larger_leaf_splits_->min_constraint(); |
| 1087 | double larger_max = larger_leaf_splits_->max_constraint(); |
| 1088 | smaller_leaf_splits_->Init(*right_leaf, data_partition_.get(), best_split_info.right_sum_gradient, best_split_info.right_sum_hessian); |
| 1089 | larger_leaf_splits_->Init(*left_leaf, data_partition_.get(), best_split_info.left_sum_gradient, best_split_info.left_sum_hessian); |
| 1090 | smaller_leaf_splits_->SetValueConstraint(smaller_min, smaller_max); |
| 1091 | larger_leaf_splits_->SetValueConstraint(larger_min, larger_max); |
| 1092 | if ((best_split_info.left_count != larger_leaf_splits_->num_data_in_leaf()) || |
| 1093 | (best_split_info.right_count!= smaller_leaf_splits_->num_data_in_leaf())) { |
| 1094 | Log::Fatal("Bug in GPU histogram! split %d: %d, smaller_leaf: %d, larger_leaf: %d\n", best_split_info.left_count, best_split_info.right_count, smaller_leaf_splits_->num_data_in_leaf(), larger_leaf_splits_->num_data_in_leaf()); |
| 1095 | } |
| 1096 | } |
| 1097 | } |
| 1098 | } |
| 1099 | |
| 1100 | } // namespace LightGBM |
| 1101 | #endif // USE_GPU |
nothing calls this directly
no test coverage detected