Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU optimizations #4433

Closed
wants to merge 57 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
7085bf3
Initial support for external memory in gpu_predictor (#4284)
rongou May 3, 2019
33e3669
max_digits10 guarantees float decimal roundtrip (#4435)
ras44 May 3, 2019
5670bdb
Make AUCPR work with multiple query groups (#4436)
hcho3 May 3, 2019
6f3feae
In AUC and AUCPR metrics, detect whether weights are per-instance or …
xydrolase May 4, 2019
b6d65b6
Change obj name to `reg:squarederror` in learner. (#4427)
trivialfis May 6, 2019
dfd8404
[jvm-packages] Tutorial on handling missing values (#4425)
Daniel8hen May 6, 2019
8f4f85f
Fix list formatting in missing value tutorial in XGBoost4J-Spark
hcho3 May 6, 2019
ef7c0e8
Fix list formatting in missing value tutorial in XGBoost4J-Spark
hcho3 May 6, 2019
8e9ced9
Enable building with shared NCCL. (#4447)
trivialfis May 9, 2019
6e119a9
[jvm-packages] Automatically set maximize_evaluation_metrics if not e…
shishaochen May 9, 2019
060e12f
[BLOCKING][CI] Upgrade to Spark 2.4.3 (#4414)
hcho3 May 10, 2019
63514b6
Correctly determine cuda version (#4453)
RAMitchell May 10, 2019
972ddcd
mgpu predictor using explicit offsets (#4438)
rongou May 10, 2019
5f8918a
[CI] Cache two R build Docker containers (#4458)
hcho3 May 11, 2019
b2aa0f3
[CI] Build XGBoost wheels with CUDA 9.0 (#4459)
hcho3 May 11, 2019
a9cc3d2
[CI] Add Windows GPU to Jenkins CI pipeline (#4463)
hcho3 May 14, 2019
c4f3650
add cuda 10.1 support (#4468)
rongou May 14, 2019
e1cff4e
only copy the model once when predicting multiple batches (#4457)
rongou May 14, 2019
158abfb
added JSON vignette (#4439)
ras44 May 15, 2019
d2a6bbf
[CI] Add Python and C++ tests for Windows GPU target (#4469)
hcho3 May 16, 2019
8bf185f
Update xgboost4j_spark_tutorial.rst (#4476)
CodingCat May 17, 2019
de8c987
[RFC] Version 0.90 release candidate (#4475)
hcho3 May 20, 2019
4a89a9a
Ensure pandas DataFrame column names are treated as strings in type e…
srowen May 21, 2019
b0fc145
Add support for cross-validation using query ID (#4474)
bryan-woods May 23, 2019
23b0cfe
[jvm-packages] Add back reg:linear for scala. (#4490)
trivialfis May 23, 2019
4f86f2e
Add python RF documentation (#4500)
RAMitchell May 25, 2019
25a6316
Revert hist init optimization. (#4502)
trivialfis May 26, 2019
8289379
Add native support for Dask (#4473)
RAMitchell May 27, 2019
aef055d
add dll_path for cygwin users (#4499)
yellowdolphin May 27, 2019
2c94d2b
Initial performance optimizations for xgboost
SmirnovEgorRu Dec 2, 2018
c28f768
remove includes
SmirnovEgorRu Dec 2, 2018
34bc965
fix for CI
SmirnovEgorRu Dec 4, 2018
00f6c9d
fix for CI
SmirnovEgorRu Dec 5, 2018
196b2ae
Check existence of _mm_prefetch and __builtin_prefetch
hcho3 Jan 4, 2019
ee60036
next part of optimizations
SmirnovEgorRu May 2, 2019
238616e
next part of optimizations
SmirnovEgorRu May 2, 2019
8102c7b
Build fixes
SmirnovEgorRu May 2, 2019
3a52753
CI fixing
SmirnovEgorRu May 2, 2019
69c9688
Conform to C++ style convention (cpplint)
hcho3 May 3, 2019
1d8d018
CI fixing
SmirnovEgorRu May 4, 2019
9fff636
Fix for gpu building
SmirnovEgorRu May 22, 2019
8856db0
revert doubles for GradStat and some tests
SmirnovEgorRu May 24, 2019
6dbd2e8
support of distributed building
SmirnovEgorRu May 24, 2019
f4de83d
fix windows errors and code cleaning
SmirnovEgorRu May 24, 2019
d8a9248
fix distributed lossguide
SmirnovEgorRu May 24, 2019
f95c58c
fix issues with lossguide
SmirnovEgorRu May 25, 2019
f4d9b1a
fix case when split_score can be nan or inf
SmirnovEgorRu May 25, 2019
4229063
code cleaning
SmirnovEgorRu May 25, 2019
7d85133
Fix dask API sphinx docstrings (#4507)
RAMitchell May 28, 2019
3b710ce
De-duplicate GPU parameters. (#4454)
trivialfis May 29, 2019
65dc511
Fix crash with approx tree method on cpu (#4510)
sriramch May 29, 2019
ebee414
- training with external memory part 1 of 2 (#4486)
sriramch May 29, 2019
039a902
Fix prediction from loaded pickle. (#4516)
trivialfis May 30, 2019
331e929
Simplify INI-style config reader using C++11 STL (#4478)
fuhaoda May 30, 2019
826d560
Smarter choice of histogram construction for distributed gpu_hist (#…
RAMitchell May 31, 2019
7923f64
Enforce exclusion between pred_interactions=True and pred_interaction…
hcho3 May 31, 2019
9d44acf
Fix #4497: Enable feature importance property for DART booster (#4525)
hcho3 May 31, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,6 @@ plugin/updater_gpu/test/cpp/data
# files from R-package source install
**/config.status
R-package/src/Makevars

# Python install
python-package/xgboost/tracker.py
41 changes: 39 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.3)
project(xgboost LANGUAGES CXX C VERSION 0.82)
project(xgboost LANGUAGES CXX C VERSION 0.90)
include(cmake/Utils.cmake)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
cmake_policy(SET CMP0022 NEW)
Expand All @@ -10,7 +10,6 @@ if (MSVC)
endif (MSVC)

set_default_configuration_release()
msvc_use_static_runtime()

#-- Options
option(BUILD_C_DOC "Build documentation for C APIs using Doxygen." OFF)
Expand All @@ -20,13 +19,18 @@ option(JVM_BINDINGS "Build JVM bindings" OFF)
option(R_LIB "Build shared library for R package" OFF)
## Dev
option(GOOGLE_TEST "Build google tests" OFF)
option(USE_DMLC_GTEST "Use google tests bundled with dmlc-core submodule (EXPERIMENTAL)" OFF)
option(USE_NVTX "Build with cuda profiling annotations. Developers only." OFF)
set(NVTX_HEADER_DIR "" CACHE PATH "Path to the stand-alone nvtx header")
## CUDA
option(USE_CUDA "Build with GPU acceleration" OFF)
option(USE_NCCL "Build with NCCL to enable multi-GPU support." OFF)
option(BUILD_WITH_SHARED_NCCL "Build with shared NCCL library." OFF)
set(GPU_COMPUTE_VER "" CACHE STRING
"Semicolon separated list of compute versions to be built against, e.g. '35;61'")
if (BUILD_WITH_SHARED_NCCL AND (NOT USE_NCCL))
message(SEND_ERROR "Build XGBoost with -DUSE_NCCL=ON to enable BUILD_WITH_SHARED_NCCL.")
endif (BUILD_WITH_SHARED_NCCL AND (NOT USE_NCCL))
## Sanitizers
option(USE_SANITIZER "Use santizer flags" OFF)
option(SANITIZER_PATH "Path to sanitizes.")
Expand All @@ -42,6 +46,26 @@ if (USE_AVX)
message(WARNING "The option 'USE_AVX' is deprecated as experimental AVX features have been removed from xgboost.")
endif (USE_AVX)

# Check existence of software pre-fetching
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <xmmintrin.h>
int main() {
char data = 0;
const char* address = &data;
_mm_prefetch(address, _MM_HINT_NTA);
return 0;
}
" XGBOOST_MM_PREFETCH_PRESENT)
check_cxx_source_compiles("
int main() {
char data = 0;
const char* address = &data;
__builtin_prefetch(address, 0, 0);
return 0;
}
" XGBOOST_BUILTIN_PREFETCH_PRESENT)

# Sanitizer
if (USE_SANITIZER)
# Older CMake versions have had troubles with Sanitizer
Expand All @@ -52,6 +76,7 @@ endif (USE_SANITIZER)

if (USE_CUDA)
cmake_minimum_required(VERSION 3.12)
SET(USE_OPENMP ON CACHE BOOL "CUDA requires OpenMP" FORCE)
# `export CXX=' is ignored by CMake CUDA.
set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER})
message(STATUS "Configured CUDA host compiler: ${CMAKE_CUDA_HOST_COMPILER}")
Expand All @@ -63,6 +88,7 @@ if (USE_CUDA)
endif (USE_CUDA)

# dmlc-core
msvc_use_static_runtime()
add_subdirectory(${PROJECT_SOURCE_DIR}/dmlc-core)
set_target_properties(dmlc PROPERTIES
CXX_STANDARD 11
Expand Down Expand Up @@ -120,6 +146,10 @@ endif (JVM_BINDINGS)
#-- CLI for xgboost
add_executable(runxgboost ${PROJECT_SOURCE_DIR}/src/cli_main.cc ${XGBOOST_OBJ_SOURCES})
# For cli_main.cc only
if (USE_OPENMP)
find_package(OpenMP REQUIRED)
target_compile_options(runxgboost PRIVATE ${OpenMP_CXX_FLAGS})
endif (USE_OPENMP)
target_include_directories(runxgboost
PRIVATE
${PROJECT_SOURCE_DIR}/include
Expand All @@ -135,6 +165,8 @@ set_target_properties(

set_output_directory(runxgboost ${PROJECT_SOURCE_DIR})
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
if (R_LIB)
Expand Down Expand Up @@ -210,3 +242,8 @@ if (GOOGLE_TEST)
PROPERTIES
PASS_REGULAR_EXPRESSION ".*test-rmse:0.087.*")
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()
3 changes: 3 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,6 @@ List of Contributors
* [Sam Wilkinson](https://samwilkinson.io)
* [Matthew Jones](https://github.com/mt-jones)
* [Jiaxiang Li](https://github.com/JiaxiangBU)
* [Bryan Woods](https://github.com/bryan-woods)
- Bryan added support for cross-validation for the ranking objective
* [Haoda Fu](https://github.com/fuhaoda)
61 changes: 40 additions & 21 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pipeline {

// Build stages
stages {
stage('Get sources') {
stage('Jenkins Linux: Get sources') {
agent { label 'linux && cpu' }
steps {
script {
Expand All @@ -35,7 +35,7 @@ pipeline {
milestone ordinal: 1
}
}
stage('Formatting Check') {
stage('Jenkins Linux: Formatting Check') {
agent none
steps {
script {
Expand All @@ -49,35 +49,37 @@ pipeline {
milestone ordinal: 2
}
}
stage('Build') {
stage('Jenkins Linux: Build') {
agent none
steps {
script {
parallel ([
'build-cpu': { BuildCPU() },
'build-gpu-cuda8.0': { BuildCUDA(cuda_version: '8.0') },
'build-gpu-cuda9.2': { BuildCUDA(cuda_version: '9.2') },
'build-gpu-cuda9.0': { BuildCUDA(cuda_version: '9.0') },
'build-gpu-cuda10.0': { BuildCUDA(cuda_version: '10.0') },
'build-jvm-packages': { BuildJVMPackages(spark_version: '2.4.1') },
'build-gpu-cuda10.1': { BuildCUDA(cuda_version: '10.1') },
'build-jvm-packages': { BuildJVMPackages(spark_version: '2.4.3') },
'build-jvm-doc': { BuildJVMDoc() }
])
}
milestone ordinal: 3
}
}
stage('Test') {
stage('Jenkins Linux: Test') {
agent none
steps {
script {
parallel ([
'test-python-cpu': { TestPythonCPU() },
'test-python-gpu-cuda8.0': { TestPythonGPU(cuda_version: '8.0') },
'test-python-gpu-cuda9.2': { TestPythonGPU(cuda_version: '9.2') },
'test-python-gpu-cuda9.0': { TestPythonGPU(cuda_version: '9.0') },
'test-python-gpu-cuda10.0': { TestPythonGPU(cuda_version: '10.0') },
'test-python-mgpu-cuda10.0': { TestPythonGPU(cuda_version: '10.0', multi_gpu: true) },
'test-cpp-gpu': { TestCppGPU(cuda_version: '10.0') },
'test-cpp-mgpu': { TestCppGPU(cuda_version: '10.0', multi_gpu: true) },
'test-jvm-jdk8': { CrossTestJVMwithJDK(jdk_version: '8') },
'test-python-gpu-cuda10.1': { TestPythonGPU(cuda_version: '10.1') },
'test-python-mgpu-cuda10.1': { TestPythonGPU(cuda_version: '10.1', multi_gpu: true) },
'test-cpp-gpu': { TestCppGPU(cuda_version: '10.1') },
'test-cpp-mgpu': { TestCppGPU(cuda_version: '10.1', multi_gpu: true) },
'test-jvm-jdk8': { CrossTestJVMwithJDK(jdk_version: '8', spark_version: '2.4.3') },
'test-jvm-jdk11': { CrossTestJVMwithJDK(jdk_version: '11') },
'test-jvm-jdk12': { CrossTestJVMwithJDK(jdk_version: '12') },
'test-r-3.4.4': { TestR(use_r35: false) },
Expand Down Expand Up @@ -153,8 +155,11 @@ def Doxygen() {
def container_type = "cpu"
def docker_binary = "docker"
sh """
${dockerRun} ${container_type} ${docker_binary} tests/ci_build/doxygen.sh
${dockerRun} ${container_type} ${docker_binary} tests/ci_build/doxygen.sh ${BRANCH_NAME}
"""
archiveArtifacts artifacts: "build/${BRANCH_NAME}.tar.bz2", allowEmptyArchive: true
echo 'Uploading doc...'
s3Upload file: "build/${BRANCH_NAME}.tar.bz2", bucket: 'xgboost-docs', acl: 'PublicRead', path: "doxygen/${BRANCH_NAME}.tar.bz2"
deleteDir()
}
}
Expand Down Expand Up @@ -192,10 +197,13 @@ def BuildCUDA(args) {
${dockerRun} ${container_type} ${docker_binary} ${docker_args} tests/ci_build/build_via_cmake.sh -DUSE_CUDA=ON -DUSE_NCCL=ON -DOPEN_MP:BOOL=ON
${dockerRun} ${container_type} ${docker_binary} ${docker_args} bash -c "cd python-package && rm -rf dist/* && python setup.py bdist_wheel --universal"
"""
// Only stash wheel for CUDA 8.0 target
// Stash wheel for CUDA 8.0 / 9.0 target
if (args.cuda_version == '8.0') {
echo 'Stashing Python wheel...'
stash name: 'xgboost_whl', includes: 'python-package/dist/*.whl'
stash name: 'xgboost_whl_cuda8', includes: 'python-package/dist/*.whl'
} else if (args.cuda_version == '9.0') {
echo 'Stashing Python wheel...'
stash name: 'xgboost_whl_cuda9', includes: 'python-package/dist/*.whl'
archiveArtifacts artifacts: "python-package/dist/*.whl", allowEmptyArchive: true
echo 'Stashing C++ test executable (testxgboost)...'
stash name: 'xgboost_cpp_tests', includes: 'build/testxgboost'
Expand All @@ -213,7 +221,7 @@ def BuildJVMPackages(args) {
// Use only 4 CPU cores
def docker_extra_params = "CI_DOCKER_EXTRA_PARAMS_INIT='--cpuset-cpus 0-3'"
sh """
${docker_extra_params} ${dockerRun} ${container_type} ${docker_binary} tests/ci_build/build_jvm_packages.sh
${docker_extra_params} ${dockerRun} ${container_type} ${docker_binary} tests/ci_build/build_jvm_packages.sh ${args.spark_version}
"""
echo 'Stashing XGBoost4J JAR...'
stash name: 'xgboost4j_jar', includes: 'jvm-packages/xgboost4j/target/*.jar,jvm-packages/xgboost4j-spark/target/*.jar,jvm-packages/xgboost4j-example/target/*.jar'
Expand All @@ -239,7 +247,7 @@ def BuildJVMDoc() {

def TestPythonCPU() {
node('linux && cpu') {
unstash name: 'xgboost_whl'
unstash name: 'xgboost_whl_cuda9'
unstash name: 'srcs'
echo "Test Python CPU"
def container_type = "cpu"
Expand All @@ -254,7 +262,11 @@ def TestPythonCPU() {
def TestPythonGPU(args) {
nodeReq = (args.multi_gpu) ? 'linux && mgpu' : 'linux && gpu'
node(nodeReq) {
unstash name: 'xgboost_whl'
if (args.cuda_version == '8.0') {
unstash name: 'xgboost_whl_cuda8'
} else {
unstash name: 'xgboost_whl_cuda9'
}
unstash name: 'srcs'
echo "Test Python GPU: CUDA ${args.cuda_version}"
def container_type = "gpu"
Expand Down Expand Up @@ -299,12 +311,17 @@ def CrossTestJVMwithJDK(args) {
node('linux && cpu') {
unstash name: 'xgboost4j_jar'
unstash name: 'srcs'
echo "Test XGBoost4J on a machine with JDK ${args.jdk_version}"
if (args.spark_version != null) {
echo "Test XGBoost4J on a machine with JDK ${args.jdk_version}, Spark ${args.spark_version}"
} else {
echo "Test XGBoost4J on a machine with JDK ${args.jdk_version}"
}
def container_type = "jvm_cross"
def docker_binary = "docker"
def docker_args = "--build-arg JDK_VERSION=${args.jdk_version}"
// Only run integration tests for JDK 8, as Spark doesn't support later JDKs yet
def docker_extra_params = (args.jdk_version == '8') ? "CI_DOCKER_EXTRA_PARAMS_INIT='-e RUN_INTEGRATION_TEST=1'" : ""
def spark_arg = (args.spark_version != null) ? "--build-arg SPARK_VERSION=${args.spark_version}" : ""
def docker_args = "--build-arg JDK_VERSION=${args.jdk_version} ${spark_arg}"
// Run integration tests only when spark_version is given
def docker_extra_params = (args.spark_version != null) ? "CI_DOCKER_EXTRA_PARAMS_INIT='-e RUN_INTEGRATION_TEST=1'" : ""
sh """
${docker_extra_params} ${dockerRun} ${container_type} ${docker_binary} ${docker_args} tests/ci_build/test_jvm_cross.sh
"""
Expand All @@ -323,6 +340,8 @@ def TestR(args) {
sh """
${dockerRun} ${container_type} ${docker_binary} ${docker_args} tests/ci_build/build_test_rpkg.sh
"""
// Save error log, if any
archiveArtifacts artifacts: "xgboost.Rcheck/00install.out", allowEmptyArchive: true
deleteDir()
}
}
Loading