Fix compiler warnings. (#8022)

- Remove/fix unused parameters
- Remove deprecated code in rabit.
- Update dmlc-core.
This commit is contained in:
Jiaming Yuan
2022-06-22 21:29:10 +08:00
committed by GitHub
parent e44a082620
commit 142a208a90
61 changed files with 230 additions and 579 deletions

View File

@@ -29,7 +29,7 @@ void EncodeTreeLeafDevice(Context const* ctx, common::Span<bst_node_t const> pos
thrust::stable_sort_by_key(thrust::cuda::par(alloc), sorted_position.begin(),
sorted_position.begin() + n_samples, p_ridx->begin());
dh::XGBCachingDeviceAllocator<char> caching;
auto beg_pos =
size_t beg_pos =
thrust::find_if(thrust::cuda::par(caching), sorted_position.cbegin(), sorted_position.cend(),
[] XGBOOST_DEVICE(bst_node_t nidx) { return nidx >= 0; }) -
sorted_position.cbegin();
@@ -53,15 +53,15 @@ void EncodeTreeLeafDevice(Context const* ctx, common::Span<bst_node_t const> pos
dh::caching_device_vector<bst_node_t> unique_out(max_n_unique, 0);
auto d_unique_out = dh::ToSpan(unique_out);
size_t nbytes;
size_t nbytes{0};
auto begin_it = sorted_position.begin() + beg_pos;
cub::DeviceRunLengthEncode::Encode(nullptr, nbytes, begin_it, unique_out.data().get(),
counts_out.data().get(), d_num_runs_out.data(),
n_samples - beg_pos);
dh::safe_cuda(cub::DeviceRunLengthEncode::Encode(nullptr, nbytes, begin_it,
unique_out.data().get(), counts_out.data().get(),
d_num_runs_out.data(), n_samples - beg_pos));
dh::TemporaryArray<char> temp(nbytes);
cub::DeviceRunLengthEncode::Encode(temp.data().get(), nbytes, begin_it, unique_out.data().get(),
counts_out.data().get(), d_num_runs_out.data(),
n_samples - beg_pos);
dh::safe_cuda(cub::DeviceRunLengthEncode::Encode(temp.data().get(), nbytes, begin_it,
unique_out.data().get(), counts_out.data().get(),
d_num_runs_out.data(), n_samples - beg_pos));
dh::PinnedMemory pinned_pool;
auto pinned = pinned_pool.GetSpan<char>(sizeof(size_t) + sizeof(bst_node_t));

View File

@@ -70,9 +70,7 @@ class AFTObj : public ObjFunction {
&info.weights_);
}
void GetGradient(const HostDeviceVector<bst_float>& preds,
const MetaInfo& info,
int iter,
void GetGradient(const HostDeviceVector<bst_float>& preds, const MetaInfo& info, int /*iter*/,
HostDeviceVector<GradientPair>* out_gpair) override {
const size_t ndata = preds.Size();
CHECK_EQ(info.labels_lower_bound_.Size(), ndata);
@@ -115,7 +113,7 @@ class AFTObj : public ObjFunction {
.Eval(io_preds);
}
void EvalTransform(HostDeviceVector<bst_float> *io_preds) override {
void EvalTransform(HostDeviceVector<bst_float>* /*io_preds*/) override {
// do nothing here, since the AFT metric expects untransformed prediction score
}

View File

@@ -27,9 +27,7 @@ class HingeObj : public ObjFunction {
void Configure(Args const&) override {}
ObjInfo Task() const override { return ObjInfo::kRegression; }
void GetGradient(const HostDeviceVector<bst_float> &preds,
const MetaInfo &info,
int iter,
void GetGradient(const HostDeviceVector<bst_float> &preds, const MetaInfo &info, int /*iter*/,
HostDeviceVector<GradientPair> *out_gpair) override {
CHECK_NE(info.labels.Size(), 0U) << "label set cannot be empty";
CHECK_EQ(preds.Size(), info.labels.Size())
@@ -86,7 +84,7 @@ class HingeObj : public ObjFunction {
auto& out = *p_out;
out["name"] = String("binary:hinge");
}
void LoadConfig(Json const& in) override {}
void LoadConfig(Json const &) override {}
};
// register the objective functions

View File

@@ -218,7 +218,7 @@ class PseudoHuberRegression : public ObjFunction {
return std::max(static_cast<size_t>(1), info.labels.Shape(1));
}
void GetGradient(HostDeviceVector<bst_float> const& preds, const MetaInfo& info, int iter,
void GetGradient(HostDeviceVector<bst_float> const& preds, const MetaInfo& info, int /*iter*/,
HostDeviceVector<GradientPair>* out_gpair) override {
CheckRegInputs(info, preds);
auto slope = param_.huber_slope;
@@ -672,7 +672,7 @@ class MeanAbsoluteError : public ObjFunction {
void Configure(Args const&) override {}
ObjInfo Task() const override { return {ObjInfo::kRegression, true, true}; }
void GetGradient(HostDeviceVector<bst_float> const& preds, const MetaInfo& info, int iter,
void GetGradient(HostDeviceVector<bst_float> const& preds, const MetaInfo& info, int /*iter*/,
HostDeviceVector<GradientPair>* out_gpair) override {
CheckRegInputs(info, preds);
auto labels = info.labels.View(ctx_->gpu_id);
@@ -721,7 +721,9 @@ class MeanAbsoluteError : public ObjFunction {
out["name"] = String("reg:absoluteerror");
}
void LoadConfig(Json const& in) override {}
void LoadConfig(Json const& in) override {
CHECK_EQ(StringView{get<String const>(in["name"])}, StringView{"reg:absoluteerror"});
}
};
XGBOOST_REGISTER_OBJECTIVE(MeanAbsoluteError, "reg:absoluteerror")