Remove omp_get_max_threads in objective. (#7589)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Copyright 2019-2020 by Contributors
|
||||
* Copyright 2019-2022 by Contributors
|
||||
* \file aft_obj.cu
|
||||
* \brief Definition of AFT loss for survival analysis.
|
||||
* \author Avinash Barnwal, Hyunsu Cho and Toby Hocking
|
||||
@@ -65,7 +65,7 @@ class AFTObj : public ObjFunction {
|
||||
const bst_float w = is_null_weight ? 1.0f : _weights[_idx];
|
||||
_out_gpair[_idx] = GradientPair(grad * w, hess * w);
|
||||
},
|
||||
common::Range{0, static_cast<int64_t>(ndata)}, device).Eval(
|
||||
common::Range{0, static_cast<int64_t>(ndata)}, this->ctx_->Threads(), device).Eval(
|
||||
out_gpair, &preds, &info.labels_lower_bound_, &info.labels_upper_bound_,
|
||||
&info.weights_);
|
||||
}
|
||||
@@ -78,7 +78,7 @@ class AFTObj : public ObjFunction {
|
||||
CHECK_EQ(info.labels_lower_bound_.Size(), ndata);
|
||||
CHECK_EQ(info.labels_upper_bound_.Size(), ndata);
|
||||
out_gpair->Resize(ndata);
|
||||
const int device = tparam_->gpu_id;
|
||||
const int device = ctx_->gpu_id;
|
||||
const float aft_loss_distribution_scale = param_.aft_loss_distribution_scale;
|
||||
const bool is_null_weight = info.weights_.Size() == 0;
|
||||
if (!is_null_weight) {
|
||||
@@ -108,10 +108,11 @@ class AFTObj : public ObjFunction {
|
||||
// Trees give us a prediction in log scale, so exponentiate
|
||||
common::Transform<>::Init(
|
||||
[] XGBOOST_DEVICE(size_t _idx, common::Span<bst_float> _preds) {
|
||||
_preds[_idx] = exp(_preds[_idx]);
|
||||
}, common::Range{0, static_cast<int64_t>(io_preds->Size())},
|
||||
_preds[_idx] = exp(_preds[_idx]);
|
||||
},
|
||||
common::Range{0, static_cast<int64_t>(io_preds->Size())}, this->ctx_->Threads(),
|
||||
io_preds->DeviceIdx())
|
||||
.Eval(io_preds);
|
||||
.Eval(io_preds);
|
||||
}
|
||||
|
||||
void EvalTransform(HostDeviceVector<bst_float> *io_preds) override {
|
||||
|
||||
Reference in New Issue
Block a user