diff --git a/.gitignore b/.gitignore index f1f9400ab..4551c79cc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ *.slo *.lo *.o - +*.page # Compiled Dynamic libraries *.so *.dylib diff --git a/R-package/src/Makevars b/R-package/src/Makevars index 7dfda4d57..b0d3283b9 100644 --- a/R-package/src/Makevars +++ b/R-package/src/Makevars @@ -5,9 +5,10 @@ CXX=`R CMD config CXX` CFLAGS=`R CMD config CFLAGS` # expose these flags to R CMD SHLIB 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) PKG_CPPFLAGS += -DDISABLE_OPENMP diff --git a/R-package/src/Makevars.win b/R-package/src/Makevars.win index 3df9891fc..8f5f7ed98 100644 --- a/R-package/src/Makevars.win +++ b/R-package/src/Makevars.win @@ -5,8 +5,9 @@ CXX=`Rcmd config CXX` CFLAGS=`Rcmd config CFLAGS` # expose these flags to R CMD SHLIB PKG_CPPFLAGS= -DXGBOOST_CUSTOMIZE_ERROR_ -I$(PKGROOT) $(SHLIB_OPENMP_CFLAGS) -XGBFLAG= $(CFLAGS) -DXGBOOST_CUSTOMIZE_ERROR_ -fPIC $(SHLIB_OPENMP_CFLAGS) -PKG_LIBS = $(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) $(SHLIB_PTHREAD_FLAGS) ifeq ($(no_omp),1) PKG_CPPFLAGS += -DDISABLE_OPENMP diff --git a/src/io/page_dmatrix-inl.hpp b/src/io/page_dmatrix-inl.hpp index e16beb4b6..8db944c85 100644 --- a/src/io/page_dmatrix-inl.hpp +++ b/src/io/page_dmatrix-inl.hpp @@ -50,13 +50,13 @@ struct RowBatchPage { std::vector &rptr = *p_rptr; rptr.resize(this->Size() + 1); for (size_t i = 0; i < rptr.size(); ++i) { - rptr[i] = static_cast(this->row_ptr(i)); + rptr[i] = static_cast(this->row_ptr(static_cast(i))); } batch.ind_ptr = &rptr[0]; return 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), static_cast(row_ptr(i+1) - row_ptr(i))); } @@ -173,7 +173,7 @@ class ThreadRowPageIterator: public utils::IIterator { // loader factory for page struct Factory { public: - size_t file_begin_; + long file_begin_; utils::FileStream fi; Factory(void) {} inline void SetFile(const utils::FileStream &fi) { diff --git a/src/utils/io.h b/src/utils/io.h index dbfcee3f6..276dd7312 100644 --- a/src/utils/io.h +++ b/src/utils/io.h @@ -92,9 +92,9 @@ class IStream { class ISeekStream: public IStream { public: /*! \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 */ - virtual size_t Tell(void) = 0; + virtual long Tell(void) = 0; }; /*! \brief implementation of file i/o stream */ @@ -112,11 +112,11 @@ class FileStream : public ISeekStream { virtual void Write(const void *ptr, size_t size) { fwrite(ptr, size, 1, fp); } - virtual void Seek(size_t pos) { + virtual void Seek(long pos) { fseek(fp, pos, SEEK_SET); } - virtual size_t Tell(void) { - return static_cast(ftell(fp)); + virtual long Tell(void) { + return ftell(fp); } inline void Close(void) { if (fp != NULL){ diff --git a/wrapper/xgboost.py b/wrapper/xgboost.py index adf59c829..e4338e0cd 100644 --- a/wrapper/xgboost.py +++ b/wrapper/xgboost.py @@ -56,7 +56,7 @@ class DMatrix: weight for each instances """ # force into void_p, mac need to pass things in as void_p - if data == None: + if data is None: self.handle = None return if isinstance(data, str): @@ -484,7 +484,7 @@ def train(params, dtrain, num_boost_round = 10, evals = [], obj=None, feval=None feval: """ bst = Booster(params, [dtrain]+[ d[0] for d in evals ] ) - if obj == None: + if obj is None: for i in range(num_boost_round): bst.update( dtrain, i ) if len(evals) != 0: