[FIX] fix plugin system

This commit is contained in:
tqchen 2016-01-12 17:54:09 -08:00
parent 96f4542a67
commit 31d8e93ef3
6 changed files with 11 additions and 11 deletions

View File

@ -1,8 +1,3 @@
# flags by plugin
PLUGIN_OBJS=
PLUGIN_LDFLAGS=
PLUGIN_CFLAGS=
ifndef config
ifneq ("$(wildcard ./config.mk)","")
config = config.mk
@ -28,6 +23,9 @@ ifeq ($(USE_OPENMP), 0)
endif
include $(DMLC_CORE)/make/dmlc.mk
# include the plugins
include $(XGB_PLUGINS)
# use customized config file
ifndef CC
export CC = $(if $(shell which gcc-5),gcc-5,gcc)

View File

@ -50,5 +50,5 @@ LIBJVM=$(JAVA_HOME)/jre/lib/amd64/server
# List of additional plugins, checkout plugin folder.
# uncomment the following lines to include these plugins
# you can also add your own plugin like this
# include plugin/example/plugin.mk
#
# XGB_PLUGINS += plugin/example/plugin.mk

View File

@ -8,7 +8,7 @@ To include a certain plugin, say ```plugin_a```, you only need to add the follow
```makefile
# Add plugin by include the plugin in config
include plugin/plugin_a/plugin.mk
XGB_PLUGINS += plugin/plugin_a/plugin.mk
```
Then rebuild libxgboost by typing make, you can get a new library with the plugin enabled.

View File

@ -12,7 +12,7 @@ There are three steps you need to to do to add plugin to xgboost
To add this plugin, add the following line to ```config.mk```(template in make/config.mk).
```makefile
# Add plugin by include the plugin in config
include plugin/example/plugin.mk
XGB_PLUGINS += plugin/plugin_a/plugin.mk
```
Then you can test this plugin by using ```objective=mylogistic``` parameter.

View File

@ -104,7 +104,8 @@ inline void CompressArray<DType>::InitCompressChunks(size_t chunk_size, size_t m
chunk_size = std::max(min_chunk_size, chunk_size);
size_t nstep = data.size() / chunk_size;
for (size_t i = 0; i < nstep; ++i) {
raw_chunks_.push_back(raw_chunks_.back() + chunk_size * i);
raw_chunks_.push_back(raw_chunks_.back() + chunk_size);
CHECK_LE(raw_chunks_.back(), data.size());
}
if (nstep == 0) raw_chunks_.push_back(0);
raw_chunks_.back() = data.size();

View File

@ -658,7 +658,8 @@ class QuantileSketchTemplate {
CHECK_EQ(fi.Read(&this->size, sizeof(this->size)), sizeof(this->size));
this->Reserve(this->size);
if (this->size != 0) {
CHECK_EQ(fi.Read(this->data, this->size * sizeof(Entry)), sizeof(this->size));
CHECK_EQ(fi.Read(this->data, this->size * sizeof(Entry)),
this->size * sizeof(Entry));
}
}
};