[CI] Add Python and C++ tests for Windows GPU target (#4469)
* Add CMake option to use bundled gtest from dmlc-core, so that it is easy to build XGBoost with gtest on Windows * Consistently apply OpenMP flag to all targets. Force enable OpenMP when USE_CUDA is turned on. * Insert vcomp140.dll into Windows wheels * Add C++ and Python tests for CPU and GPU targets (CUDA 9.0, 10.0, 10.1) * Prevent spurious msbuild failure * Add GPU tests * Upgrade dmlc-core
This commit is contained in:
committed by
GitHub
parent
3e930e4f2d
commit
cf2400036e
18
tests/ci_build/insert_vcomp140.py
Normal file
18
tests/ci_build/insert_vcomp140.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import sys
|
||||
import re
|
||||
import zipfile
|
||||
import glob
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print('Usage: {} [wheel]'.format(sys.argv[0]))
|
||||
sys.exit(1)
|
||||
|
||||
vcomp140_path = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\14.0\\VC\\redist\\x64\\Microsoft.VC140.OpenMP\\vcomp140.dll'
|
||||
|
||||
for wheel_path in sorted(glob.glob(sys.argv[1])):
|
||||
m = re.search(r'xgboost-(.*)-py2.py3', wheel_path)
|
||||
assert m
|
||||
version = m.group(1)
|
||||
|
||||
with zipfile.ZipFile(wheel_path, 'a') as f:
|
||||
f.write(vcomp140_path, 'xgboost-{}.data/data/xgboost/vcomp140.dll'.format(version))
|
||||
@@ -1,4 +1,11 @@
|
||||
find_package(GTest REQUIRED)
|
||||
if (USE_DMLC_GTEST)
|
||||
if (NOT TARGET gtest)
|
||||
message(FATAL_ERROR "USE_DMLC_GTEST=ON but dmlc-core didn't bundle gtest")
|
||||
endif (NOT TARGET gtest)
|
||||
set(GTEST_LIBRARIES gtest)
|
||||
else (USE_DMLC_GTEST)
|
||||
find_package(GTest REQUIRED)
|
||||
endif (USE_DMLC_GTEST)
|
||||
file(GLOB_RECURSE TEST_SOURCES "*.cc")
|
||||
|
||||
if (USE_CUDA)
|
||||
@@ -8,13 +15,16 @@ endif (USE_CUDA)
|
||||
add_executable(testxgboost ${TEST_SOURCES} ${XGBOOST_OBJ_SOURCES})
|
||||
|
||||
if (USE_CUDA)
|
||||
# OpenMP is mandatory for CUDA
|
||||
find_package(OpenMP REQUIRED)
|
||||
target_include_directories(testxgboost PRIVATE
|
||||
${PROJECT_SOURCE_DIR}/cub/)
|
||||
target_compile_options(testxgboost PRIVATE
|
||||
$<$<COMPILE_LANGUAGE:CUDA>:--expt-extended-lambda>
|
||||
$<$<COMPILE_LANGUAGE:CUDA>:--expt-relaxed-constexpr>
|
||||
$<$<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>:-Xcompiler=${OpenMP_CXX_FLAGS}>
|
||||
$<$<COMPILE_LANGUAGE:CUDA>:${GEN_CODE}>)
|
||||
target_compile_definitions(testxgboost
|
||||
PRIVATE -DXGBOOST_USE_CUDA=1)
|
||||
|
||||
Reference in New Issue
Block a user