Skip to content

Commit 31d8e93

Browse files
committed
[FIX] fix plugin system
1 parent 96f4542 commit 31d8e93

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

Makefile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
# flags by plugin
2-
PLUGIN_OBJS=
3-
PLUGIN_LDFLAGS=
4-
PLUGIN_CFLAGS=
5-
61
ifndef config
72
ifneq ("$(wildcard ./config.mk)","")
83
config = config.mk
@@ -28,6 +23,9 @@ ifeq ($(USE_OPENMP), 0)
2823
endif
2924
include $(DMLC_CORE)/make/dmlc.mk
3025

26+
# include the plugins
27+
include $(XGB_PLUGINS)
28+
3129
# use customized config file
3230
ifndef CC
3331
export CC = $(if $(shell which gcc-5),gcc-5,gcc)

make/config.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ LIBJVM=$(JAVA_HOME)/jre/lib/amd64/server
5050
# List of additional plugins, checkout plugin folder.
5151
# uncomment the following lines to include these plugins
5252
# you can also add your own plugin like this
53-
54-
# include plugin/example/plugin.mk
53+
#
54+
# XGB_PLUGINS += plugin/example/plugin.mk

plugin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ To include a certain plugin, say ```plugin_a```, you only need to add the follow
88

99
```makefile
1010
# Add plugin by include the plugin in config
11-
include plugin/plugin_a/plugin.mk
11+
XGB_PLUGINS += plugin/plugin_a/plugin.mk
1212
```
1313

1414
Then rebuild libxgboost by typing make, you can get a new library with the plugin enabled.

plugin/example/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ There are three steps you need to to do to add plugin to xgboost
1212
To add this plugin, add the following line to ```config.mk```(template in make/config.mk).
1313
```makefile
1414
# Add plugin by include the plugin in config
15-
include plugin/example/plugin.mk
15+
XGB_PLUGINS += plugin/plugin_a/plugin.mk
1616
```
1717

1818
Then you can test this plugin by using ```objective=mylogistic``` parameter.

plugin/lz4/sparse_page_lz4_format.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ inline void CompressArray<DType>::InitCompressChunks(size_t chunk_size, size_t m
104104
chunk_size = std::max(min_chunk_size, chunk_size);
105105
size_t nstep = data.size() / chunk_size;
106106
for (size_t i = 0; i < nstep; ++i) {
107-
raw_chunks_.push_back(raw_chunks_.back() + chunk_size * i);
107+
raw_chunks_.push_back(raw_chunks_.back() + chunk_size);
108+
CHECK_LE(raw_chunks_.back(), data.size());
108109
}
109110
if (nstep == 0) raw_chunks_.push_back(0);
110111
raw_chunks_.back() = data.size();

src/common/quantile.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,8 @@ class QuantileSketchTemplate {
658658
CHECK_EQ(fi.Read(&this->size, sizeof(this->size)), sizeof(this->size));
659659
this->Reserve(this->size);
660660
if (this->size != 0) {
661-
CHECK_EQ(fi.Read(this->data, this->size * sizeof(Entry)), sizeof(this->size));
661+
CHECK_EQ(fi.Read(this->data, this->size * sizeof(Entry)),
662+
this->size * sizeof(Entry));
662663
}
663664
}
664665
};

0 commit comments

Comments
 (0)