Skip to content

Commit

Permalink
fixed xgboost GPU build
Browse files Browse the repository at this point in the history
  • Loading branch information
beniz committed Sep 1, 2017
1 parent 09b9636 commit 0056409
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,13 @@ if (USE_XGBOOST)
add_definitions(-DUSE_XGBOOST)
if (CUDA_FOUND AND USE_XGBOOST_GPU)
add_definitions(-DUSE_XGBOOST_GPU)
set(XGB_NVCC_FLAGS,"--expt-extended-lambda;-gencode arch=compute_35,code=compute_35")
# set(XGB_NVCC_FLAGS,"--expt-extended-lambda;-gencode arch=compute_35,code=compute_35")
ExternalProject_Add(
xgboost
PREFIX xgboost
INSTALL_DIR ${CMAKE_BINARY_DIR}
DOWNLOAD_COMMAND git clone --recursive https://github.com/dmlc/xgboost.git
#UPDATE_COMMAND git submodule foreach git pull origin master
CONFIGURE_COMMAND wget https://github.com/NVlabs/cub/archive/1.6.4.zip && unzip 1.6.4.zip && rm 1.6.4.zip && ${CMAKE_BINARY_DIR}/patches/test_patch.sh ${CMAKE_BINARY_DIR}/patches/xgb/xgb_cmakelist_fix.patch && mkdir build && cd build &&
CONFIGURE_COMMAND wget https://github.com/NVlabs/cub/archive/1.6.4.zip && unzip 1.6.4.zip && rm 1.6.4.zip && mkdir build && cd build &&
cmake .. -DPLUGIN_UPDATER_GPU=ON -DCUB_DIRECTORY=${CMAKE_BINARY_DIR}/xgboost/src/xgboost/cub-1.6.4/ -DCUDA_NVCC_FLAGS=-Xcompiler\ -fPIC\ --expt-extended-lambda\ -gencode\ arch=compute_30,code=compute_30\ -gencode\ arch=compute_35,code=compute_35\ -gencode\ arch=compute_50,code=compute_50\ -gencode\ arch=compute_52,code=compute_52\ -gencode\ arch=compute_61,code=compute_61 && make && make
INSTALL_COMMAND ""
BUILD_IN_SOURCE 1
Expand All @@ -232,8 +231,6 @@ if (USE_XGBOOST)
PREFIX xgboost
INSTALL_DIR ${CMAKE_BINARY_DIR}
DOWNLOAD_COMMAND git clone --recursive https://github.com/dmlc/xgboost.git
#UPDATE_COMMAND git submodule foreach git pull origin master
#CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/patches/test_patch.sh ${CMAKE_BINARY_DIR}/patches/xgb/xgb_cmakelist_fix.patch && mkdir build && cd build && cmake .. && make
CONFIGURE_COMMAND mkdir build && cd build && cmake .. && make -j ${N}
INSTALL_COMMAND ""
BUILD_IN_SOURCE 1
Expand Down
2 changes: 1 addition & 1 deletion main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ endif()

if (USE_XGBOOST)
if (CUDA_FOUND AND USE_XGBOOST_GPU)
set(XGBOOST_LIB_DEPS -Wl,--whole-archive ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/lib/libxgboost.a -Wl,--no-whole-archive ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/dmlc-core/libdmlccore.a ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/librabit.a ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/CMakeFiles/cuda_compile.dir/plugin/updater_gpu/src/cuda_compile_generated_updater_gpu.cu.o ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/CMakeFiles/cuda_compile.dir/plugin/updater_gpu/src/cuda_compile_generated_gpu_hist_builder.cu.o ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/nccl/libnccl.a)
set(XGBOOST_LIB_DEPS -Wl,--whole-archive ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/lib/libxgboost.a -Wl,--no-whole-archive ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/dmlc-core/libdmlccore.a ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/librabit.a ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/CMakeFiles/gpuxgboost.dir/plugin/updater_gpu/src/gpuxgboost_generated_updater_gpu.cu.o ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/nccl/libnccl.a)
else()
set(XGBOOST_LIB_DEPS -Wl,--whole-archive ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/lib/libxgboost.a -Wl,--no-whole-archive ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/dmlc-core/libdmlccore.a ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/librabit.a)
endif()
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ link_directories(${TSNE_LIB_DIR})

if (USE_XGBOOST)
if (CUDA_FOUND AND USE_XGBOOST_GPU)
set(XGBOOST_LIB_DEPS -Wl,--whole-archive ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/lib/libxgboost.a -Wl,--no-whole-archive ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/dmlc-core/libdmlccore.a ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/librabit.a ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/CMakeFiles/cuda_compile.dir/plugin/updater_gpu/src/cuda_compile_generated_updater_gpu.cu.o ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/CMakeFiles/cuda_compile.dir/plugin/updater_gpu/src/cuda_compile_generated_gpu_hist_builder.cu.o ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/nccl/libnccl.a)
set(XGBOOST_LIB_DEPS -Wl,--whole-archive ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/lib/libxgboost.a -Wl,--no-whole-archive ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/dmlc-core/libdmlccore.a ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/librabit.a ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/CMakeFiles/gpuxgboost.dir/plugin/updater_gpu/src/gpuxgboost_generated_updater_gpu.cu.o ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/nccl/libnccl.a)
else()
set(XGBOOST_LIB_DEPS -Wl,--whole-archive ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/lib/libxgboost.a -Wl,--no-whole-archive ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/dmlc-core/libdmlccore.a ${CMAKE_BINARY_DIR}/xgboost/src/xgboost/build/librabit.a)
endif()
Expand Down

0 comments on commit 0056409

Please sign in to comment.