windows check

This commit is contained in:
Tianqi Chen 2014-08-29 21:27:03 -07:00
parent 9830674b75
commit 366ac95ad3
6 changed files with 17 additions and 15 deletions

2
.gitignore vendored
View File

@ -2,7 +2,7 @@
*.slo *.slo
*.lo *.lo
*.o *.o
*.page
# Compiled Dynamic libraries # Compiled Dynamic libraries
*.so *.so
*.dylib *.dylib

View File

@ -5,9 +5,10 @@ CXX=`R CMD config CXX`
CFLAGS=`R CMD config CFLAGS` CFLAGS=`R CMD config CFLAGS`
# expose these flags to R CMD SHLIB # expose these flags to R CMD SHLIB
PKG_CPPFLAGS= -DXGBOOST_CUSTOMIZE_ERROR_ -I$(PKGROOT) $(SHLIB_OPENMP_CFLAGS) PKG_CPPFLAGS= -DXGBOOST_CUSTOMIZE_ERROR_ -I$(PKGROOT) $(SHLIB_OPENMP_CFLAGS)
XGBFLAG= $(CFLAGS) -DXGBOOST_CUSTOMIZE_ERROR_ -fPIC $(SHLIB_OPENMP_CFLAGS) PKG_CPPFLAGS+= $(SHLIB_PTHREAD_FLAGS)
XGBFLAG= $(CFLAGS) -DXGBOOST_CUSTOMIZE_ERROR_ -fPIC $(SHLIB_OPENMP_CFLAGS) $(SHLIB_PTHREAD_FLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) $(SHLIB_PTHREAD_FLAGS)
ifeq ($(no_omp),1) ifeq ($(no_omp),1)
PKG_CPPFLAGS += -DDISABLE_OPENMP PKG_CPPFLAGS += -DDISABLE_OPENMP

View File

@ -5,8 +5,9 @@ CXX=`Rcmd config CXX`
CFLAGS=`Rcmd config CFLAGS` CFLAGS=`Rcmd config CFLAGS`
# expose these flags to R CMD SHLIB # expose these flags to R CMD SHLIB
PKG_CPPFLAGS= -DXGBOOST_CUSTOMIZE_ERROR_ -I$(PKGROOT) $(SHLIB_OPENMP_CFLAGS) PKG_CPPFLAGS= -DXGBOOST_CUSTOMIZE_ERROR_ -I$(PKGROOT) $(SHLIB_OPENMP_CFLAGS)
XGBFLAG= $(CFLAGS) -DXGBOOST_CUSTOMIZE_ERROR_ -fPIC $(SHLIB_OPENMP_CFLAGS) PKG_CPPFLAGS+= $(SHLIB_PTHREAD_FLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) XGBFLAG= $(CFLAGS) -DXGBOOST_CUSTOMIZE_ERROR_ -fPIC $(SHLIB_OPENMP_CFLAGS) $(SHLIB_PTHREAD_FLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) $(SHLIB_PTHREAD_FLAGS)
ifeq ($(no_omp),1) ifeq ($(no_omp),1)
PKG_CPPFLAGS += -DDISABLE_OPENMP PKG_CPPFLAGS += -DDISABLE_OPENMP

View File

@ -50,13 +50,13 @@ struct RowBatchPage {
std::vector<size_t> &rptr = *p_rptr; std::vector<size_t> &rptr = *p_rptr;
rptr.resize(this->Size() + 1); rptr.resize(this->Size() + 1);
for (size_t i = 0; i < rptr.size(); ++i) { for (size_t i = 0; i < rptr.size(); ++i) {
rptr[i] = static_cast<size_t>(this->row_ptr(i)); rptr[i] = static_cast<size_t>(this->row_ptr(static_cast<int>(i)));
} }
batch.ind_ptr = &rptr[0]; batch.ind_ptr = &rptr[0];
return batch; return batch;
} }
/*! \brief get i-th row from the batch */ /*! \brief get i-th row from the batch */
inline RowBatch::Inst operator[](size_t i) { inline RowBatch::Inst operator[](int i) {
return RowBatch::Inst(data_ptr(0) + row_ptr(i), return RowBatch::Inst(data_ptr(0) + row_ptr(i),
static_cast<bst_uint>(row_ptr(i+1) - row_ptr(i))); static_cast<bst_uint>(row_ptr(i+1) - row_ptr(i)));
} }
@ -173,7 +173,7 @@ class ThreadRowPageIterator: public utils::IIterator<RowBatch> {
// loader factory for page // loader factory for page
struct Factory { struct Factory {
public: public:
size_t file_begin_; long file_begin_;
utils::FileStream fi; utils::FileStream fi;
Factory(void) {} Factory(void) {}
inline void SetFile(const utils::FileStream &fi) { inline void SetFile(const utils::FileStream &fi) {

View File

@ -92,9 +92,9 @@ class IStream {
class ISeekStream: public IStream { class ISeekStream: public IStream {
public: public:
/*! \brief seek to certain position of the file */ /*! \brief seek to certain position of the file */
virtual void Seek(size_t pos) = 0; virtual void Seek(long pos) = 0;
/*! \brief tell the position of the stream */ /*! \brief tell the position of the stream */
virtual size_t Tell(void) = 0; virtual long Tell(void) = 0;
}; };
/*! \brief implementation of file i/o stream */ /*! \brief implementation of file i/o stream */
@ -112,11 +112,11 @@ class FileStream : public ISeekStream {
virtual void Write(const void *ptr, size_t size) { virtual void Write(const void *ptr, size_t size) {
fwrite(ptr, size, 1, fp); fwrite(ptr, size, 1, fp);
} }
virtual void Seek(size_t pos) { virtual void Seek(long pos) {
fseek(fp, pos, SEEK_SET); fseek(fp, pos, SEEK_SET);
} }
virtual size_t Tell(void) { virtual long Tell(void) {
return static_cast<size_t>(ftell(fp)); return ftell(fp);
} }
inline void Close(void) { inline void Close(void) {
if (fp != NULL){ if (fp != NULL){

View File

@ -56,7 +56,7 @@ class DMatrix:
weight for each instances weight for each instances
""" """
# force into void_p, mac need to pass things in as void_p # force into void_p, mac need to pass things in as void_p
if data == None: if data is None:
self.handle = None self.handle = None
return return
if isinstance(data, str): if isinstance(data, str):
@ -484,7 +484,7 @@ def train(params, dtrain, num_boost_round = 10, evals = [], obj=None, feval=None
feval: feval:
""" """
bst = Booster(params, [dtrain]+[ d[0] for d in evals ] ) bst = Booster(params, [dtrain]+[ d[0] for d in evals ] )
if obj == None: if obj is None:
for i in range(num_boost_round): for i in range(num_boost_round):
bst.update( dtrain, i ) bst.update( dtrain, i )
if len(evals) != 0: if len(evals) != 0: