[FIX] fix plugin system
This commit is contained in:
parent
96f4542a67
commit
31d8e93ef3
8
Makefile
8
Makefile
@ -1,8 +1,3 @@
|
|||||||
# flags by plugin
|
|
||||||
PLUGIN_OBJS=
|
|
||||||
PLUGIN_LDFLAGS=
|
|
||||||
PLUGIN_CFLAGS=
|
|
||||||
|
|
||||||
ifndef config
|
ifndef config
|
||||||
ifneq ("$(wildcard ./config.mk)","")
|
ifneq ("$(wildcard ./config.mk)","")
|
||||||
config = config.mk
|
config = config.mk
|
||||||
@ -28,6 +23,9 @@ ifeq ($(USE_OPENMP), 0)
|
|||||||
endif
|
endif
|
||||||
include $(DMLC_CORE)/make/dmlc.mk
|
include $(DMLC_CORE)/make/dmlc.mk
|
||||||
|
|
||||||
|
# include the plugins
|
||||||
|
include $(XGB_PLUGINS)
|
||||||
|
|
||||||
# use customized config file
|
# use customized config file
|
||||||
ifndef CC
|
ifndef CC
|
||||||
export CC = $(if $(shell which gcc-5),gcc-5,gcc)
|
export CC = $(if $(shell which gcc-5),gcc-5,gcc)
|
||||||
|
|||||||
@ -50,5 +50,5 @@ LIBJVM=$(JAVA_HOME)/jre/lib/amd64/server
|
|||||||
# List of additional plugins, checkout plugin folder.
|
# List of additional plugins, checkout plugin folder.
|
||||||
# uncomment the following lines to include these plugins
|
# uncomment the following lines to include these plugins
|
||||||
# you can also add your own plugin like this
|
# you can also add your own plugin like this
|
||||||
|
#
|
||||||
# include plugin/example/plugin.mk
|
# XGB_PLUGINS += plugin/example/plugin.mk
|
||||||
|
|||||||
@ -8,7 +8,7 @@ To include a certain plugin, say ```plugin_a```, you only need to add the follow
|
|||||||
|
|
||||||
```makefile
|
```makefile
|
||||||
# Add plugin by include the plugin in config
|
# 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.
|
Then rebuild libxgboost by typing make, you can get a new library with the plugin enabled.
|
||||||
|
|||||||
@ -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).
|
To add this plugin, add the following line to ```config.mk```(template in make/config.mk).
|
||||||
```makefile
|
```makefile
|
||||||
# Add plugin by include the plugin in config
|
# 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.
|
Then you can test this plugin by using ```objective=mylogistic``` parameter.
|
||||||
|
|||||||
@ -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);
|
chunk_size = std::max(min_chunk_size, chunk_size);
|
||||||
size_t nstep = data.size() / chunk_size;
|
size_t nstep = data.size() / chunk_size;
|
||||||
for (size_t i = 0; i < nstep; ++i) {
|
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);
|
if (nstep == 0) raw_chunks_.push_back(0);
|
||||||
raw_chunks_.back() = data.size();
|
raw_chunks_.back() = data.size();
|
||||||
|
|||||||
@ -658,7 +658,8 @@ class QuantileSketchTemplate {
|
|||||||
CHECK_EQ(fi.Read(&this->size, sizeof(this->size)), sizeof(this->size));
|
CHECK_EQ(fi.Read(&this->size, sizeof(this->size)), sizeof(this->size));
|
||||||
this->Reserve(this->size);
|
this->Reserve(this->size);
|
||||||
if (this->size != 0) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user