fix windows warnings
This commit is contained in:
parent
9527b55f35
commit
18277086d9
@ -6,10 +6,11 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef XGBOOST_IO_LIBSVM_PARSER_H_
|
#ifndef XGBOOST_IO_LIBSVM_PARSER_H_
|
||||||
#define XGBOOST_IO_LIBSVM_PARSER_H_
|
#define XGBOOST_IO_LIBSVM_PARSER_H_
|
||||||
|
#define NOMINMAX
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
#include <algorithm>
|
||||||
#include "../utils/omp.h"
|
#include "../utils/omp.h"
|
||||||
#include "../utils/utils.h"
|
#include "../utils/utils.h"
|
||||||
#include "../sync/sync.h"
|
#include "../sync/sync.h"
|
||||||
@ -120,12 +121,12 @@ class LibSVMPageFactory {
|
|||||||
while (isdigit(*p) && p != end) ++p;
|
while (isdigit(*p) && p != end) ++p;
|
||||||
if (*p == ':') {
|
if (*p == ':') {
|
||||||
out->data.push_back(SparseBatch::Entry(atol(head),
|
out->data.push_back(SparseBatch::Entry(atol(head),
|
||||||
atof(p + 1)));
|
static_cast<bst_float>(atof(p + 1))));
|
||||||
} else {
|
} else {
|
||||||
if (out->label.size() != 0) {
|
if (out->label.size() != 0) {
|
||||||
out->offset.push_back(out->data.size());
|
out->offset.push_back(out->data.size());
|
||||||
}
|
}
|
||||||
out->label.push_back(atof(head));
|
out->label.push_back(static_cast<float>(atof(head)));
|
||||||
}
|
}
|
||||||
while (!isspace(*p) && p != end) ++p;
|
while (!isspace(*p) && p != end) ++p;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class ThreadColPageIterator: public utils::IIterator<ColBatch> {
|
|||||||
for (size_t i = 0; i < col_data_.size(); ++i) {
|
for (size_t i = 0; i < col_data_.size(); ++i) {
|
||||||
col_data_[i] = SparseBatch::Inst
|
col_data_[i] = SparseBatch::Inst
|
||||||
(BeginPtr(page_->data) + page_->offset[i],
|
(BeginPtr(page_->data) + page_->offset[i],
|
||||||
page_->offset[i + 1] - page_->offset[i]);
|
static_cast<bst_uint>(page_->offset[i + 1] - page_->offset[i]));
|
||||||
}
|
}
|
||||||
out_.col_data = BeginPtr(col_data_);
|
out_.col_data = BeginPtr(col_data_);
|
||||||
out_.size = col_data_.size();
|
out_.size = col_data_.size();
|
||||||
@ -110,7 +110,7 @@ class FMatrixPage : public IFMatrix {
|
|||||||
size_t ncol = this->NumCol();
|
size_t ncol = this->NumCol();
|
||||||
col_index_.resize(0);
|
col_index_.resize(0);
|
||||||
for (size_t i = 0; i < ncol; ++i) {
|
for (size_t i = 0; i < ncol; ++i) {
|
||||||
col_index_.push_back(i);
|
col_index_.push_back(static_cast<bst_uint>(i));
|
||||||
}
|
}
|
||||||
col_iter_.SetIndexSet(col_index_, false);
|
col_iter_.SetIndexSet(col_index_, false);
|
||||||
col_iter_.BeforeFirst();
|
col_iter_.BeforeFirst();
|
||||||
@ -229,7 +229,7 @@ class FMatrixPage : public IFMatrix {
|
|||||||
#pragma omp parallel for schedule(static)
|
#pragma omp parallel for schedule(static)
|
||||||
for (bst_omp_uint i = 0; i < ndata; ++i) {
|
for (bst_omp_uint i = 0; i < ndata; ++i) {
|
||||||
int tid = omp_get_thread_num();
|
int tid = omp_get_thread_num();
|
||||||
for (bst_uint j = prow.offset[i]; j < prow.offset[i+1]; ++j) {
|
for (size_t j = prow.offset[i]; j < prow.offset[i+1]; ++j) {
|
||||||
const SparseBatch::Entry &e = prow.data[j];
|
const SparseBatch::Entry &e = prow.data[j];
|
||||||
if (enabled[e.index]) {
|
if (enabled[e.index]) {
|
||||||
builder.AddBudget(e.index, tid);
|
builder.AddBudget(e.index, tid);
|
||||||
@ -240,7 +240,7 @@ class FMatrixPage : public IFMatrix {
|
|||||||
#pragma omp parallel for schedule(static)
|
#pragma omp parallel for schedule(static)
|
||||||
for (bst_omp_uint i = 0; i < ndata; ++i) {
|
for (bst_omp_uint i = 0; i < ndata; ++i) {
|
||||||
int tid = omp_get_thread_num();
|
int tid = omp_get_thread_num();
|
||||||
for (bst_uint j = prow.offset[i]; j < prow.offset[i+1]; ++j) {
|
for (size_t j = prow.offset[i]; j < prow.offset[i+1]; ++j) {
|
||||||
const SparseBatch::Entry &e = prow.data[j];
|
const SparseBatch::Entry &e = prow.data[j];
|
||||||
builder.Push(e.index,
|
builder.Push(e.index,
|
||||||
SparseBatch::Entry(ridx[i], e.fvalue),
|
SparseBatch::Entry(ridx[i], e.fvalue),
|
||||||
|
|||||||
@ -165,7 +165,8 @@ class FMatrixS : public IFMatrix {
|
|||||||
while (iter_->Next()) {
|
while (iter_->Next()) {
|
||||||
const RowBatch &batch = iter_->Value();
|
const RowBatch &batch = iter_->Value();
|
||||||
bmap.resize(bmap.size() + batch.size, true);
|
bmap.resize(bmap.size() + batch.size, true);
|
||||||
for (size_t i = 0; i < batch.size; ++i) {
|
long batch_size = static_cast<long>(batch.size);
|
||||||
|
for (long i = 0; i < batch_size; ++i) {
|
||||||
bst_uint ridx = static_cast<bst_uint>(batch.base_rowid + i);
|
bst_uint ridx = static_cast<bst_uint>(batch.base_rowid + i);
|
||||||
if (pkeep == 1.0f || random::SampleBinary(pkeep)) {
|
if (pkeep == 1.0f || random::SampleBinary(pkeep)) {
|
||||||
buffered_rowset_.push_back(ridx);
|
buffered_rowset_.push_back(ridx);
|
||||||
@ -174,7 +175,7 @@ class FMatrixS : public IFMatrix {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#pragma omp parallel for schedule(static)
|
#pragma omp parallel for schedule(static)
|
||||||
for (size_t i = 0; i < batch.size; ++i) {
|
for (long i = 0; i < batch_size; ++i) {
|
||||||
int tid = omp_get_thread_num();
|
int tid = omp_get_thread_num();
|
||||||
bst_uint ridx = static_cast<bst_uint>(batch.base_rowid + i);
|
bst_uint ridx = static_cast<bst_uint>(batch.base_rowid + i);
|
||||||
if (bmap[ridx]) {
|
if (bmap[ridx]) {
|
||||||
@ -193,7 +194,7 @@ class FMatrixS : public IFMatrix {
|
|||||||
while (iter_->Next()) {
|
while (iter_->Next()) {
|
||||||
const RowBatch &batch = iter_->Value();
|
const RowBatch &batch = iter_->Value();
|
||||||
#pragma omp parallel for schedule(static)
|
#pragma omp parallel for schedule(static)
|
||||||
for (size_t i = 0; i < batch.size; ++i) {
|
for (long i = 0; i < static_cast<long>(batch.size); ++i) {
|
||||||
int tid = omp_get_thread_num();
|
int tid = omp_get_thread_num();
|
||||||
bst_uint ridx = static_cast<bst_uint>(batch.base_rowid + i);
|
bst_uint ridx = static_cast<bst_uint>(batch.base_rowid + i);
|
||||||
if (bmap[ridx]) {
|
if (bmap[ridx]) {
|
||||||
|
|||||||
@ -130,7 +130,7 @@ struct EvalMClassBase : public IEvaluator {
|
|||||||
const float wt = info.GetWeight(i);
|
const float wt = info.GetWeight(i);
|
||||||
int label = static_cast<int>(info.labels[i]);
|
int label = static_cast<int>(info.labels[i]);
|
||||||
if (label >= 0 && label < static_cast<int>(nclass)) {
|
if (label >= 0 && label < static_cast<int>(nclass)) {
|
||||||
sum += Derived::EvalRow(info.labels[i],
|
sum += Derived::EvalRow(label,
|
||||||
BeginPtr(preds) + i * nclass,
|
BeginPtr(preds) + i * nclass,
|
||||||
nclass) * wt;
|
nclass) * wt;
|
||||||
wsum += wt;
|
wsum += wt;
|
||||||
|
|||||||
@ -149,9 +149,9 @@ extern "C"{
|
|||||||
DMatrixSimple &mat = *p_mat;
|
DMatrixSimple &mat = *p_mat;
|
||||||
utils::ParallelGroupBuilder<RowBatch::Entry> builder(&mat.row_ptr_, &mat.row_data_);
|
utils::ParallelGroupBuilder<RowBatch::Entry> builder(&mat.row_ptr_, &mat.row_data_);
|
||||||
builder.InitBudget(0, nthread);
|
builder.InitBudget(0, nthread);
|
||||||
bst_ulong ncol = nindptr - 1;
|
long ncol = static_cast<long>(nindptr - 1);
|
||||||
#pragma omp parallel for schedule(static)
|
#pragma omp parallel for schedule(static)
|
||||||
for (bst_ulong i = 0; i < ncol; ++i) {
|
for (long i = 0; i < ncol; ++i) {
|
||||||
int tid = omp_get_thread_num();
|
int tid = omp_get_thread_num();
|
||||||
for (unsigned j = col_ptr[i]; j < col_ptr[i+1]; ++j) {
|
for (unsigned j = col_ptr[i]; j < col_ptr[i+1]; ++j) {
|
||||||
builder.AddBudget(indices[j], tid);
|
builder.AddBudget(indices[j], tid);
|
||||||
@ -159,7 +159,7 @@ extern "C"{
|
|||||||
}
|
}
|
||||||
builder.InitStorage();
|
builder.InitStorage();
|
||||||
#pragma omp parallel for schedule(static)
|
#pragma omp parallel for schedule(static)
|
||||||
for (bst_ulong i = 0; i < ncol; ++i) {
|
for (long i = 0; i < ncol; ++i) {
|
||||||
int tid = omp_get_thread_num();
|
int tid = omp_get_thread_num();
|
||||||
for (unsigned j = col_ptr[i]; j < col_ptr[i+1]; ++j) {
|
for (unsigned j = col_ptr[i]; j < col_ptr[i+1]; ++j) {
|
||||||
builder.Push(indices[j],
|
builder.Push(indices[j],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user