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 @@ FeatureGroups::FeatureGroups(const common::HistogramCuts& cuts, bool is_dense,
bin_segments_h.push_back(0);
const std::vector<uint32_t>& cut_ptrs = cuts.Ptrs();
int max_shmem_bins = shm_size / bin_size;
size_t max_shmem_bins = shm_size / bin_size;
max_group_bins = 0;
for (size_t i = 2; i < cut_ptrs.size(); ++i) {

View File

@@ -188,7 +188,7 @@ void BuildGradientHistogram(EllpackDeviceAccessor const& matrix,
int device = 0;
dh::safe_cuda(cudaGetDevice(&device));
// opt into maximum shared memory for the kernel if necessary
int max_shared_memory = dh::MaxSharedMemoryOptin(device);
size_t max_shared_memory = dh::MaxSharedMemoryOptin(device);
size_t smem_size = sizeof(typename HistRounding<GradientSumT>::SharedSumT) *
feature_groups.max_group_bins;

View File

@@ -79,6 +79,7 @@ void RowPartitioner::SortPosition(common::Span<bst_node_t> position,
void Reset(int device_idx, common::Span<RowPartitioner::RowIndexT> ridx,
common::Span<bst_node_t> position) {
dh::safe_cuda(cudaSetDevice(device_idx));
CHECK_EQ(ridx.size(), position.size());
dh::LaunchN(ridx.size(), [=] __device__(size_t idx) {
ridx[idx] = idx;
@@ -92,7 +93,7 @@ RowPartitioner::RowPartitioner(int device_idx, size_t num_rows)
dh::safe_cuda(cudaSetDevice(device_idx_));
ridx_ = dh::DoubleBuffer<RowIndexT>{&ridx_a_, &ridx_b_};
position_ = dh::DoubleBuffer<bst_node_t>{&position_a_, &position_b_};
ridx_segments_.emplace_back(Segment(0, num_rows));
ridx_segments_.emplace_back(static_cast<size_t>(0), num_rows);
Reset(device_idx, ridx_.CurrentSpan(), position_.CurrentSpan());
left_counts_.resize(256);

View File

@@ -140,9 +140,7 @@ class HistogramBuilder {
nodes_for_subtraction_trick,
starting_index, sync_count);
} else {
this->SyncHistogramLocal(p_tree, nodes_for_explicit_hist_build,
nodes_for_subtraction_trick, starting_index,
sync_count);
this->SyncHistogramLocal(p_tree, nodes_for_explicit_hist_build, nodes_for_subtraction_trick);
}
}
/** same as the other build hist but handles only single batch data (in-core) */
@@ -211,11 +209,9 @@ class HistogramBuilder {
nodes_for_explicit_hist_build, p_tree);
}
void SyncHistogramLocal(
RegTree *p_tree,
std::vector<ExpandEntry> const &nodes_for_explicit_hist_build,
std::vector<ExpandEntry> const &nodes_for_subtraction_trick,
int starting_index, int sync_count) {
void SyncHistogramLocal(RegTree *p_tree,
std::vector<ExpandEntry> const &nodes_for_explicit_hist_build,
std::vector<ExpandEntry> const &nodes_for_subtraction_trick) {
const size_t nbins = this->builder_.GetNumBins();
common::BlockedSpace2d space(
nodes_for_explicit_hist_build.size(), [&](size_t) { return nbins; },

View File

@@ -92,14 +92,14 @@ void ParseInteractionConstraint(
for (size_t i = 0; i < all.size(); ++i) {
auto const &set = get<Array const>(all[i]);
for (auto const &v : set) {
if (XGBOOST_EXPECT(IsA<Integer>(v), true)) {
uint32_t u = static_cast<uint32_t const>(get<Integer const>(v));
if (XGBOOST_EXPECT(IsA<Integer const>(v), true)) {
auto u = static_cast<bst_feature_t>(get<Integer const>(v));
out[i].emplace_back(u);
} else if (IsA<Number>(v)) {
double d = get<Number const>(v);
CHECK_EQ(std::floor(d), d)
<< "Found floating point number in interaction constraints";
out[i].emplace_back(static_cast<uint32_t const>(d));
out[i].emplace_back(static_cast<uint32_t>(d));
} else {
LOG(FATAL) << "Unknown value type for interaction constraint:"
<< v.GetValue().TypeStr();

View File

@@ -354,10 +354,10 @@ class TextGenerator : public TreeGenerator {
};
XGBOOST_REGISTER_TREE_IO(TextGenerator, "text")
.describe("Dump text representation of tree")
.set_body([](FeatureMap const& fmap, std::string const& attrs, bool with_stats) {
return new TextGenerator(fmap, with_stats);
});
.describe("Dump text representation of tree")
.set_body([](FeatureMap const& fmap, std::string const& /*attrs*/, bool with_stats) {
return new TextGenerator(fmap, with_stats);
});
class JsonGenerator : public TreeGenerator {
using SuperT = TreeGenerator;
@@ -510,10 +510,10 @@ class JsonGenerator : public TreeGenerator {
};
XGBOOST_REGISTER_TREE_IO(JsonGenerator, "json")
.describe("Dump json representation of tree")
.set_body([](FeatureMap const& fmap, std::string const& attrs, bool with_stats) {
return new JsonGenerator(fmap, with_stats);
});
.describe("Dump json representation of tree")
.set_body([](FeatureMap const& fmap, std::string const& /*attrs*/, bool with_stats) {
return new JsonGenerator(fmap, with_stats);
});
struct GraphvizParam : public XGBoostParameter<GraphvizParam> {
std::string yes_color;

View File

@@ -98,7 +98,7 @@ class ColMaker: public TreeUpdater {
}
void Update(HostDeviceVector<GradientPair> *gpair, DMatrix *dmat,
common::Span<HostDeviceVector<bst_node_t>> out_position,
common::Span<HostDeviceVector<bst_node_t>> /*out_position*/,
const std::vector<RegTree *> &trees) override {
if (rabit::IsDistributed()) {
LOG(FATAL) << "Updater `grow_colmaker` or `exact` tree method doesn't "

View File

@@ -42,7 +42,7 @@ class TreeRefresher : public TreeUpdater {
}
// update the tree, do pruning
void Update(HostDeviceVector<GradientPair> *gpair, DMatrix *p_fmat,
common::Span<HostDeviceVector<bst_node_t>> out_position,
common::Span<HostDeviceVector<bst_node_t>> /*out_position*/,
const std::vector<RegTree *> &trees) override {
if (trees.size() == 0) return;
const std::vector<GradientPair> &gpair_h = gpair->ConstHostVector();

View File

@@ -33,7 +33,7 @@ class TreeSyncher : public TreeUpdater {
}
void Update(HostDeviceVector<GradientPair>*, DMatrix*,
common::Span<HostDeviceVector<bst_node_t>> out_position,
common::Span<HostDeviceVector<bst_node_t>> /*out_position*/,
const std::vector<RegTree*>& trees) override {
if (rabit::GetWorldSize() == 1) return;
std::string s_model;