| 795 | } |
| 796 | |
| 797 | void ConfigureNumFeatures() { |
| 798 | // Compute number of global features if parameter not already set |
| 799 | if (mparam_.num_feature == 0) { |
| 800 | // TODO(hcho3): Change num_feature to 64-bit integer |
| 801 | unsigned num_feature = 0; |
| 802 | for (auto const& matrix : prediction_container_.Container()) { |
| 803 | CHECK(matrix.first.ptr); |
| 804 | CHECK(!matrix.second.ref.expired()); |
| 805 | const uint64_t num_col = matrix.first.ptr->Info().num_col_; |
| 806 | error::MaxFeatureSize(num_col); |
| 807 | num_feature = std::max(num_feature, static_cast<uint32_t>(num_col)); |
| 808 | } |
| 809 | |
| 810 | auto rc = |
| 811 | collective::Allreduce(&ctx_, linalg::MakeVec(&num_feature, 1), collective::Op::kMax); |
| 812 | collective::SafeColl(rc); |
| 813 | if (num_feature > mparam_.num_feature) { |
| 814 | mparam_.num_feature = num_feature; |
| 815 | } |
| 816 | } |
| 817 | CHECK_NE(mparam_.num_feature, 0) |
| 818 | << "0 feature is supplied. Are you using raw Booster interface?"; |
| 819 | } |
| 820 | |
| 821 | void ConfigureGBM(LearnerTrainParam const& old, Args const& args) { |
| 822 | tparam_.booster = CanonicalizeBoosterName(tparam_.booster); |