[CI] Add Windows GPU to Jenkins CI pipeline (#4463)
* Fix #4462: Use /MT flag consistently for MSVC target * First attempt at Windows CI * Distinguish stages in Linux and Windows pipelines * Try running CMake in Windows pipeline * Add build step
This commit is contained in:
parent
e7d17ec4f4
commit
c6f2a7e186
@ -10,7 +10,6 @@ if (MSVC)
|
|||||||
endif (MSVC)
|
endif (MSVC)
|
||||||
|
|
||||||
set_default_configuration_release()
|
set_default_configuration_release()
|
||||||
msvc_use_static_runtime()
|
|
||||||
|
|
||||||
#-- Options
|
#-- Options
|
||||||
option(BUILD_C_DOC "Build documentation for C APIs using Doxygen." OFF)
|
option(BUILD_C_DOC "Build documentation for C APIs using Doxygen." OFF)
|
||||||
@ -67,6 +66,7 @@ if (USE_CUDA)
|
|||||||
endif (USE_CUDA)
|
endif (USE_CUDA)
|
||||||
|
|
||||||
# dmlc-core
|
# dmlc-core
|
||||||
|
msvc_use_static_runtime()
|
||||||
add_subdirectory(${PROJECT_SOURCE_DIR}/dmlc-core)
|
add_subdirectory(${PROJECT_SOURCE_DIR}/dmlc-core)
|
||||||
set_target_properties(dmlc PROPERTIES
|
set_target_properties(dmlc PROPERTIES
|
||||||
CXX_STANDARD 11
|
CXX_STANDARD 11
|
||||||
@ -139,6 +139,8 @@ set_target_properties(
|
|||||||
|
|
||||||
set_output_directory(runxgboost ${PROJECT_SOURCE_DIR})
|
set_output_directory(runxgboost ${PROJECT_SOURCE_DIR})
|
||||||
set_output_directory(xgboost ${PROJECT_SOURCE_DIR}/lib)
|
set_output_directory(xgboost ${PROJECT_SOURCE_DIR}/lib)
|
||||||
|
# Ensure these two targets do not build simultaneously, as they produce outputs with conflicting names
|
||||||
|
add_dependencies(xgboost runxgboost)
|
||||||
|
|
||||||
#-- Installing XGBoost
|
#-- Installing XGBoost
|
||||||
if (R_LIB)
|
if (R_LIB)
|
||||||
@ -214,3 +216,8 @@ if (GOOGLE_TEST)
|
|||||||
PROPERTIES
|
PROPERTIES
|
||||||
PASS_REGULAR_EXPRESSION ".*test-rmse:0.087.*")
|
PASS_REGULAR_EXPRESSION ".*test-rmse:0.087.*")
|
||||||
endif (GOOGLE_TEST)
|
endif (GOOGLE_TEST)
|
||||||
|
|
||||||
|
# For MSVC: Call msvc_use_static_runtime() once again to completely
|
||||||
|
# replace /MD with /MT. See https://github.com/dmlc/xgboost/issues/4462
|
||||||
|
# for issues caused by mixing of /MD and /MT flags
|
||||||
|
msvc_use_static_runtime()
|
||||||
|
|||||||
8
Jenkinsfile
vendored
8
Jenkinsfile
vendored
@ -25,7 +25,7 @@ pipeline {
|
|||||||
|
|
||||||
// Build stages
|
// Build stages
|
||||||
stages {
|
stages {
|
||||||
stage('Get sources') {
|
stage('Jenkins Linux: Get sources') {
|
||||||
agent { label 'linux && cpu' }
|
agent { label 'linux && cpu' }
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
@ -35,7 +35,7 @@ pipeline {
|
|||||||
milestone ordinal: 1
|
milestone ordinal: 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Formatting Check') {
|
stage('Jenkins Linux: Formatting Check') {
|
||||||
agent none
|
agent none
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
@ -49,7 +49,7 @@ pipeline {
|
|||||||
milestone ordinal: 2
|
milestone ordinal: 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Jenkins Linux: Build') {
|
||||||
agent none
|
agent none
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
@ -65,7 +65,7 @@ pipeline {
|
|||||||
milestone ordinal: 3
|
milestone ordinal: 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Test') {
|
stage('Jenkins Linux: Test') {
|
||||||
agent none
|
agent none
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
|
|||||||
70
Jenkinsfile-win64
Normal file
70
Jenkinsfile-win64
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
#!/usr/bin/groovy
|
||||||
|
// -*- mode: groovy -*-
|
||||||
|
|
||||||
|
/* Jenkins pipeline for Windows AMD64 target */
|
||||||
|
|
||||||
|
pipeline {
|
||||||
|
agent none
|
||||||
|
// Build stages
|
||||||
|
stages {
|
||||||
|
stage('Jenkins Win64: Get sources') {
|
||||||
|
agent { label 'win64' }
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
checkoutSrcs()
|
||||||
|
}
|
||||||
|
stash name: 'srcs'
|
||||||
|
milestone ordinal: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Jenkins Win64: Build') {
|
||||||
|
agent none
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
parallel ([
|
||||||
|
'build-win64': { BuildWin64() }
|
||||||
|
])
|
||||||
|
}
|
||||||
|
milestone ordinal: 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check out source code from git
|
||||||
|
def checkoutSrcs() {
|
||||||
|
retry(5) {
|
||||||
|
try {
|
||||||
|
timeout(time: 2, unit: 'MINUTES') {
|
||||||
|
checkout scm
|
||||||
|
sh 'git submodule update --init'
|
||||||
|
}
|
||||||
|
} catch (exc) {
|
||||||
|
deleteDir()
|
||||||
|
error "Failed to fetch source codes"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def BuildWin64() {
|
||||||
|
node('win64') {
|
||||||
|
unstash name: 'srcs'
|
||||||
|
echo "Building XGBoost for Windows AMD64 target..."
|
||||||
|
bat """
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake .. -G"Visual Studio 15 2017 Win64" -DUSE_CUDA=ON -DCMAKE_VERBOSE_MAKEFILE=ON
|
||||||
|
"""
|
||||||
|
bat """
|
||||||
|
cd build
|
||||||
|
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe" xgboost.sln /m /p:Configuration=Release
|
||||||
|
"""
|
||||||
|
bat """
|
||||||
|
cd python-package
|
||||||
|
conda activate && python setup.py bdist_wheel --universal
|
||||||
|
"""
|
||||||
|
stash name: 'xgboost_win_whl', includes: 'python-package/dist/*.whl'
|
||||||
|
archiveArtifacts artifacts: "python-package/dist/*.whl", allowEmptyArchive: true
|
||||||
|
deleteDir()
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -17,6 +17,10 @@ endfunction(auto_source_group)
|
|||||||
function(msvc_use_static_runtime)
|
function(msvc_use_static_runtime)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set(variables
|
set(variables
|
||||||
|
CMAKE_C_FLAGS_DEBUG
|
||||||
|
CMAKE_C_FLAGS_MINSIZEREL
|
||||||
|
CMAKE_C_FLAGS_RELEASE
|
||||||
|
CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||||
CMAKE_CXX_FLAGS_DEBUG
|
CMAKE_CXX_FLAGS_DEBUG
|
||||||
CMAKE_CXX_FLAGS_MINSIZEREL
|
CMAKE_CXX_FLAGS_MINSIZEREL
|
||||||
CMAKE_CXX_FLAGS_RELEASE
|
CMAKE_CXX_FLAGS_RELEASE
|
||||||
@ -29,6 +33,7 @@ function(msvc_use_static_runtime)
|
|||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
set(variables
|
set(variables
|
||||||
|
CMAKE_CUDA_FLAGS
|
||||||
CMAKE_CUDA_FLAGS_DEBUG
|
CMAKE_CUDA_FLAGS_DEBUG
|
||||||
CMAKE_CUDA_FLAGS_MINSIZEREL
|
CMAKE_CUDA_FLAGS_MINSIZEREL
|
||||||
CMAKE_CUDA_FLAGS_RELEASE
|
CMAKE_CUDA_FLAGS_RELEASE
|
||||||
@ -39,6 +44,10 @@ function(msvc_use_static_runtime)
|
|||||||
string(REGEX REPLACE "-MD" "-MT" ${variable} "${${variable}}")
|
string(REGEX REPLACE "-MD" "-MT" ${variable} "${${variable}}")
|
||||||
set(${variable} "${${variable}}" PARENT_SCOPE)
|
set(${variable} "${${variable}}" PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
|
if(${variable} MATCHES "/MD")
|
||||||
|
string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}")
|
||||||
|
set(${variable} "${${variable}}" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
endfunction(msvc_use_static_runtime)
|
endfunction(msvc_use_static_runtime)
|
||||||
|
|||||||
@ -42,7 +42,7 @@ if (USE_CUDA)
|
|||||||
$<$<COMPILE_LANGUAGE:CUDA>:--expt-extended-lambda>
|
$<$<COMPILE_LANGUAGE:CUDA>:--expt-extended-lambda>
|
||||||
$<$<COMPILE_LANGUAGE:CUDA>:--expt-relaxed-constexpr>
|
$<$<COMPILE_LANGUAGE:CUDA>:--expt-relaxed-constexpr>
|
||||||
$<$<COMPILE_LANGUAGE:CUDA>:-lineinfo>
|
$<$<COMPILE_LANGUAGE:CUDA>:-lineinfo>
|
||||||
$<$<COMPILE_LANGUAGE:CUDA>:--std=c++11>
|
$<$<AND:$<NOT:$<CXX_COMPILER_ID:MSVC>>,$<COMPILE_LANGUAGE:CUDA>>:--std=c++11>
|
||||||
$<$<COMPILE_LANGUAGE:CUDA>:${GEN_CODE}>)
|
$<$<COMPILE_LANGUAGE:CUDA>:${GEN_CODE}>)
|
||||||
|
|
||||||
if (USE_NCCL)
|
if (USE_NCCL)
|
||||||
@ -113,4 +113,10 @@ if (USE_OPENMP)
|
|||||||
set(LINKED_LIBRARIES_PRIVATE "${LINKED_LIBRARIES_PRIVATE};${SRC_LIBS}" PARENT_SCOPE)
|
set(LINKED_LIBRARIES_PRIVATE "${LINKED_LIBRARIES_PRIVATE};${SRC_LIBS}" PARENT_SCOPE)
|
||||||
endif (OpenMP_CXX_FOUND OR OPENMP_FOUND)
|
endif (OpenMP_CXX_FOUND OR OPENMP_FOUND)
|
||||||
endif (USE_OPENMP)
|
endif (USE_OPENMP)
|
||||||
|
|
||||||
|
# For MSVC: Call msvc_use_static_runtime() once again to completely
|
||||||
|
# replace /MD with /MT. See https://github.com/dmlc/xgboost/issues/4462
|
||||||
|
# for issues caused by mixing of /MD and /MT flags
|
||||||
|
msvc_use_static_runtime()
|
||||||
|
|
||||||
#-- End object library
|
#-- End object library
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user