| 21 | |
| 22 | template <typename TREELEARNER_T> |
| 23 | void DataParallelTreeLearner<TREELEARNER_T>::Init(const Dataset* train_data, bool is_constant_hessian) { |
| 24 | // initialize SerialTreeLearner |
| 25 | TREELEARNER_T::Init(train_data, is_constant_hessian); |
| 26 | // Get local rank and global machine size |
| 27 | rank_ = Network::rank(); |
| 28 | num_machines_ = Network::num_machines(); |
| 29 | // allocate buffer for communication |
| 30 | size_t buffer_size = this->train_data_->NumTotalBin() * sizeof(HistogramBinEntry); |
| 31 | |
| 32 | input_buffer_.resize(buffer_size); |
| 33 | output_buffer_.resize(buffer_size); |
| 34 | |
| 35 | is_feature_aggregated_.resize(this->num_features_); |
| 36 | |
| 37 | block_start_.resize(num_machines_); |
| 38 | block_len_.resize(num_machines_); |
| 39 | |
| 40 | buffer_write_start_pos_.resize(this->num_features_); |
| 41 | buffer_read_start_pos_.resize(this->num_features_); |
| 42 | global_data_count_in_leaf_.resize(this->config_->num_leaves); |
| 43 | } |
| 44 | |
| 45 | template <typename TREELEARNER_T> |
| 46 | void DataParallelTreeLearner<TREELEARNER_T>::ResetConfig(const Config* config) { |
no test coverage detected