Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Updating to dmlc/xgboost#2543 (02/08/2017)
  • Loading branch information
Laurae2 committed Aug 8, 2017
1 parent abaa8ca commit 8a9a08d
Show file tree
Hide file tree
Showing 16 changed files with 902 additions and 458 deletions.
29 changes: 23 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,42 @@ include_directories (
file(GLOB_RECURSE SOURCES
src/*.cc
src/*.h
include/*.h
)
# Only add main function for executable target
list(REMOVE_ITEM SOURCES ${PROJECT_SOURCE_DIR}/src/cli_main.cc)


# rabit
# TODO: Create rabit cmakelists.txt
set(RABIT_SOURCES
rabit/src/allreduce_base.cc
rabit/src/allreduce_robust.cc
rabit/src/engine.cc
rabit/src/c_api.cc
)

file(GLOB_RECURSE CUDA_SOURCES
plugin/updater_gpu/src/*.cu
plugin/updater_gpu/src/*.cuh
set(RABIT_EMPTY_SOURCES
rabit/src/engine_empty.cc
rabit/src/c_api.cc
)
if(MINGW)
# build a dummy rabit library
add_library(rabit STATIC ${RABIT_EMPTY_SOURCES})
else()
add_library(rabit STATIC ${RABIT_SOURCES})
endif()


# dmlc-core
add_subdirectory(dmlc-core)
set(LINK_LIBRARIES dmlccore rabit)


# GPU Plugin
file(GLOB_RECURSE CUDA_SOURCES
plugin/updater_gpu/src/*.cu
plugin/updater_gpu/src/*.cuh
)
if(PLUGIN_UPDATER_GPU)
find_package(CUDA 7.5 REQUIRED)
cmake_minimum_required(VERSION 3.5)
Expand All @@ -82,8 +97,6 @@ if(PLUGIN_UPDATER_GPU)
list(APPEND SOURCES plugin/updater_gpu/src/register_updater_gpu.cc)
endif()

add_library(rabit STATIC ${RABIT_SOURCES})

add_library(objxgboost OBJECT ${SOURCES})

# Executable
Expand All @@ -98,6 +111,10 @@ target_link_libraries(runxgboost ${LINK_LIBRARIES})
add_library(xgboost SHARED $<TARGET_OBJECTS:objxgboost>)
target_link_libraries(xgboost ${LINK_LIBRARIES})
set_output_directory(xgboost ${PROJECT_SOURCE_DIR}/lib)
if(MINGW)
# remove the 'lib' prefix to conform to windows convention for shared library names
set_target_properties(xgboost PROPERTIES PREFIX "")
endif()

#Ensure these two targets do not build simultaneously, as they produce outputs with conflicting names
add_dependencies(xgboost runxgboost)
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ifndef LINT_LANG
endif

ifeq ($(UNAME), Windows)
XGBOOST_DYLIB = lib/libxgboost.dll
XGBOOST_DYLIB = lib/xgboost.dll
JAVAINCFLAGS += -I${JAVA_HOME}/include/win32
else
ifeq ($(UNAME), Darwin)
Expand Down Expand Up @@ -176,7 +176,7 @@ lib/libxgboost.a: $(ALL_DEP)
@mkdir -p $(@D)
ar crv $@ $(filter %.o, $?)

lib/libxgboost.dll lib/libxgboost.so lib/libxgboost.dylib: $(ALL_DEP)
lib/xgboost.dll lib/libxgboost.so lib/libxgboost.dylib: $(ALL_DEP)
@mkdir -p $(@D)
$(CXX) $(CFLAGS) -shared -o $@ $(filter %.o %a, $^) $(LDFLAGS)

Expand Down Expand Up @@ -213,7 +213,7 @@ cover: check
endif

clean:
$(RM) -rf build build_plugin lib bin *~ */*~ */*/*~ */*/*/*~ */*.o */*/*.o */*/*/*.o xgboost
$(RM) -rf build build_plugin lib bin *~ */*~ */*/*~ */*/*/*~ */*.o */*/*.o */*/*/*.o #xgboost
$(RM) -rf build_tests *.gcov tests/cpp/xgboost_test

clean_all: clean
Expand Down
4 changes: 4 additions & 0 deletions amalgamation/xgboost-all0.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#include "../src/data/simple_dmatrix.cc"
#include "../src/data/sparse_page_raw_format.cc"

// prediction
#include "../src/predictor/predictor.cc"
#include "../src/predictor/cpu_predictor.cc"

#if DMLC_ENABLE_STD_THREAD
#include "../src/data/sparse_page_source.cc"
#include "../src/data/sparse_page_dmatrix.cc"
Expand Down
78 changes: 54 additions & 24 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,60 @@
environment:
matrix:
- target: native
solution_name: C:/projects/xgboost/build2013/xgboost.sln
- target: native
solution_name: C:/projects/xgboost/build2015/xgboost.sln
- target: jvm
platform:
- x64
matrix:
- target: msvc
ver: 2013
generator: "Visual Studio 12 2013 Win64"
configuration: Release
- target: msvc
ver: 2015
generator: "Visual Studio 14 2015 Win64"
configuration: Debug
- target: msvc
ver: 2015
generator: "Visual Studio 14 2015 Win64"
configuration: Release
- target: mingw
generator: "Unix Makefiles"
- target: jvm

configuration:
- Debug
- Release
platform:
- x64

install:
- SET PATH=;%PATH%
- git submodule update --init --recursive

before_build:
- mkdir build2013
- mkdir build2015
- cd build2013
- cmake .. -G"Visual Studio 12 2013 Win64" -DCMAKE_CONFIGURATION_TYPES="Release;Debug;"
- cd ../build2015
- cmake .. -G"Visual Studio 14 2015 Win64" -DCMAKE_CONFIGURATION_TYPES="Release;Debug;"
- git submodule update --init --recursive
# MinGW
- set PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%
- gcc -v
- ls -l C:\
# Miniconda2
- set PATH=;C:\Miniconda-x64;C:\Miniconda-x64\Scripts;%PATH%
- where python
- python --version
# do python build for mingw and one of the msvc jobs
- set DO_PYTHON=off
- if /i "%target%" == "mingw" set DO_PYTHON=on
- if /i "%target%_%ver%_%configuration%" == "msvc_2015_Release" set DO_PYTHON=on
- if /i "%DO_PYTHON%" == "on" conda install -y numpy scipy pandas matplotlib nose scikit-learn graphviz python-graphviz

build_script:
- cd %APPVEYOR_BUILD_FOLDER%
- if "%target%" == "native" msbuild %solution_name%
- if "%target%" == "jvm" cd jvm-packages && mvn test -pl :xgboost4j
- cd %APPVEYOR_BUILD_FOLDER%
- if /i "%target%" == "msvc" (
mkdir build_msvc%ver% &&
cd build_msvc%ver% &&
cmake .. -G"%generator%" -DCMAKE_CONFIGURATION_TYPES="Release;Debug;" &&
msbuild xgboost.sln
)
- if /i "%target%" == "mingw" (
mkdir build_mingw &&
cd build_mingw &&
cmake .. -G"%generator%" &&
make -j2
)
- if /i "%DO_PYTHON%" == "on" (
cd %APPVEYOR_BUILD_FOLDER%\python-package &&
python setup.py install
)
- if /i "%target%" == "jvm" cd jvm-packages && mvn test -pl :xgboost4j

test_script:
- cd %APPVEYOR_BUILD_FOLDER%
- if /i "%DO_PYTHON%" == "on" python -m nose tests/python
17 changes: 0 additions & 17 deletions doc/parameter.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,6 @@ Parameters for Tree Booster
- This is only used if 'hist' is specified as `tree_method`.
- Maximum number of discrete bins to bucket continuous features.
- Increasing this number improves the optimality of splits at the cost of higher computation time.
* use_columnar_access, [default=1]
- This is only used if 'hist' is specified as `tree_method`.
- If greater than zero, store a transposed copy of input matrix for fast columnar access. May increase memory usage and initial setup time.
* sparse_threshold, [default=0.2]
- range: [0.0, 1.0]
- This is only used if 'hist' is specified as `tree_method`.
- Percentage threshold for treating a feature as sparse. For instance, 0.2 indicates that any feature with fewer than 20% nonzero rows will be considered sparse. May impact computation time slightly.
* enable_feature_grouping, [default=0]
- This is only used if 'hist' is specified as `tree_method`.
- If greater than zero, group complementary features together so as to improve work balance for parallel histogram aggregation. May increase memory usage and initial setup time.
* max_conflict_rate, [default=0]
- range: [0.0, 1.0]
- Only relevant when `enable_feature_grouping=1` is specified.
- Specifies criterion for "complementary" features. By default, only features with no common nonzero rows are considered complementary. Increase this number to encourage larger feature groups.
* max_search_group, [default=100]
- Only relevant when `enable_feature_grouping=1` is specified.
- Increasing this number will result in better feature grouping, at the cost of greater initial setup time.

Additional parameters for Dart Booster
--------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions include/xgboost/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
/*!
* \brief Check if alignas(*) keyword is supported. (g++ 4.8 or higher)
*/
#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ >= 8
#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || __GNUC__ > 4)
#define XGBOOST_ALIGNAS(X) alignas(X)
#else
#define XGBOOST_ALIGNAS(X)
#endif

#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ >= 8 && \
#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || __GNUC__ > 4) && \
!defined(__CUDACC__)
#include <parallel/algorithm>
#define XGBOOST_PARALLEL_SORT(X, Y, Z) __gnu_parallel::sort((X), (Y), (Z))
Expand Down
4 changes: 2 additions & 2 deletions include/xgboost/gbm.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class GradientBooster {
* \param ntree_limit limit the number of trees used in prediction, when it equals 0, this means
* we do not limit number of trees, this parameter is only valid for gbtree, but not for gblinear
*/
virtual void Predict(DMatrix* dmat,
virtual void PredictBatch(DMatrix* dmat,
std::vector<bst_float>* out_preds,
unsigned ntree_limit = 0) = 0;
/*!
Expand All @@ -92,7 +92,7 @@ class GradientBooster {
* \param root_index the root index
* \sa Predict
*/
virtual void Predict(const SparseBatch::Inst& inst,
virtual void PredictInstance(const SparseBatch::Inst& inst,
std::vector<bst_float>* out_preds,
unsigned ntree_limit = 0,
unsigned root_index = 0) = 0;
Expand Down
2 changes: 1 addition & 1 deletion include/xgboost/learner.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ inline void Learner::Predict(const SparseBatch::Inst& inst,
bool output_margin,
std::vector<bst_float>* out_preds,
unsigned ntree_limit) const {
gbm_->Predict(inst, out_preds, ntree_limit);
gbm_->PredictInstance(inst, out_preds, ntree_limit);
if (!output_margin) {
obj_->PredTransform(out_preds);
}
Expand Down
Loading

0 comments on commit 8a9a08d

Please sign in to comment.