| 642 | } |
| 643 | |
| 644 | void GPUTreeLearner::SetupKernelArguments() { |
| 645 | // do nothing if no features can be processed on GPU |
| 646 | if (!num_dense_feature_groups_) { |
| 647 | return; |
| 648 | } |
| 649 | for (int i = 0; i <= kMaxLogWorkgroupsPerFeature; ++i) { |
| 650 | // The only argument that needs to be changed later is num_data_ |
| 651 | if (is_constant_hessian_) { |
| 652 | // hessian is passed as a parameter, but it is not available now. |
| 653 | // hessian will be set in BeforeTrain() |
| 654 | histogram_kernels_[i].set_args(*device_features_, device_feature_masks_, num_data_, |
| 655 | *device_data_indices_, num_data_, device_gradients_, 0.0f, |
| 656 | *device_subhistograms_, *sync_counters_, device_histogram_outputs_); |
| 657 | histogram_allfeats_kernels_[i].set_args(*device_features_, device_feature_masks_, num_data_, |
| 658 | *device_data_indices_, num_data_, device_gradients_, 0.0f, |
| 659 | *device_subhistograms_, *sync_counters_, device_histogram_outputs_); |
| 660 | histogram_fulldata_kernels_[i].set_args(*device_features_, device_feature_masks_, num_data_, |
| 661 | *device_data_indices_, num_data_, device_gradients_, 0.0f, |
| 662 | *device_subhistograms_, *sync_counters_, device_histogram_outputs_); |
| 663 | } else { |
| 664 | histogram_kernels_[i].set_args(*device_features_, device_feature_masks_, num_data_, |
| 665 | *device_data_indices_, num_data_, device_gradients_, device_hessians_, |
| 666 | *device_subhistograms_, *sync_counters_, device_histogram_outputs_); |
| 667 | histogram_allfeats_kernels_[i].set_args(*device_features_, device_feature_masks_, num_data_, |
| 668 | *device_data_indices_, num_data_, device_gradients_, device_hessians_, |
| 669 | *device_subhistograms_, *sync_counters_, device_histogram_outputs_); |
| 670 | histogram_fulldata_kernels_[i].set_args(*device_features_, device_feature_masks_, num_data_, |
| 671 | *device_data_indices_, num_data_, device_gradients_, device_hessians_, |
| 672 | *device_subhistograms_, *sync_counters_, device_histogram_outputs_); |
| 673 | } |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | void GPUTreeLearner::InitGPU(int platform_id, int device_id) { |
| 678 | // Get the max bin size, used for selecting best GPU kernel |