Skip to content

Commit d581a3d

Browse files
authored
[UPDATE] Update rabit and threadlocal (dmlc#2114)
* [UPDATE] Update rabit and threadlocal * minor fix to make build system happy * upgrade requirement to g++4.8 * upgrade dmlc-core * update travis
1 parent b0c972a commit d581a3d

28 files changed

+59
-48
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,21 @@ matrix:
4141
# dependent apt packages
4242
addons:
4343
apt:
44+
sources:
45+
- ubuntu-toolchain-r-test
4446
packages:
4547
- doxygen
4648
- wget
4749
- libcurl4-openssl-dev
4850
- unzip
4951
- graphviz
52+
- gcc-4.8
53+
- g++-4.8
5054

5155
before_install:
5256
- source dmlc-core/scripts/travis/travis_setup_env.sh
5357
- export PYTHONPATH=${PYTHONPATH}:${PWD}/python-package
54-
- echo "MAVEN_OPTS='-Xmx2048m -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=512m -Dorg.slf4j.simpleLogger.defaultLogLevel=error'" > ~/.mavenrc
58+
- echo "MAVEN_OPTS='-Xmx2048m -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=512m -Dorg.slf4j.simpleLogger.defaultLogLevel=error'" > ~/.mavenrc
5559

5660
install:
5761
- source tests/travis/setup.sh

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export CXX = $(if $(shell which g++-6),g++-6,$(if $(shell which g++-mp-6),g++-mp
4848
endif
4949

5050
export LDFLAGS= -pthread -lm $(ADD_LDFLAGS) $(DMLC_LDFLAGS) $(PLUGIN_LDFLAGS)
51-
export CFLAGS= -std=c++0x -Wall -Wno-unknown-pragmas -Iinclude $(ADD_CFLAGS) $(PLUGIN_CFLAGS)
51+
export CFLAGS= -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude $(ADD_CFLAGS) $(PLUGIN_CFLAGS)
5252
CFLAGS += -I$(DMLC_CORE)/include -I$(RABIT)/include
5353
#java include path
5454
export JAVAINCFLAGS = -I${JAVA_HOME}/include -I./java

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ This file records the changes in xgboost library in reverse chronological order.
88
- Specialized some prediction routine
99
* Automatically remove nan from input data when it is sparse.
1010
- This can solve some of user reported problem of istart != hist.size
11+
* Minor fixes
12+
- Thread local variable is upgraded so it is automatically freed at thread exit.
13+
* Migrate to C++11
14+
- The current master version now requires C++11 enabled compiled(g++4.8 or higher)
1115

1216
## v0.6 (2016.07.29)
1317
* Version 0.5 is skipped due to major improvements in the core

doc/build.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Our goal is to build the shared library:
4242

4343
The minimal building requirement is
4444

45-
- A recent c++ compiler supporting C++ 11 (g++-4.6 or higher)
45+
- A recent c++ compiler supporting C++ 11 (g++-4.8 or higher)
4646

4747
We can edit `make/config.mk` to change the compile options, and then build by
4848
`make`. If everything goes well, we can go to the specific language installation section.
@@ -222,7 +222,7 @@ first follow [Building on OSX](#building-on-osx) to get the OpenMP enabled compi
222222

223223
### Installing the development version
224224

225-
Make sure you have installed git and a recent C++ compiler supporting C++11 (e.g., g++-4.6 or higher).
225+
Make sure you have installed git and a recent C++ compiler supporting C++11 (e.g., g++-4.8 or higher).
226226
On Windows, Rtools must be installed, and its bin directory has to be added to PATH during the installation.
227227
And see the previous subsection for an OSX tip.
228228

src/c_api/c_api.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ XGB_DLL int XGDMatrixSliceDMatrix(DMatrixHandle handle,
385385
src.CopyFrom(static_cast<std::shared_ptr<DMatrix>*>(handle)->get());
386386
data::SimpleCSRSource& ret = *source;
387387

388-
CHECK_EQ(src.info.group_ptr.size(), 0)
388+
CHECK_EQ(src.info.group_ptr.size(), 0U)
389389
<< "slice does not support group structure";
390390

391391
ret.Clear();

src/common/hist_util.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void GHistIndexMatrix::Init(DMatrix* p_fmat) {
128128
}
129129
index.resize(row_ptr.back());
130130

131-
CHECK_GT(cut->cut.size(), 0);
131+
CHECK_GT(cut->cut.size(), 0U);
132132
CHECK_EQ(cut->row_ptr.back(), cut->cut.size());
133133

134134
omp_ulong bsize = static_cast<omp_ulong>(batch.size);

src/common/row_set.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class RowSetCollection {
5050
}
5151
// initialize node id 0->everything
5252
inline void Init() {
53-
CHECK_EQ(elem_of_each_node_.size(), 0);
53+
CHECK_EQ(elem_of_each_node_.size(), 0U);
5454
const bst_uint* begin = dmlc::BeginPtr(row_indices_);
5555
const bst_uint* end = dmlc::BeginPtr(row_indices_) + row_indices_.size();
5656
elem_of_each_node_.emplace_back(Elem(begin, end));

src/data/sparse_batch_page.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,14 @@ class SparsePage::Writer {
207207
* writing is done by another thread inside writer.
208208
* \param page The page to be written
209209
*/
210-
void PushWrite(std::unique_ptr<SparsePage>&& page);
210+
void PushWrite(std::shared_ptr<SparsePage>&& page);
211211
/*!
212212
* \brief Allocate a page to store results.
213213
* This function can block when the writer is too slow and buffer pages
214214
* have not yet been recycled.
215215
* \param out_page Used to store the allocated pages.
216216
*/
217-
void Alloc(std::unique_ptr<SparsePage>* out_page);
217+
void Alloc(std::shared_ptr<SparsePage>* out_page);
218218

219219
private:
220220
/*! \brief number of allocated pages */
@@ -224,9 +224,9 @@ class SparsePage::Writer {
224224
/*! \brief writer threads */
225225
std::vector<std::unique_ptr<std::thread> > workers_;
226226
/*! \brief recycler queue */
227-
dmlc::ConcurrentBlockingQueue<std::unique_ptr<SparsePage> > qrecycle_;
227+
dmlc::ConcurrentBlockingQueue<std::shared_ptr<SparsePage> > qrecycle_;
228228
/*! \brief worker threads */
229-
std::vector<dmlc::ConcurrentBlockingQueue<std::unique_ptr<SparsePage> > > qworkers_;
229+
std::vector<dmlc::ConcurrentBlockingQueue<std::shared_ptr<SparsePage> > > qworkers_;
230230
};
231231
#endif // DMLC_ENABLE_STD_THREAD
232232

0 commit comments

Comments
 (0)