Get rid of a few trivial compiler warnings. (#4312)

This commit is contained in:
Hajime Morrita 2019-03-30 09:02:29 -07:00 committed by Jiaming Yuan
parent ad4de0d718
commit 680a1b36f3
5 changed files with 4 additions and 6 deletions

View File

@ -624,7 +624,7 @@ XGB_DLL int XGDMatrixCreateFromDT(void** data, const char** feature_stypes,
#pragma omp parallel num_threads(nthread)
{
// Count elements per row, column by column
for (auto j = 0; j < ncol; ++j) {
for (auto j = 0u; j < ncol; ++j) {
DTType dtype = DTGetType(feature_stypes[j]);
#pragma omp for schedule(static)
for (omp_ulong i = 0; i < nrow; ++i) {

View File

@ -81,12 +81,12 @@ float SparsePageDMatrix::GetColDensity(size_t cidx) {
if (col_density_.empty()) {
std::vector<size_t> column_size(this->Info().num_col_);
for (const auto &batch : this->GetColumnBatches()) {
for (int i = 0; i < batch.Size(); i++) {
for (auto i = 0u; i < batch.Size(); i++) {
column_size[i] += batch[i].size();
}
}
col_density_.resize(column_size.size());
for (int i = 0; i < col_density_.size(); i++) {
for (auto i = 0u; i < col_density_.size(); i++) {
size_t nmiss = this->Info().num_row_ - column_size[i];
col_density_[i] =
1.0f - (static_cast<float>(nmiss)) / this->Info().num_row_;

View File

@ -331,7 +331,6 @@ class BaseMaker: public TreeUpdater {
std::vector< std::vector<TStats> > *p_thread_temp,
std::vector<TStats> *p_node_stats) {
std::vector< std::vector<TStats> > &thread_temp = *p_thread_temp;
const MetaInfo &info = fmat.Info();
thread_temp.resize(omp_get_max_threads());
p_node_stats->resize(tree.param.num_nodes);
#pragma omp parallel

View File

@ -245,7 +245,6 @@ class ColMaker: public TreeUpdater {
DMatrix *p_fmat,
const std::vector<GradientPair> &gpair) {
// TODO(tqchen): double check stats order.
const MetaInfo& info = p_fmat->Info();
const bool ind = col.size() != 0 && col[0].fvalue == col[col.size() - 1].fvalue;
bool need_forward = param_.NeedForwardSearch(p_fmat->GetColDensity(fid), ind);
bool need_backward = param_.NeedBackwardSearch(p_fmat->GetColDensity(fid), ind);

View File

@ -140,7 +140,7 @@ class SketchMaker: public BaseMaker {
this->UpdateSketchCol(gpair, batch[fidx], tree,
node_stats_,
fidx,
batch[fidx].size() == nrows,
static_cast<size_t>(batch[fidx].size()) == nrows,
&thread_sketch_[omp_get_thread_num()]);
}
}