MinGW: shared library prefix and appveyor CI (#2539)
* for MinGW, drop the 'lib' prefix from shared library name * fix defines for 'g++ 4.8 or higher' to include g++ >= 5 * fix compile warnings * [Appveyor] add MinGW with python; remove redundant jobs * [Appveyor] also do python build for one of msvc jobs
This commit is contained in:
parent
d41dc078b6
commit
00eda28b3c
@ -42,6 +42,8 @@ file(GLOB_RECURSE SOURCES
|
|||||||
# Only add main function for executable target
|
# Only add main function for executable target
|
||||||
list(REMOVE_ITEM SOURCES ${PROJECT_SOURCE_DIR}/src/cli_main.cc)
|
list(REMOVE_ITEM SOURCES ${PROJECT_SOURCE_DIR}/src/cli_main.cc)
|
||||||
|
|
||||||
|
|
||||||
|
# rabit
|
||||||
# TODO: Create rabit cmakelists.txt
|
# TODO: Create rabit cmakelists.txt
|
||||||
set(RABIT_SOURCES
|
set(RABIT_SOURCES
|
||||||
rabit/src/allreduce_base.cc
|
rabit/src/allreduce_base.cc
|
||||||
@ -49,16 +51,28 @@ set(RABIT_SOURCES
|
|||||||
rabit/src/engine.cc
|
rabit/src/engine.cc
|
||||||
rabit/src/c_api.cc
|
rabit/src/c_api.cc
|
||||||
)
|
)
|
||||||
|
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
|
file(GLOB_RECURSE CUDA_SOURCES
|
||||||
plugin/updater_gpu/src/*.cu
|
plugin/updater_gpu/src/*.cu
|
||||||
plugin/updater_gpu/src/*.cuh
|
plugin/updater_gpu/src/*.cuh
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory(dmlc-core)
|
|
||||||
set(LINK_LIBRARIES dmlccore rabit)
|
|
||||||
|
|
||||||
# GPU Plugin
|
|
||||||
if(PLUGIN_UPDATER_GPU)
|
if(PLUGIN_UPDATER_GPU)
|
||||||
find_package(CUDA 7.5 REQUIRED)
|
find_package(CUDA 7.5 REQUIRED)
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
@ -82,8 +96,6 @@ if(PLUGIN_UPDATER_GPU)
|
|||||||
list(APPEND SOURCES plugin/updater_gpu/src/register_updater_gpu.cc)
|
list(APPEND SOURCES plugin/updater_gpu/src/register_updater_gpu.cc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(rabit STATIC ${RABIT_SOURCES})
|
|
||||||
|
|
||||||
add_library(objxgboost OBJECT ${SOURCES})
|
add_library(objxgboost OBJECT ${SOURCES})
|
||||||
|
|
||||||
# Executable
|
# Executable
|
||||||
@ -98,6 +110,10 @@ target_link_libraries(runxgboost ${LINK_LIBRARIES})
|
|||||||
add_library(xgboost SHARED $<TARGET_OBJECTS:objxgboost>)
|
add_library(xgboost SHARED $<TARGET_OBJECTS:objxgboost>)
|
||||||
target_link_libraries(xgboost ${LINK_LIBRARIES})
|
target_link_libraries(xgboost ${LINK_LIBRARIES})
|
||||||
set_output_directory(xgboost ${PROJECT_SOURCE_DIR}/lib)
|
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
|
#Ensure these two targets do not build simultaneously, as they produce outputs with conflicting names
|
||||||
add_dependencies(xgboost runxgboost)
|
add_dependencies(xgboost runxgboost)
|
||||||
|
|||||||
6
Makefile
6
Makefile
@ -73,7 +73,7 @@ ifndef LINT_LANG
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(UNAME), Windows)
|
ifeq ($(UNAME), Windows)
|
||||||
XGBOOST_DYLIB = lib/libxgboost.dll
|
XGBOOST_DYLIB = lib/xgboost.dll
|
||||||
JAVAINCFLAGS += -I${JAVA_HOME}/include/win32
|
JAVAINCFLAGS += -I${JAVA_HOME}/include/win32
|
||||||
else
|
else
|
||||||
ifeq ($(UNAME), Darwin)
|
ifeq ($(UNAME), Darwin)
|
||||||
@ -176,7 +176,7 @@ lib/libxgboost.a: $(ALL_DEP)
|
|||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
ar crv $@ $(filter %.o, $?)
|
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)
|
@mkdir -p $(@D)
|
||||||
$(CXX) $(CFLAGS) -shared -o $@ $(filter %.o %a, $^) $(LDFLAGS)
|
$(CXX) $(CFLAGS) -shared -o $@ $(filter %.o %a, $^) $(LDFLAGS)
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ cover: check
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
clean:
|
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
|
$(RM) -rf build_tests *.gcov tests/cpp/xgboost_test
|
||||||
|
|
||||||
clean_all: clean
|
clean_all: clean
|
||||||
|
|||||||
78
appveyor.yml
78
appveyor.yml
@ -1,30 +1,60 @@
|
|||||||
environment:
|
environment:
|
||||||
matrix:
|
matrix:
|
||||||
- target: native
|
- target: msvc
|
||||||
solution_name: C:/projects/xgboost/build2013/xgboost.sln
|
ver: 2013
|
||||||
- target: native
|
generator: "Visual Studio 12 2013 Win64"
|
||||||
solution_name: C:/projects/xgboost/build2015/xgboost.sln
|
configuration: Release
|
||||||
- target: jvm
|
- target: msvc
|
||||||
platform:
|
ver: 2015
|
||||||
- x64
|
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:
|
platform:
|
||||||
- Debug
|
- x64
|
||||||
- Release
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- SET PATH=;%PATH%
|
- git submodule update --init --recursive
|
||||||
- git submodule update --init --recursive
|
# MinGW
|
||||||
|
- set PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%
|
||||||
before_build:
|
- gcc -v
|
||||||
- mkdir build2013
|
- ls -l C:\
|
||||||
- mkdir build2015
|
# Miniconda2
|
||||||
- cd build2013
|
- set PATH=;C:\Miniconda-x64;C:\Miniconda-x64\Scripts;%PATH%
|
||||||
- cmake .. -G"Visual Studio 12 2013 Win64" -DCMAKE_CONFIGURATION_TYPES="Release;Debug;"
|
- where python
|
||||||
- cd ../build2015
|
- python --version
|
||||||
- cmake .. -G"Visual Studio 14 2015 Win64" -DCMAKE_CONFIGURATION_TYPES="Release;Debug;"
|
# 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:
|
build_script:
|
||||||
- cd %APPVEYOR_BUILD_FOLDER%
|
- cd %APPVEYOR_BUILD_FOLDER%
|
||||||
- if "%target%" == "native" msbuild %solution_name%
|
- if /i "%target%" == "msvc" (
|
||||||
- if "%target%" == "jvm" cd jvm-packages && mvn test -pl :xgboost4j
|
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
|
||||||
|
|||||||
@ -43,13 +43,13 @@
|
|||||||
/*!
|
/*!
|
||||||
* \brief Check if alignas(*) keyword is supported. (g++ 4.8 or higher)
|
* \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)
|
#define XGBOOST_ALIGNAS(X) alignas(X)
|
||||||
#else
|
#else
|
||||||
#define XGBOOST_ALIGNAS(X)
|
#define XGBOOST_ALIGNAS(X)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ >= 8 && \
|
#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || __GNUC__ > 4) && \
|
||||||
!defined(__CUDACC__)
|
!defined(__CUDACC__)
|
||||||
#include <parallel/algorithm>
|
#include <parallel/algorithm>
|
||||||
#define XGBOOST_PARALLEL_SORT(X, Y, Z) __gnu_parallel::sort((X), (Y), (Z))
|
#define XGBOOST_PARALLEL_SORT(X, Y, Z) __gnu_parallel::sort((X), (Y), (Z))
|
||||||
|
|||||||
@ -414,7 +414,7 @@ void prefixsum_inplace(size_t *x, size_t N) {
|
|||||||
suma[ithread+1] = sum;
|
suma[ithread+1] = sum;
|
||||||
#pragma omp barrier
|
#pragma omp barrier
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
for (omp_ulong i = 0; i < (ithread+1); i++) {
|
for (omp_ulong i = 0; i < static_cast<omp_ulong>(ithread+1); i++) {
|
||||||
offset += suma[i];
|
offset += suma[i];
|
||||||
}
|
}
|
||||||
#pragma omp for schedule(static)
|
#pragma omp for schedule(static)
|
||||||
@ -442,7 +442,6 @@ XGB_DLL int XGDMatrixCreateFromMat_omp(const bst_float* data,
|
|||||||
// const int nthreadmax = omp_get_max_threads();
|
// const int nthreadmax = omp_get_max_threads();
|
||||||
if (nthread <= 0) nthread=nthreadmax;
|
if (nthread <= 0) nthread=nthreadmax;
|
||||||
omp_set_num_threads(nthread);
|
omp_set_num_threads(nthread);
|
||||||
xgboost::bst_ulong nrow_reserve_per_thread = std::ceil(nrow/static_cast<double>(nthread));
|
|
||||||
|
|
||||||
std::unique_ptr<data::SimpleCSRSource> source(new data::SimpleCSRSource());
|
std::unique_ptr<data::SimpleCSRSource> source(new data::SimpleCSRSource());
|
||||||
data::SimpleCSRSource& mat = *source;
|
data::SimpleCSRSource& mat = *source;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user