Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36eb41c960 | ||
|
|
39ddf40a8d | ||
|
|
573f1c7db4 | ||
|
|
abc80d2a6d | ||
|
|
e882fb3262 | ||
|
|
3218f6cd3c | ||
|
|
a962611de7 | ||
|
|
14476e8868 | ||
|
|
03f3879b71 | ||
|
|
21d95f3d8f | ||
|
|
5cd4015d70 | ||
|
|
b8c6b86792 | ||
|
|
1baebe231b | ||
|
|
365da0b8f4 | ||
|
|
f5f03dfb61 | ||
|
|
a1c209182d | ||
|
|
4be75d852c | ||
|
|
ba50e6eb62 |
73
.github/workflows/main.yml
vendored
73
.github/workflows/main.yml
vendored
@@ -148,66 +148,13 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
LINT_LANG=cpp make lint
|
LINT_LANG=cpp make lint
|
||||||
|
|
||||||
doxygen:
|
python3 dmlc-core/scripts/lint.py --exclude_path \
|
||||||
runs-on: ubuntu-latest
|
python-package/xgboost/dmlc-core \
|
||||||
name: Generate C/C++ API doc using Doxygen
|
python-package/xgboost/include \
|
||||||
steps:
|
python-package/xgboost/lib \
|
||||||
- uses: actions/checkout@v2
|
python-package/xgboost/rabit \
|
||||||
with:
|
python-package/xgboost/src \
|
||||||
submodules: 'true'
|
--pylint-rc python-package/.pylintrc \
|
||||||
- uses: actions/setup-python@v2
|
xgboost \
|
||||||
with:
|
cpp \
|
||||||
python-version: "3.8"
|
include src python-package
|
||||||
architecture: 'x64'
|
|
||||||
- name: Install system packages
|
|
||||||
run: |
|
|
||||||
sudo apt-get install -y --no-install-recommends doxygen graphviz ninja-build
|
|
||||||
python -m pip install wheel setuptools
|
|
||||||
python -m pip install awscli
|
|
||||||
- name: Run Doxygen
|
|
||||||
run: |
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake .. -DBUILD_C_DOC=ON -GNinja
|
|
||||||
ninja -v doc_doxygen
|
|
||||||
- name: Extract branch name
|
|
||||||
shell: bash
|
|
||||||
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
|
|
||||||
id: extract_branch
|
|
||||||
if: github.ref == 'refs/heads/master' || contains(github.ref, 'refs/heads/release_')
|
|
||||||
- name: Publish
|
|
||||||
run: |
|
|
||||||
cd build/
|
|
||||||
tar cvjf ${{ steps.extract_branch.outputs.branch }}.tar.bz2 doc_doxygen/
|
|
||||||
python -m awscli s3 cp ./${{ steps.extract_branch.outputs.branch }}.tar.bz2 s3://xgboost-docs/doxygen/ --acl public-read
|
|
||||||
if: github.ref == 'refs/heads/master' || contains(github.ref, 'refs/heads/release_')
|
|
||||||
env:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_IAM_S3_UPLOADER }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_IAM_S3_UPLOADER }}
|
|
||||||
|
|
||||||
sphinx:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Build docs using Sphinx
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
submodules: 'true'
|
|
||||||
- uses: actions/setup-python@v2
|
|
||||||
with:
|
|
||||||
python-version: "3.8"
|
|
||||||
architecture: 'x64'
|
|
||||||
- name: Install system packages
|
|
||||||
run: |
|
|
||||||
sudo apt-get install -y --no-install-recommends graphviz
|
|
||||||
python -m pip install wheel setuptools
|
|
||||||
python -m pip install -r doc/requirements.txt
|
|
||||||
- name: Extract branch name
|
|
||||||
shell: bash
|
|
||||||
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
|
|
||||||
id: extract_branch
|
|
||||||
if: github.ref == 'refs/heads/master' || contains(github.ref, 'refs/heads/release_')
|
|
||||||
- name: Run Sphinx
|
|
||||||
run: |
|
|
||||||
make -C doc html
|
|
||||||
env:
|
|
||||||
SPHINX_GIT_BRANCH: ${{ steps.extract_branch.outputs.branch }}
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
|
||||||
project(xgboost LANGUAGES CXX C VERSION 1.7.4)
|
project(xgboost LANGUAGES CXX C VERSION 1.7.6)
|
||||||
include(cmake/Utils.cmake)
|
include(cmake/Utils.cmake)
|
||||||
list(APPEND CMAKE_MODULE_PATH "${xgboost_SOURCE_DIR}/cmake/modules")
|
list(APPEND CMAKE_MODULE_PATH "${xgboost_SOURCE_DIR}/cmake/modules")
|
||||||
cmake_policy(SET CMP0022 NEW)
|
cmake_policy(SET CMP0022 NEW)
|
||||||
@@ -168,9 +168,6 @@ find_package(Threads REQUIRED)
|
|||||||
|
|
||||||
if (USE_OPENMP)
|
if (USE_OPENMP)
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
# Require CMake 3.16+ on Mac OSX, as previous versions of CMake had trouble locating
|
|
||||||
# OpenMP on Mac. See https://github.com/dmlc/xgboost/pull/5146#issuecomment-568312706
|
|
||||||
cmake_minimum_required(VERSION 3.16)
|
|
||||||
find_package(OpenMP)
|
find_package(OpenMP)
|
||||||
if (NOT OpenMP_FOUND)
|
if (NOT OpenMP_FOUND)
|
||||||
# Try again with extra path info; required for libomp 15+ from Homebrew
|
# Try again with extra path info; required for libomp 15+ from Homebrew
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ if (USE_OPENMP)
|
|||||||
endif (USE_OPENMP)
|
endif (USE_OPENMP)
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
xgboost-r PROPERTIES
|
xgboost-r PROPERTIES
|
||||||
CXX_STANDARD 14
|
CXX_STANDARD 17
|
||||||
CXX_STANDARD_REQUIRED ON
|
CXX_STANDARD_REQUIRED ON
|
||||||
POSITION_INDEPENDENT_CODE ON)
|
POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
Package: xgboost
|
Package: xgboost
|
||||||
Type: Package
|
Type: Package
|
||||||
Title: Extreme Gradient Boosting
|
Title: Extreme Gradient Boosting
|
||||||
Version: 1.7.4.1
|
Version: 1.7.6.1
|
||||||
Date: 2023-02-15
|
Date: 2023-06-16
|
||||||
Authors@R: c(
|
Authors@R: c(
|
||||||
person("Tianqi", "Chen", role = c("aut"),
|
person("Tianqi", "Chen", role = c("aut"),
|
||||||
email = "tianqi.tchen@gmail.com"),
|
email = "tianqi.tchen@gmail.com"),
|
||||||
@@ -66,5 +66,6 @@ Imports:
|
|||||||
methods,
|
methods,
|
||||||
data.table (>= 1.9.6),
|
data.table (>= 1.9.6),
|
||||||
jsonlite (>= 1.0),
|
jsonlite (>= 1.0),
|
||||||
RoxygenNote: 7.2.2
|
RoxygenNote: 7.2.3
|
||||||
SystemRequirements: GNU make, C++14
|
Encoding: UTF-8
|
||||||
|
SystemRequirements: GNU make, C++17
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
Copyright (c) 2014 by Tianqi Chen and Contributors
|
Copyright (c) 2014-2023, Tianqi Chen and XBGoost Contributors
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#' The branches that also used for missing values are marked as bold
|
#' The branches that also used for missing values are marked as bold
|
||||||
#' (as in "carrying extra capacity").
|
#' (as in "carrying extra capacity").
|
||||||
#'
|
#'
|
||||||
#' This function uses \href{http://www.graphviz.org/}{GraphViz} as a backend of DiagrammeR.
|
#' This function uses \href{https://www.graphviz.org/}{GraphViz} as a backend of DiagrammeR.
|
||||||
#'
|
#'
|
||||||
#' @return
|
#' @return
|
||||||
#'
|
#'
|
||||||
|
|||||||
24
R-package/configure
vendored
24
R-package/configure
vendored
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.71 for xgboost 1.7.4.
|
# Generated by GNU Autoconf 2.71 for xgboost 1.7.6.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
|
# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
|
||||||
@@ -607,8 +607,8 @@ MAKEFLAGS=
|
|||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='xgboost'
|
PACKAGE_NAME='xgboost'
|
||||||
PACKAGE_TARNAME='xgboost'
|
PACKAGE_TARNAME='xgboost'
|
||||||
PACKAGE_VERSION='1.7.4'
|
PACKAGE_VERSION='1.7.6'
|
||||||
PACKAGE_STRING='xgboost 1.7.4'
|
PACKAGE_STRING='xgboost 1.7.6'
|
||||||
PACKAGE_BUGREPORT=''
|
PACKAGE_BUGREPORT=''
|
||||||
PACKAGE_URL=''
|
PACKAGE_URL=''
|
||||||
|
|
||||||
@@ -1225,7 +1225,7 @@ if test "$ac_init_help" = "long"; then
|
|||||||
# Omit some internal or obsolete options to make the list less imposing.
|
# Omit some internal or obsolete options to make the list less imposing.
|
||||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures xgboost 1.7.4 to adapt to many kinds of systems.
|
\`configure' configures xgboost 1.7.6 to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
@@ -1287,7 +1287,7 @@ fi
|
|||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of xgboost 1.7.4:";;
|
short | recursive ) echo "Configuration of xgboost 1.7.6:";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
@@ -1367,7 +1367,7 @@ fi
|
|||||||
test -n "$ac_init_help" && exit $ac_status
|
test -n "$ac_init_help" && exit $ac_status
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
xgboost configure 1.7.4
|
xgboost configure 1.7.6
|
||||||
generated by GNU Autoconf 2.71
|
generated by GNU Autoconf 2.71
|
||||||
|
|
||||||
Copyright (C) 2021 Free Software Foundation, Inc.
|
Copyright (C) 2021 Free Software Foundation, Inc.
|
||||||
@@ -1533,7 +1533,7 @@ cat >config.log <<_ACEOF
|
|||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by xgboost $as_me 1.7.4, which was
|
It was created by xgboost $as_me 1.7.6, which was
|
||||||
generated by GNU Autoconf 2.71. Invocation command line was
|
generated by GNU Autoconf 2.71. Invocation command line was
|
||||||
|
|
||||||
$ $0$ac_configure_args_raw
|
$ $0$ac_configure_args_raw
|
||||||
@@ -2096,9 +2096,9 @@ if test -z "${R_HOME}"; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CXX14=`"${R_HOME}/bin/R" CMD config CXX14`
|
CXX17=`"${R_HOME}/bin/R" CMD config CXX17`
|
||||||
CXX14STD=`"${R_HOME}/bin/R" CMD config CXX14STD`
|
CXX17STD=`"${R_HOME}/bin/R" CMD config CXX17STD`
|
||||||
CXX="${CXX14} ${CXX14STD}"
|
CXX="${CXX17} ${CXX17STD}"
|
||||||
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXXFLAGS`
|
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXXFLAGS`
|
||||||
|
|
||||||
CC=`"${R_HOME}/bin/R" CMD config CC`
|
CC=`"${R_HOME}/bin/R" CMD config CC`
|
||||||
@@ -3412,7 +3412,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||||||
# report actual input values of CONFIG_FILES etc. instead of their
|
# report actual input values of CONFIG_FILES etc. instead of their
|
||||||
# values after options handling.
|
# values after options handling.
|
||||||
ac_log="
|
ac_log="
|
||||||
This file was extended by xgboost $as_me 1.7.4, which was
|
This file was extended by xgboost $as_me 1.7.6, which was
|
||||||
generated by GNU Autoconf 2.71. Invocation command line was
|
generated by GNU Autoconf 2.71. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
@@ -3467,7 +3467,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
|
|||||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
ac_cs_config='$ac_cs_config_escaped'
|
ac_cs_config='$ac_cs_config_escaped'
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
xgboost config.status 1.7.4
|
xgboost config.status 1.7.6
|
||||||
configured by $0, generated by GNU Autoconf 2.71,
|
configured by $0, generated by GNU Autoconf 2.71,
|
||||||
with options \\"\$ac_cs_config\\"
|
with options \\"\$ac_cs_config\\"
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
AC_PREREQ(2.69)
|
AC_PREREQ(2.69)
|
||||||
|
|
||||||
AC_INIT([xgboost],[1.7.4],[],[xgboost],[])
|
AC_INIT([xgboost],[1.7.6],[],[xgboost],[])
|
||||||
|
|
||||||
: ${R_HOME=`R RHOME`}
|
: ${R_HOME=`R RHOME`}
|
||||||
if test -z "${R_HOME}"; then
|
if test -z "${R_HOME}"; then
|
||||||
@@ -10,9 +10,9 @@ if test -z "${R_HOME}"; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CXX14=`"${R_HOME}/bin/R" CMD config CXX14`
|
CXX17=`"${R_HOME}/bin/R" CMD config CXX17`
|
||||||
CXX14STD=`"${R_HOME}/bin/R" CMD config CXX14STD`
|
CXX17STD=`"${R_HOME}/bin/R" CMD config CXX17STD`
|
||||||
CXX="${CXX14} ${CXX14STD}"
|
CXX="${CXX17} ${CXX17STD}"
|
||||||
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXXFLAGS`
|
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXXFLAGS`
|
||||||
|
|
||||||
CC=`"${R_HOME}/bin/R" CMD config CC`
|
CC=`"${R_HOME}/bin/R" CMD config CC`
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ The "Yes" branches are marked by the "< split_value" label.
|
|||||||
The branches that also used for missing values are marked as bold
|
The branches that also used for missing values are marked as bold
|
||||||
(as in "carrying extra capacity").
|
(as in "carrying extra capacity").
|
||||||
|
|
||||||
This function uses \href{http://www.graphviz.org/}{GraphViz} as a backend of DiagrammeR.
|
This function uses \href{https://www.graphviz.org/}{GraphViz} as a backend of DiagrammeR.
|
||||||
}
|
}
|
||||||
\examples{
|
\examples{
|
||||||
data(agaricus.train, package='xgboost')
|
data(agaricus.train, package='xgboost')
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ PKGROOT=../../
|
|||||||
ENABLE_STD_THREAD=1
|
ENABLE_STD_THREAD=1
|
||||||
# _*_ mode: Makefile; _*_
|
# _*_ mode: Makefile; _*_
|
||||||
|
|
||||||
CXX_STD = CXX14
|
CXX_STD = CXX17
|
||||||
|
|
||||||
XGB_RFLAGS = -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0\
|
XGB_RFLAGS = -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0\
|
||||||
-DDMLC_ENABLE_STD_THREAD=$(ENABLE_STD_THREAD) -DDMLC_DISABLE_STDIN=1\
|
-DDMLC_ENABLE_STD_THREAD=$(ENABLE_STD_THREAD) -DDMLC_DISABLE_STDIN=1\
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ PKGROOT=../../
|
|||||||
ENABLE_STD_THREAD=0
|
ENABLE_STD_THREAD=0
|
||||||
# _*_ mode: Makefile; _*_
|
# _*_ mode: Makefile; _*_
|
||||||
|
|
||||||
CXX_STD = CXX14
|
CXX_STD = CXX17
|
||||||
|
|
||||||
XGB_RFLAGS = -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0\
|
XGB_RFLAGS = -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0\
|
||||||
-DDMLC_ENABLE_STD_THREAD=$(ENABLE_STD_THREAD) -DDMLC_DISABLE_STDIN=1\
|
-DDMLC_ENABLE_STD_THREAD=$(ENABLE_STD_THREAD) -DDMLC_DISABLE_STDIN=1\
|
||||||
|
|||||||
@@ -178,17 +178,10 @@ function(xgboost_set_cuda_flags target)
|
|||||||
$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=/utf-8>)
|
$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=/utf-8>)
|
||||||
endif (MSVC)
|
endif (MSVC)
|
||||||
|
|
||||||
if (PLUGIN_RMM)
|
set_target_properties(${target} PROPERTIES
|
||||||
set_target_properties(${target} PROPERTIES
|
CUDA_STANDARD 17
|
||||||
CUDA_STANDARD 17
|
CUDA_STANDARD_REQUIRED ON
|
||||||
CUDA_STANDARD_REQUIRED ON
|
CUDA_SEPARABLE_COMPILATION OFF)
|
||||||
CUDA_SEPARABLE_COMPILATION OFF)
|
|
||||||
else ()
|
|
||||||
set_target_properties(${target} PROPERTIES
|
|
||||||
CUDA_STANDARD 14
|
|
||||||
CUDA_STANDARD_REQUIRED ON
|
|
||||||
CUDA_SEPARABLE_COMPILATION OFF)
|
|
||||||
endif (PLUGIN_RMM)
|
|
||||||
endfunction(xgboost_set_cuda_flags)
|
endfunction(xgboost_set_cuda_flags)
|
||||||
|
|
||||||
macro(xgboost_link_nccl target)
|
macro(xgboost_link_nccl target)
|
||||||
@@ -205,17 +198,10 @@ endmacro(xgboost_link_nccl)
|
|||||||
|
|
||||||
# compile options
|
# compile options
|
||||||
macro(xgboost_target_properties target)
|
macro(xgboost_target_properties target)
|
||||||
if (PLUGIN_RMM)
|
set_target_properties(${target} PROPERTIES
|
||||||
set_target_properties(${target} PROPERTIES
|
CXX_STANDARD 17
|
||||||
CXX_STANDARD 17
|
CXX_STANDARD_REQUIRED ON
|
||||||
CXX_STANDARD_REQUIRED ON
|
POSITION_INDEPENDENT_CODE ON)
|
||||||
POSITION_INDEPENDENT_CODE ON)
|
|
||||||
else ()
|
|
||||||
set_target_properties(${target} PROPERTIES
|
|
||||||
CXX_STANDARD 14
|
|
||||||
CXX_STANDARD_REQUIRED ON
|
|
||||||
POSITION_INDEPENDENT_CODE ON)
|
|
||||||
endif (PLUGIN_RMM)
|
|
||||||
|
|
||||||
if (HIDE_CXX_SYMBOLS)
|
if (HIDE_CXX_SYMBOLS)
|
||||||
#-- Hide all C++ symbols
|
#-- Hide all C++ symbols
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.18)
|
||||||
project(xgboost-c-examples)
|
project(xgboost-c-examples)
|
||||||
|
|
||||||
add_subdirectory(basic)
|
add_subdirectory(basic)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.18)
|
||||||
project(external-memory-demo LANGUAGES C VERSION 0.0.1)
|
project(external-memory-demo LANGUAGES C VERSION 0.0.1)
|
||||||
|
|
||||||
find_package(xgboost REQUIRED)
|
find_package(xgboost REQUIRED)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.18)
|
||||||
project(inference-demo LANGUAGES C VERSION 0.0.1)
|
project(inference-demo LANGUAGES C VERSION 0.0.1)
|
||||||
find_package(xgboost REQUIRED)
|
find_package(xgboost REQUIRED)
|
||||||
|
|
||||||
|
|||||||
Submodule dmlc-core updated: dfd9365264...81db539486
@@ -8,5 +8,5 @@ As a result it's changing quite often and we don't maintain its stability. Alon
|
|||||||
plugin system (see ``plugin/example`` in XGBoost's source tree), users can utilize some
|
plugin system (see ``plugin/example`` in XGBoost's source tree), users can utilize some
|
||||||
existing c++ headers for gaining more access to the internal of XGBoost.
|
existing c++ headers for gaining more access to the internal of XGBoost.
|
||||||
|
|
||||||
* `C++ interface documentation (latest master branch) <https://xgboost.readthedocs.io/en/latest/dev/files.html>`_
|
* `C++ interface documentation (latest master branch) <./dev/files.html>`_
|
||||||
* `C++ interface documentation (last stable release) <https://xgboost.readthedocs.io/en/stable/dev/files.html>`_
|
* `C++ interface documentation (last stable release) <https://xgboost.readthedocs.io/en/stable/dev/files.html>`_
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ simply look at function comments in ``include/xgboost/c_api.h``. The reference i
|
|||||||
to sphinx with the help of breathe, which doesn't contain links to examples but might be
|
to sphinx with the help of breathe, which doesn't contain links to examples but might be
|
||||||
easier to read. For the original doxygen pages please visit:
|
easier to read. For the original doxygen pages please visit:
|
||||||
|
|
||||||
* `C API documentation (latest master branch) <https://xgboost.readthedocs.io/en/latest/dev/c__api_8h.html>`_
|
* `C API documentation (latest master branch) <./dev/c__api_8h.html>`_
|
||||||
* `C API documentation (last stable release) <https://xgboost.readthedocs.io/en/stable/dev/c__api_8h.html>`_
|
* `C API documentation (last stable release) <https://xgboost.readthedocs.io/en/stable/dev/c__api_8h.html>`_
|
||||||
|
|
||||||
***************
|
***************
|
||||||
|
|||||||
203
doc/conf.py
203
doc/conf.py
@@ -11,54 +11,107 @@
|
|||||||
#
|
#
|
||||||
# All configuration values have a default; values that are commented out
|
# All configuration values have a default; values that are commented out
|
||||||
# serve to show the default.
|
# serve to show the default.
|
||||||
from subprocess import call
|
|
||||||
from sh.contrib import git
|
|
||||||
import urllib.request
|
|
||||||
from urllib.error import HTTPError
|
|
||||||
import sys
|
|
||||||
import re
|
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tarfile
|
||||||
|
import urllib.request
|
||||||
|
import warnings
|
||||||
|
from urllib.error import HTTPError
|
||||||
|
|
||||||
git_branch = os.getenv('SPHINX_GIT_BRANCH', default=None)
|
from sh.contrib import git
|
||||||
|
|
||||||
|
CURR_PATH = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
|
||||||
|
PROJECT_ROOT = os.path.normpath(os.path.join(CURR_PATH, os.path.pardir))
|
||||||
|
TMP_DIR = os.path.join(CURR_PATH, "tmp")
|
||||||
|
DOX_DIR = "doxygen"
|
||||||
|
|
||||||
|
|
||||||
|
def run_doxygen():
|
||||||
|
"""Run the doxygen make command in the designated folder."""
|
||||||
|
curdir = os.path.normpath(os.path.abspath(os.path.curdir))
|
||||||
|
if os.path.exists(TMP_DIR):
|
||||||
|
print(f"Delete directory {TMP_DIR}")
|
||||||
|
shutil.rmtree(TMP_DIR)
|
||||||
|
else:
|
||||||
|
print(f"Create directory {TMP_DIR}")
|
||||||
|
os.mkdir(TMP_DIR)
|
||||||
|
try:
|
||||||
|
os.chdir(PROJECT_ROOT)
|
||||||
|
if not os.path.exists(DOX_DIR):
|
||||||
|
os.mkdir(DOX_DIR)
|
||||||
|
os.chdir(os.path.join(PROJECT_ROOT, DOX_DIR))
|
||||||
|
print(
|
||||||
|
"Build doxygen at {}".format(
|
||||||
|
os.path.join(PROJECT_ROOT, DOX_DIR, "doc_doxygen")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
subprocess.check_call(["cmake", "..", "-DBUILD_C_DOC=ON", "-GNinja"])
|
||||||
|
subprocess.check_call(["ninja", "doc_doxygen"])
|
||||||
|
|
||||||
|
src = os.path.join(PROJECT_ROOT, DOX_DIR, "doc_doxygen", "html")
|
||||||
|
dest = os.path.join(TMP_DIR, "dev")
|
||||||
|
print(f"Copy directory {src} -> {dest}")
|
||||||
|
shutil.copytree(src, dest)
|
||||||
|
except OSError as e:
|
||||||
|
sys.stderr.write("doxygen execution failed: %s" % e)
|
||||||
|
finally:
|
||||||
|
os.chdir(curdir)
|
||||||
|
|
||||||
|
|
||||||
|
def is_readthedocs_build():
|
||||||
|
if os.environ.get("READTHEDOCS", None) == "True":
|
||||||
|
return True
|
||||||
|
warnings.warn(
|
||||||
|
"Skipping Doxygen build... You won't have documentation for C/C++ functions. "
|
||||||
|
"Set environment variable READTHEDOCS=True if you want to build Doxygen. "
|
||||||
|
"(If you do opt in, make sure to install Doxygen, Graphviz, CMake, and C++ compiler "
|
||||||
|
"on your system.)"
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
if is_readthedocs_build():
|
||||||
|
run_doxygen()
|
||||||
|
|
||||||
|
|
||||||
|
git_branch = os.getenv("SPHINX_GIT_BRANCH", default=None)
|
||||||
if not git_branch:
|
if not git_branch:
|
||||||
# If SPHINX_GIT_BRANCH environment variable is not given, run git
|
# If SPHINX_GIT_BRANCH environment variable is not given, run git
|
||||||
# to determine branch name
|
# to determine branch name
|
||||||
git_branch = [
|
git_branch = [
|
||||||
re.sub(r'origin/', '', x.lstrip(' ')) for x in str(
|
re.sub(r"origin/", "", x.lstrip(" "))
|
||||||
git.branch('-r', '--contains', 'HEAD')).rstrip('\n').split('\n')
|
for x in str(git.branch("-r", "--contains", "HEAD")).rstrip("\n").split("\n")
|
||||||
]
|
]
|
||||||
git_branch = [x for x in git_branch if 'HEAD' not in x]
|
git_branch = [x for x in git_branch if "HEAD" not in x]
|
||||||
else:
|
else:
|
||||||
git_branch = [git_branch]
|
git_branch = [git_branch]
|
||||||
print('git_branch = {}'.format(git_branch[0]))
|
print("git_branch = {}".format(git_branch[0]))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
filename, _ = urllib.request.urlretrieve(
|
filename, _ = urllib.request.urlretrieve(
|
||||||
'https://s3-us-west-2.amazonaws.com/xgboost-docs/{}.tar.bz2'.format(
|
f"https://s3-us-west-2.amazonaws.com/xgboost-docs/{git_branch[0]}.tar.bz2"
|
||||||
git_branch[0]))
|
)
|
||||||
call(
|
if not os.path.exists(TMP_DIR):
|
||||||
'if [ -d tmp ]; then rm -rf tmp; fi; mkdir -p tmp/jvm; cd tmp/jvm; tar xvf {}'
|
print(f"Create directory {TMP_DIR}")
|
||||||
.format(filename),
|
os.mkdir(TMP_DIR)
|
||||||
shell=True)
|
jvm_doc_dir = os.path.join(TMP_DIR, "jvm")
|
||||||
|
if os.path.exists(jvm_doc_dir):
|
||||||
|
print(f"Delete directory {jvm_doc_dir}")
|
||||||
|
shutil.rmtree(jvm_doc_dir)
|
||||||
|
print(f"Create directory {jvm_doc_dir}")
|
||||||
|
os.mkdir(jvm_doc_dir)
|
||||||
|
|
||||||
|
with tarfile.open(filename, "r:bz2") as t:
|
||||||
|
t.extractall(jvm_doc_dir)
|
||||||
except HTTPError:
|
except HTTPError:
|
||||||
print('JVM doc not found. Skipping...')
|
print("JVM doc not found. Skipping...")
|
||||||
try:
|
|
||||||
filename, _ = urllib.request.urlretrieve(
|
|
||||||
'https://s3-us-west-2.amazonaws.com/xgboost-docs/doxygen/{}.tar.bz2'.
|
|
||||||
format(git_branch[0]))
|
|
||||||
call(
|
|
||||||
'mkdir -p tmp/dev; cd tmp/dev; tar xvf {}; mv doc_doxygen/html/* .; rm -rf doc_doxygen'
|
|
||||||
.format(filename),
|
|
||||||
shell=True)
|
|
||||||
except HTTPError:
|
|
||||||
print('C API doc not found. Skipping...')
|
|
||||||
|
|
||||||
# If extensions (or modules to document with autodoc) are in another directory,
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
# add these directories to sys.path here. If the directory is relative to the
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
CURR_PATH = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
|
|
||||||
PROJECT_ROOT = os.path.normpath(os.path.join(CURR_PATH, os.path.pardir))
|
|
||||||
libpath = os.path.join(PROJECT_ROOT, "python-package/")
|
libpath = os.path.join(PROJECT_ROOT, "python-package/")
|
||||||
sys.path.insert(0, libpath)
|
sys.path.insert(0, libpath)
|
||||||
sys.path.insert(0, CURR_PATH)
|
sys.path.insert(0, CURR_PATH)
|
||||||
@@ -81,50 +134,56 @@ release = xgboost.__version__
|
|||||||
# Add any Sphinx extension module names here, as strings. They can be
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones
|
||||||
extensions = [
|
extensions = [
|
||||||
'matplotlib.sphinxext.plot_directive',
|
"matplotlib.sphinxext.plot_directive",
|
||||||
'sphinx.ext.autodoc',
|
"sphinxcontrib.jquery",
|
||||||
'sphinx.ext.napoleon',
|
"sphinx.ext.autodoc",
|
||||||
'sphinx.ext.mathjax',
|
"sphinx.ext.napoleon",
|
||||||
'sphinx.ext.intersphinx',
|
"sphinx.ext.mathjax",
|
||||||
|
"sphinx.ext.intersphinx",
|
||||||
"sphinx_gallery.gen_gallery",
|
"sphinx_gallery.gen_gallery",
|
||||||
'breathe',
|
"breathe",
|
||||||
'recommonmark'
|
"recommonmark",
|
||||||
]
|
]
|
||||||
|
|
||||||
sphinx_gallery_conf = {
|
sphinx_gallery_conf = {
|
||||||
# path to your example scripts
|
# path to your example scripts
|
||||||
"examples_dirs": ["../demo/guide-python", "../demo/dask", "../demo/aft_survival"],
|
"examples_dirs": ["../demo/guide-python", "../demo/dask", "../demo/aft_survival"],
|
||||||
# path to where to save gallery generated output
|
# path to where to save gallery generated output
|
||||||
"gallery_dirs": ["python/examples", "python/dask-examples", "python/survival-examples"],
|
"gallery_dirs": [
|
||||||
|
"python/examples",
|
||||||
|
"python/dask-examples",
|
||||||
|
"python/survival-examples",
|
||||||
|
],
|
||||||
"matplotlib_animations": True,
|
"matplotlib_animations": True,
|
||||||
}
|
}
|
||||||
|
|
||||||
autodoc_typehints = "description"
|
autodoc_typehints = "description"
|
||||||
|
|
||||||
graphviz_output_format = 'png'
|
graphviz_output_format = "png"
|
||||||
plot_formats = [('svg', 300), ('png', 100), ('hires.png', 300)]
|
plot_formats = [("svg", 300), ("png", 100), ("hires.png", 300)]
|
||||||
plot_html_show_source_link = False
|
plot_html_show_source_link = False
|
||||||
plot_html_show_formats = False
|
plot_html_show_formats = False
|
||||||
|
|
||||||
# Breathe extension variables
|
# Breathe extension variables
|
||||||
DOX_DIR = "doxygen"
|
breathe_projects = {}
|
||||||
breathe_projects = {
|
if is_readthedocs_build():
|
||||||
"xgboost": os.path.join(PROJECT_ROOT, DOX_DIR, "doc_doxygen/xml")
|
breathe_projects = {
|
||||||
}
|
"xgboost": os.path.join(PROJECT_ROOT, DOX_DIR, "doc_doxygen/xml")
|
||||||
|
}
|
||||||
breathe_default_project = "xgboost"
|
breathe_default_project = "xgboost"
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
templates_path = ['_templates']
|
templates_path = ["_templates"]
|
||||||
|
|
||||||
# The suffix(es) of source filenames.
|
# The suffix(es) of source filenames.
|
||||||
# You can specify multiple suffix as a list of string:
|
# You can specify multiple suffix as a list of string:
|
||||||
source_suffix = ['.rst', '.md']
|
source_suffix = [".rst", ".md"]
|
||||||
|
|
||||||
# The encoding of source files.
|
# The encoding of source files.
|
||||||
# source_encoding = 'utf-8-sig'
|
# source_encoding = 'utf-8-sig'
|
||||||
|
|
||||||
# The master toctree document.
|
# The master toctree document.
|
||||||
master_doc = 'index'
|
master_doc = "index"
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
@@ -133,7 +192,7 @@ master_doc = 'index'
|
|||||||
# Usually you set "language" from the command line for these cases.
|
# Usually you set "language" from the command line for these cases.
|
||||||
language = "en"
|
language = "en"
|
||||||
|
|
||||||
autoclass_content = 'both'
|
autoclass_content = "both"
|
||||||
|
|
||||||
# There are two options for replacing |today|: either, you set today to some
|
# There are two options for replacing |today|: either, you set today to some
|
||||||
# non-false value, then it is used:
|
# non-false value, then it is used:
|
||||||
@@ -143,8 +202,10 @@ autoclass_content = 'both'
|
|||||||
|
|
||||||
# List of patterns, relative to source directory, that match files and
|
# List of patterns, relative to source directory, that match files and
|
||||||
# directories to ignore when looking for source files.
|
# directories to ignore when looking for source files.
|
||||||
exclude_patterns = ['_build']
|
exclude_patterns = ["_build"]
|
||||||
html_extra_path = ['./tmp']
|
html_extra_path = []
|
||||||
|
if is_readthedocs_build():
|
||||||
|
html_extra_path = [TMP_DIR]
|
||||||
|
|
||||||
# The reST default role (used for this markup: `text`) to use for all
|
# The reST default role (used for this markup: `text`) to use for all
|
||||||
# documents.
|
# documents.
|
||||||
@@ -162,7 +223,7 @@ html_extra_path = ['./tmp']
|
|||||||
# show_authors = False
|
# show_authors = False
|
||||||
|
|
||||||
# The name of the Pygments (syntax highlighting) style to use.
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
pygments_style = 'sphinx'
|
pygments_style = "sphinx"
|
||||||
|
|
||||||
# A list of ignored prefixes for module index sorting.
|
# A list of ignored prefixes for module index sorting.
|
||||||
# modindex_common_prefix = []
|
# modindex_common_prefix = []
|
||||||
@@ -185,27 +246,24 @@ html_logo = "https://raw.githubusercontent.com/dmlc/dmlc.github.io/master/img/lo
|
|||||||
|
|
||||||
html_css_files = ["css/custom.css"]
|
html_css_files = ["css/custom.css"]
|
||||||
|
|
||||||
html_sidebars = {
|
html_sidebars = {"**": ["logo-text.html", "globaltoc.html", "searchbox.html"]}
|
||||||
'**': ['logo-text.html', 'globaltoc.html', 'searchbox.html']
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add any paths that contain custom static files (such as style sheets) here,
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
# relative to this directory. They are copied after the builtin static files,
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
html_static_path = ['_static']
|
html_static_path = ["_static"]
|
||||||
|
|
||||||
# Output file base name for HTML help builder.
|
# Output file base name for HTML help builder.
|
||||||
htmlhelp_basename = project + 'doc'
|
htmlhelp_basename = project + "doc"
|
||||||
|
|
||||||
# -- Options for LaTeX output ---------------------------------------------
|
# -- Options for LaTeX output ---------------------------------------------
|
||||||
latex_elements = {
|
latex_elements = {}
|
||||||
}
|
|
||||||
|
|
||||||
# Grouping the document tree into LaTeX files. List of tuples
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
# (source start file, target name, title,
|
# (source start file, target name, title,
|
||||||
# author, documentclass [howto, manual, or own class]).
|
# author, documentclass [howto, manual, or own class]).
|
||||||
latex_documents = [
|
latex_documents = [
|
||||||
(master_doc, '%s.tex' % project, project, author, 'manual'),
|
(master_doc, "%s.tex" % project, project, author, "manual"),
|
||||||
]
|
]
|
||||||
|
|
||||||
intersphinx_mapping = {
|
intersphinx_mapping = {
|
||||||
@@ -220,30 +278,5 @@ intersphinx_mapping = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# hook for doxygen
|
|
||||||
def run_doxygen():
|
|
||||||
"""Run the doxygen make command in the designated folder."""
|
|
||||||
curdir = os.path.normpath(os.path.abspath(os.path.curdir))
|
|
||||||
try:
|
|
||||||
os.chdir(PROJECT_ROOT)
|
|
||||||
if not os.path.exists(DOX_DIR):
|
|
||||||
os.mkdir(DOX_DIR)
|
|
||||||
os.chdir(os.path.join(PROJECT_ROOT, DOX_DIR))
|
|
||||||
subprocess.check_call(["cmake", "..", "-DBUILD_C_DOC=ON", "-GNinja"])
|
|
||||||
subprocess.check_call(["ninja", "doc_doxygen"])
|
|
||||||
except OSError as e:
|
|
||||||
sys.stderr.write("doxygen execution failed: %s" % e)
|
|
||||||
finally:
|
|
||||||
os.chdir(curdir)
|
|
||||||
|
|
||||||
|
|
||||||
def generate_doxygen_xml(app):
|
|
||||||
"""Run the doxygen make commands if we're on the ReadTheDocs server"""
|
|
||||||
read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'
|
|
||||||
if read_the_docs_build:
|
|
||||||
run_doxygen()
|
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
app.add_css_file('custom.css')
|
app.add_css_file("custom.css")
|
||||||
app.connect("builder-inited", generate_doxygen_xml)
|
|
||||||
|
|||||||
@@ -173,3 +173,13 @@ PySpark API
|
|||||||
:members:
|
:members:
|
||||||
:inherited-members:
|
:inherited-members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
|
.. autoclass:: xgboost.spark.SparkXGBRanker
|
||||||
|
:members:
|
||||||
|
:inherited-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
.. autoclass:: xgboost.spark.SparkXGBRankerModel
|
||||||
|
:members:
|
||||||
|
:inherited-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ Use ``find_package()`` and ``target_link_libraries()`` in your application's CMa
|
|||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.18)
|
||||||
project(your_project_name LANGUAGES C CXX VERSION your_project_version)
|
project(your_project_name LANGUAGES C CXX VERSION your_project_version)
|
||||||
find_package(xgboost REQUIRED)
|
find_package(xgboost REQUIRED)
|
||||||
add_executable(your_project_name /path/to/project_file.c)
|
add_executable(your_project_name /path/to/project_file.c)
|
||||||
|
|||||||
@@ -43,10 +43,10 @@ in spark estimator, and some parameters are replaced with pyspark specific param
|
|||||||
such as `weight_col`, `validation_indicator_col`, `use_gpu`, for details please see
|
such as `weight_col`, `validation_indicator_col`, `use_gpu`, for details please see
|
||||||
`SparkXGBRegressor` doc.
|
`SparkXGBRegressor` doc.
|
||||||
|
|
||||||
The following code snippet shows how to train a spark xgboost regressor model,
|
The following code snippet shows how to train a spark xgboost regressor model, first we
|
||||||
first we need to prepare a training dataset as a spark dataframe contains
|
need to prepare a training dataset as a spark dataframe contains "label" column and
|
||||||
"label" column and "features" column(s), the "features" column(s) must be `pyspark.ml.linalg.Vector`
|
"features" column(s), the "features" column(s) must be ``pyspark.ml.linalg.Vector`` type
|
||||||
type or spark array type or a list of feature column names.
|
or spark array type or a list of feature column names.
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
@@ -54,10 +54,10 @@ type or spark array type or a list of feature column names.
|
|||||||
xgb_regressor_model = xgb_regressor.fit(train_spark_dataframe)
|
xgb_regressor_model = xgb_regressor.fit(train_spark_dataframe)
|
||||||
|
|
||||||
|
|
||||||
The following code snippet shows how to predict test data using a spark xgboost regressor model,
|
The following code snippet shows how to predict test data using a spark xgboost regressor
|
||||||
first we need to prepare a test dataset as a spark dataframe contains
|
model, first we need to prepare a test dataset as a spark dataframe contains "features"
|
||||||
"features" and "label" column, the "features" column must be `pyspark.ml.linalg.Vector`
|
and "label" column, the "features" column must be ``pyspark.ml.linalg.Vector`` type or
|
||||||
type or spark array type.
|
spark array type.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -107,8 +107,8 @@ virtualenv and pip:
|
|||||||
python -m venv xgboost_env
|
python -m venv xgboost_env
|
||||||
source xgboost_env/bin/activate
|
source xgboost_env/bin/activate
|
||||||
pip install pyarrow pandas venv-pack xgboost
|
pip install pyarrow pandas venv-pack xgboost
|
||||||
# https://rapids.ai/pip.html#install
|
# https://docs.rapids.ai/install#pip-install
|
||||||
pip install cudf-cu11 --extra-index-url=https://pypi.ngc.nvidia.com
|
pip install cudf-cu11 --extra-index-url=https://pypi.nvidia.com
|
||||||
venv-pack -o xgboost_env.tar.gz
|
venv-pack -o xgboost_env.tar.gz
|
||||||
|
|
||||||
With Conda:
|
With Conda:
|
||||||
@@ -240,7 +240,7 @@ additional spark configurations and dependencies:
|
|||||||
--master spark://<master-ip>:7077 \
|
--master spark://<master-ip>:7077 \
|
||||||
--conf spark.executor.resource.gpu.amount=1 \
|
--conf spark.executor.resource.gpu.amount=1 \
|
||||||
--conf spark.task.resource.gpu.amount=1 \
|
--conf spark.task.resource.gpu.amount=1 \
|
||||||
--packages com.nvidia:rapids-4-spark_2.12:22.08.0 \
|
--packages com.nvidia:rapids-4-spark_2.12:23.04.0 \
|
||||||
--conf spark.plugins=com.nvidia.spark.SQLPlugin \
|
--conf spark.plugins=com.nvidia.spark.SQLPlugin \
|
||||||
--conf spark.sql.execution.arrow.maxRecordsPerBatch=1000000 \
|
--conf spark.sql.execution.arrow.maxRecordsPerBatch=1000000 \
|
||||||
--archives xgboost_env.tar.gz#environment \
|
--archives xgboost_env.tar.gz#environment \
|
||||||
|
|||||||
@@ -508,7 +508,7 @@ class RegTree : public Model {
|
|||||||
* \brief drop the trace after fill, must be called after fill.
|
* \brief drop the trace after fill, must be called after fill.
|
||||||
* \param inst The sparse instance to drop.
|
* \param inst The sparse instance to drop.
|
||||||
*/
|
*/
|
||||||
void Drop(const SparsePage::Inst& inst);
|
void Drop();
|
||||||
/*!
|
/*!
|
||||||
* \brief returns the size of the feature vector
|
* \brief returns the size of the feature vector
|
||||||
* \return the size of the feature vector
|
* \return the size of the feature vector
|
||||||
@@ -709,13 +709,10 @@ inline void RegTree::FVec::Fill(const SparsePage::Inst& inst) {
|
|||||||
has_missing_ = data_.size() != feature_count;
|
has_missing_ = data_.size() != feature_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void RegTree::FVec::Drop(const SparsePage::Inst& inst) {
|
inline void RegTree::FVec::Drop() {
|
||||||
for (auto const& entry : inst) {
|
Entry e{};
|
||||||
if (entry.index >= data_.size()) {
|
e.flag = -1;
|
||||||
continue;
|
std::fill_n(data_.data(), data_.size(), e);
|
||||||
}
|
|
||||||
data_[entry.index].flag = -1;
|
|
||||||
}
|
|
||||||
has_missing_ = true;
|
has_missing_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,6 @@
|
|||||||
|
|
||||||
#define XGBOOST_VER_MAJOR 1
|
#define XGBOOST_VER_MAJOR 1
|
||||||
#define XGBOOST_VER_MINOR 7
|
#define XGBOOST_VER_MINOR 7
|
||||||
#define XGBOOST_VER_PATCH 4
|
#define XGBOOST_VER_PATCH 6
|
||||||
|
|
||||||
#endif // XGBOOST_VERSION_CONFIG_H_
|
#endif // XGBOOST_VERSION_CONFIG_H_
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost-jvm_2.12</artifactId>
|
<artifactId>xgboost-jvm_2.12</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.6</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>XGBoost JVM Package</name>
|
<name>XGBoost JVM Package</name>
|
||||||
<description>JVM Package for XGBoost</description>
|
<description>JVM Package for XGBoost</description>
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost-jvm_2.12</artifactId>
|
<artifactId>xgboost-jvm_2.12</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.6</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>xgboost4j-example_2.12</artifactId>
|
<artifactId>xgboost4j-example_2.12</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.6</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost4j-spark_${scala.binary.version}</artifactId>
|
<artifactId>xgboost4j-spark_${scala.binary.version}</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.spark</groupId>
|
<groupId>org.apache.spark</groupId>
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost4j-flink_${scala.binary.version}</artifactId>
|
<artifactId>xgboost4j-flink_${scala.binary.version}</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost-jvm_2.12</artifactId>
|
<artifactId>xgboost-jvm_2.12</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.6</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>xgboost4j-flink_2.12</artifactId>
|
<artifactId>xgboost4j-flink_2.12</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.6</version>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost4j_${scala.binary.version}</artifactId>
|
<artifactId>xgboost4j_${scala.binary.version}</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost-jvm_2.12</artifactId>
|
<artifactId>xgboost-jvm_2.12</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.6</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>xgboost4j-gpu_2.12</artifactId>
|
<artifactId>xgboost4j-gpu_2.12</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.6</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost-jvm_2.12</artifactId>
|
<artifactId>xgboost-jvm_2.12</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.6</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>xgboost4j-spark-gpu_2.12</artifactId>
|
<artifactId>xgboost4j-spark-gpu_2.12</artifactId>
|
||||||
<build>
|
<build>
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost4j-gpu_${scala.binary.version}</artifactId>
|
<artifactId>xgboost4j-gpu_${scala.binary.version}</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.spark</groupId>
|
<groupId>org.apache.spark</groupId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost-jvm_2.12</artifactId>
|
<artifactId>xgboost-jvm_2.12</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.6</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>xgboost4j-spark_2.12</artifactId>
|
<artifactId>xgboost4j-spark_2.12</artifactId>
|
||||||
<build>
|
<build>
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost4j_${scala.binary.version}</artifactId>
|
<artifactId>xgboost4j_${scala.binary.version}</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.spark</groupId>
|
<groupId>org.apache.spark</groupId>
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>ml.dmlc</groupId>
|
<groupId>ml.dmlc</groupId>
|
||||||
<artifactId>xgboost-jvm_2.12</artifactId>
|
<artifactId>xgboost-jvm_2.12</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.6</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>xgboost4j_2.12</artifactId>
|
<artifactId>xgboost4j_2.12</artifactId>
|
||||||
<version>1.7.4</version>
|
<version>1.7.6</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ if (PLUGIN_UPDATER_ONEAPI)
|
|||||||
target_link_libraries(oneapi_plugin PUBLIC -fsycl)
|
target_link_libraries(oneapi_plugin PUBLIC -fsycl)
|
||||||
set_target_properties(oneapi_plugin PROPERTIES
|
set_target_properties(oneapi_plugin PROPERTIES
|
||||||
COMPILE_FLAGS -fsycl
|
COMPILE_FLAGS -fsycl
|
||||||
CXX_STANDARD 14
|
CXX_STANDARD 17
|
||||||
CXX_STANDARD_REQUIRED ON
|
CXX_STANDARD_REQUIRED ON
|
||||||
POSITION_INDEPENDENT_CODE ON)
|
POSITION_INDEPENDENT_CODE ON)
|
||||||
if (USE_OPENMP)
|
if (USE_OPENMP)
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.7.4
|
1.7.6
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
# type: ignore
|
# type: ignore
|
||||||
"""PySpark XGBoost integration interface
|
"""PySpark XGBoost integration interface"""
|
||||||
"""
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pyspark
|
import pyspark
|
||||||
@@ -11,6 +10,7 @@ from .estimator import (
|
|||||||
SparkXGBClassifier,
|
SparkXGBClassifier,
|
||||||
SparkXGBClassifierModel,
|
SparkXGBClassifierModel,
|
||||||
SparkXGBRanker,
|
SparkXGBRanker,
|
||||||
|
SparkXGBRankerModel,
|
||||||
SparkXGBRegressor,
|
SparkXGBRegressor,
|
||||||
SparkXGBRegressorModel,
|
SparkXGBRegressorModel,
|
||||||
)
|
)
|
||||||
@@ -21,4 +21,5 @@ __all__ = [
|
|||||||
"SparkXGBRegressor",
|
"SparkXGBRegressor",
|
||||||
"SparkXGBRegressorModel",
|
"SparkXGBRegressorModel",
|
||||||
"SparkXGBRanker",
|
"SparkXGBRanker",
|
||||||
|
"SparkXGBRankerModel",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -866,7 +866,11 @@ class _SparkXGBEstimator(Estimator, _SparkXGBParams, MLReadable, MLWritable):
|
|||||||
result_xgb_model = self._convert_to_sklearn_model(
|
result_xgb_model = self._convert_to_sklearn_model(
|
||||||
bytearray(booster, "utf-8"), config
|
bytearray(booster, "utf-8"), config
|
||||||
)
|
)
|
||||||
return self._copyValues(self._create_pyspark_model(result_xgb_model))
|
spark_model = self._create_pyspark_model(result_xgb_model)
|
||||||
|
# According to pyspark ML convention, the model uid should be the same
|
||||||
|
# with estimator uid.
|
||||||
|
spark_model._resetUid(self.uid)
|
||||||
|
return self._copyValues(spark_model)
|
||||||
|
|
||||||
def write(self):
|
def write(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.3)
|
cmake_minimum_required(VERSION 3.18)
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
|
|||||||
@@ -149,10 +149,28 @@ common::ColumnMatrix const &GHistIndexMatrix::Transpose() const {
|
|||||||
return *columns_;
|
return *columns_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bst_bin_t GHistIndexMatrix::GetGindex(size_t ridx, size_t fidx) const {
|
||||||
|
auto begin = RowIdx(ridx);
|
||||||
|
if (IsDense()) {
|
||||||
|
return static_cast<bst_bin_t>(index[begin + fidx]);
|
||||||
|
}
|
||||||
|
auto end = RowIdx(ridx + 1);
|
||||||
|
auto const& cut_ptrs = cut.Ptrs();
|
||||||
|
auto f_begin = cut_ptrs[fidx];
|
||||||
|
auto f_end = cut_ptrs[fidx + 1];
|
||||||
|
return BinarySearchBin(begin, end, index, f_begin, f_end);
|
||||||
|
}
|
||||||
|
|
||||||
float GHistIndexMatrix::GetFvalue(size_t ridx, size_t fidx, bool is_cat) const {
|
float GHistIndexMatrix::GetFvalue(size_t ridx, size_t fidx, bool is_cat) const {
|
||||||
auto const &values = cut.Values();
|
auto const &values = cut.Values();
|
||||||
auto const &mins = cut.MinValues();
|
auto const &mins = cut.MinValues();
|
||||||
auto const &ptrs = cut.Ptrs();
|
auto const &ptrs = cut.Ptrs();
|
||||||
|
return this->GetFvalue(ptrs, values, mins, ridx, fidx, is_cat);
|
||||||
|
}
|
||||||
|
|
||||||
|
float GHistIndexMatrix::GetFvalue(std::vector<std::uint32_t> const &ptrs,
|
||||||
|
std::vector<float> const &values, std::vector<float> const &mins,
|
||||||
|
bst_row_t ridx, bst_feature_t fidx, bool is_cat) const {
|
||||||
if (is_cat) {
|
if (is_cat) {
|
||||||
auto f_begin = ptrs[fidx];
|
auto f_begin = ptrs[fidx];
|
||||||
auto f_end = ptrs[fidx + 1];
|
auto f_end = ptrs[fidx + 1];
|
||||||
@@ -172,24 +190,27 @@ float GHistIndexMatrix::GetFvalue(size_t ridx, size_t fidx, bool is_cat) const {
|
|||||||
}
|
}
|
||||||
return common::HistogramCuts::NumericBinValue(ptrs, values, mins, fidx, bin_idx);
|
return common::HistogramCuts::NumericBinValue(ptrs, values, mins, fidx, bin_idx);
|
||||||
};
|
};
|
||||||
|
switch (columns_->GetColumnType(fidx)) {
|
||||||
if (columns_->GetColumnType(fidx) == common::kDenseColumn) {
|
case common::kDenseColumn: {
|
||||||
if (columns_->AnyMissing()) {
|
if (columns_->AnyMissing()) {
|
||||||
|
return common::DispatchBinType(columns_->GetTypeSize(), [&](auto dtype) {
|
||||||
|
auto column = columns_->DenseColumn<decltype(dtype), true>(fidx);
|
||||||
|
return get_bin_val(column);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return common::DispatchBinType(columns_->GetTypeSize(), [&](auto dtype) {
|
||||||
|
auto column = columns_->DenseColumn<decltype(dtype), false>(fidx);
|
||||||
|
auto bin_idx = column[ridx];
|
||||||
|
return common::HistogramCuts::NumericBinValue(ptrs, values, mins, fidx, bin_idx);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case common::kSparseColumn: {
|
||||||
return common::DispatchBinType(columns_->GetTypeSize(), [&](auto dtype) {
|
return common::DispatchBinType(columns_->GetTypeSize(), [&](auto dtype) {
|
||||||
auto column = columns_->DenseColumn<decltype(dtype), true>(fidx);
|
auto column = columns_->SparseColumn<decltype(dtype)>(fidx, 0);
|
||||||
return get_bin_val(column);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
return common::DispatchBinType(columns_->GetTypeSize(), [&](auto dtype) {
|
|
||||||
auto column = columns_->DenseColumn<decltype(dtype), false>(fidx);
|
|
||||||
return get_bin_val(column);
|
return get_bin_val(column);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return common::DispatchBinType(columns_->GetTypeSize(), [&](auto dtype) {
|
|
||||||
auto column = columns_->SparseColumn<decltype(dtype)>(fidx, 0);
|
|
||||||
return get_bin_val(column);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SPAN_CHECK(false);
|
SPAN_CHECK(false);
|
||||||
|
|||||||
@@ -227,7 +227,12 @@ class GHistIndexMatrix {
|
|||||||
|
|
||||||
common::ColumnMatrix const& Transpose() const;
|
common::ColumnMatrix const& Transpose() const;
|
||||||
|
|
||||||
|
bst_bin_t GetGindex(size_t ridx, size_t fidx) const;
|
||||||
|
|
||||||
float GetFvalue(size_t ridx, size_t fidx, bool is_cat) const;
|
float GetFvalue(size_t ridx, size_t fidx, bool is_cat) const;
|
||||||
|
float GetFvalue(std::vector<std::uint32_t> const& ptrs, std::vector<float> const& values,
|
||||||
|
std::vector<float> const& mins, bst_row_t ridx, bst_feature_t fidx,
|
||||||
|
bool is_cat) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<common::ColumnMatrix> columns_;
|
std::unique_ptr<common::ColumnMatrix> columns_;
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ void IterativeDMatrix::InitFromCPU(DataIterHandle iter_handle, float missing,
|
|||||||
size_t n_threads = ctx_.Threads();
|
size_t n_threads = ctx_.Threads();
|
||||||
size_t n_features = column_sizes.size();
|
size_t n_features = column_sizes.size();
|
||||||
linalg::Tensor<size_t, 2> column_sizes_tloc({n_threads, n_features}, Context::kCpuId);
|
linalg::Tensor<size_t, 2> column_sizes_tloc({n_threads, n_features}, Context::kCpuId);
|
||||||
|
column_sizes_tloc.Data()->Fill(0);
|
||||||
auto view = column_sizes_tloc.HostView();
|
auto view = column_sizes_tloc.HostView();
|
||||||
common::ParallelFor(value.Size(), n_threads, common::Sched::Static(256), [&](auto i) {
|
common::ParallelFor(value.Size(), n_threads, common::Sched::Static(256), [&](auto i) {
|
||||||
auto const& line = value.GetLine(i);
|
auto const& line = value.GetLine(i);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ bst_float PredValue(const SparsePage::Inst &inst,
|
|||||||
psum += (*trees[i])[nidx].LeafValue();
|
psum += (*trees[i])[nidx].LeafValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p_feats->Drop(inst);
|
p_feats->Drop();
|
||||||
return psum;
|
return psum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,13 +116,11 @@ void FVecFill(const size_t block_size, const size_t batch_offset, const int num_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename DataView>
|
void FVecDrop(std::size_t const block_size, std::size_t const fvec_offset,
|
||||||
void FVecDrop(const size_t block_size, const size_t batch_offset, DataView* batch,
|
std::vector<RegTree::FVec> *p_feats) {
|
||||||
const size_t fvec_offset, std::vector<RegTree::FVec>* p_feats) {
|
|
||||||
for (size_t i = 0; i < block_size; ++i) {
|
for (size_t i = 0; i < block_size; ++i) {
|
||||||
RegTree::FVec &feats = (*p_feats)[fvec_offset + i];
|
RegTree::FVec &feats = (*p_feats)[fvec_offset + i];
|
||||||
const SparsePage::Inst inst = (*batch)[batch_offset + i];
|
feats.Drop();
|
||||||
feats.Drop(inst);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,11 +140,15 @@ struct SparsePageView {
|
|||||||
struct GHistIndexMatrixView {
|
struct GHistIndexMatrixView {
|
||||||
private:
|
private:
|
||||||
GHistIndexMatrix const &page_;
|
GHistIndexMatrix const &page_;
|
||||||
uint64_t n_features_;
|
std::uint64_t const n_features_;
|
||||||
common::Span<FeatureType const> ft_;
|
common::Span<FeatureType const> ft_;
|
||||||
common::Span<Entry> workspace_;
|
common::Span<Entry> workspace_;
|
||||||
std::vector<size_t> current_unroll_;
|
std::vector<size_t> current_unroll_;
|
||||||
|
|
||||||
|
std::vector<std::uint32_t> const& ptrs_;
|
||||||
|
std::vector<float> const& mins_;
|
||||||
|
std::vector<float> const& values_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
size_t base_rowid;
|
size_t base_rowid;
|
||||||
|
|
||||||
@@ -159,6 +161,9 @@ struct GHistIndexMatrixView {
|
|||||||
ft_{ft},
|
ft_{ft},
|
||||||
workspace_{workplace},
|
workspace_{workplace},
|
||||||
current_unroll_(n_threads > 0 ? n_threads : 1, 0),
|
current_unroll_(n_threads > 0 ? n_threads : 1, 0),
|
||||||
|
ptrs_{_page.cut.Ptrs()},
|
||||||
|
mins_{_page.cut.MinValues()},
|
||||||
|
values_{_page.cut.Values()},
|
||||||
base_rowid{_page.base_rowid} {}
|
base_rowid{_page.base_rowid} {}
|
||||||
|
|
||||||
SparsePage::Inst operator[](size_t r) {
|
SparsePage::Inst operator[](size_t r) {
|
||||||
@@ -167,7 +172,7 @@ struct GHistIndexMatrixView {
|
|||||||
size_t non_missing{beg};
|
size_t non_missing{beg};
|
||||||
|
|
||||||
for (bst_feature_t c = 0; c < n_features_; ++c) {
|
for (bst_feature_t c = 0; c < n_features_; ++c) {
|
||||||
float f = page_.GetFvalue(r, c, common::IsCat(ft_, c));
|
float f = page_.GetFvalue(ptrs_, values_, mins_, r, c, common::IsCat(ft_, c));
|
||||||
if (!common::CheckNAN(f)) {
|
if (!common::CheckNAN(f)) {
|
||||||
workspace_[non_missing] = Entry{c, f};
|
workspace_[non_missing] = Entry{c, f};
|
||||||
++non_missing;
|
++non_missing;
|
||||||
@@ -250,10 +255,9 @@ void PredictBatchByBlockOfRowsKernel(
|
|||||||
FVecFill(block_size, batch_offset, num_feature, &batch, fvec_offset,
|
FVecFill(block_size, batch_offset, num_feature, &batch, fvec_offset,
|
||||||
p_thread_temp);
|
p_thread_temp);
|
||||||
// process block of rows through all trees to keep cache locality
|
// process block of rows through all trees to keep cache locality
|
||||||
PredictByAllTrees(model, tree_begin, tree_end, out_preds,
|
PredictByAllTrees(model, tree_begin, tree_end, out_preds, batch_offset + batch.base_rowid,
|
||||||
batch_offset + batch.base_rowid, num_group, thread_temp,
|
num_group, thread_temp, fvec_offset, block_size);
|
||||||
fvec_offset, block_size);
|
FVecDrop(block_size, fvec_offset, p_thread_temp);
|
||||||
FVecDrop(block_size, batch_offset, &batch, fvec_offset, p_thread_temp);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,7 +474,7 @@ class CPUPredictor : public Predictor {
|
|||||||
bst_node_t tid = GetLeafIndex<true, true>(tree, feats, cats);
|
bst_node_t tid = GetLeafIndex<true, true>(tree, feats, cats);
|
||||||
preds[ridx * ntree_limit + j] = static_cast<bst_float>(tid);
|
preds[ridx * ntree_limit + j] = static_cast<bst_float>(tid);
|
||||||
}
|
}
|
||||||
feats.Drop(page[i]);
|
feats.Drop();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -544,7 +548,7 @@ class CPUPredictor : public Predictor {
|
|||||||
(tree_weights == nullptr ? 1 : (*tree_weights)[j]);
|
(tree_weights == nullptr ? 1 : (*tree_weights)[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
feats.Drop(page[i]);
|
feats.Drop();
|
||||||
// add base margin to BIAS
|
// add base margin to BIAS
|
||||||
if (base_margin.Size() != 0) {
|
if (base_margin.Size() != 0) {
|
||||||
CHECK_EQ(base_margin.Shape(1), ngroup);
|
CHECK_EQ(base_margin.Shape(1), ngroup);
|
||||||
|
|||||||
@@ -389,6 +389,7 @@ class HistEvaluator {
|
|||||||
tree_evaluator_.AddSplit(candidate.nid, left_child, right_child,
|
tree_evaluator_.AddSplit(candidate.nid, left_child, right_child,
|
||||||
tree[candidate.nid].SplitIndex(), left_weight,
|
tree[candidate.nid].SplitIndex(), left_weight,
|
||||||
right_weight);
|
right_weight);
|
||||||
|
evaluator = tree_evaluator_.GetEvaluator();
|
||||||
|
|
||||||
auto max_node = std::max(left_child, tree[candidate.nid].RightChild());
|
auto max_node = std::max(left_child, tree[candidate.nid].RightChild());
|
||||||
max_node = std::max(candidate.nid, max_node);
|
max_node = std::max(candidate.nid, max_node);
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ class TreeEvaluator {
|
|||||||
monotone_.HostVector().resize(n_features, 0);
|
monotone_.HostVector().resize(n_features, 0);
|
||||||
has_constraint_ = false;
|
has_constraint_ = false;
|
||||||
} else {
|
} else {
|
||||||
|
CHECK_LE(p.monotone_constraints.size(), n_features)
|
||||||
|
<< "The size of monotone constraint should be less or equal to the number of features.";
|
||||||
monotone_.HostVector() = p.monotone_constraints;
|
monotone_.HostVector() = p.monotone_constraints;
|
||||||
monotone_.HostVector().resize(n_features, 0);
|
monotone_.HostVector().resize(n_features, 0);
|
||||||
// Initialised to some small size, can grow if needed
|
// Initialised to some small size, can grow if needed
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ struct GPUHistMakerDevice {
|
|||||||
matrix.feature_segments,
|
matrix.feature_segments,
|
||||||
matrix.gidx_fvalue_map,
|
matrix.gidx_fvalue_map,
|
||||||
matrix.min_fvalue,
|
matrix.min_fvalue,
|
||||||
matrix.is_dense
|
matrix.is_dense && !collective::IsDistributed()
|
||||||
};
|
};
|
||||||
auto split = this->evaluator_.EvaluateSingleSplit(inputs, shared_inputs);
|
auto split = this->evaluator_.EvaluateSingleSplit(inputs, shared_inputs);
|
||||||
return split;
|
return split;
|
||||||
@@ -300,12 +300,14 @@ struct GPUHistMakerDevice {
|
|||||||
std::vector<bst_node_t> nidx(2 * candidates.size());
|
std::vector<bst_node_t> nidx(2 * candidates.size());
|
||||||
auto h_node_inputs = pinned2.GetSpan<EvaluateSplitInputs>(2 * candidates.size());
|
auto h_node_inputs = pinned2.GetSpan<EvaluateSplitInputs>(2 * candidates.size());
|
||||||
auto matrix = page->GetDeviceAccessor(ctx_->gpu_id);
|
auto matrix = page->GetDeviceAccessor(ctx_->gpu_id);
|
||||||
EvaluateSplitSharedInputs shared_inputs{
|
EvaluateSplitSharedInputs shared_inputs{GPUTrainingParam{param}, *quantiser, feature_types,
|
||||||
GPUTrainingParam{param}, *quantiser, feature_types, matrix.feature_segments,
|
matrix.feature_segments, matrix.gidx_fvalue_map,
|
||||||
matrix.gidx_fvalue_map, matrix.min_fvalue,
|
matrix.min_fvalue,
|
||||||
matrix.is_dense
|
// is_dense represents the local data
|
||||||
};
|
matrix.is_dense && !collective::IsDistributed()};
|
||||||
dh::TemporaryArray<GPUExpandEntry> entries(2 * candidates.size());
|
dh::TemporaryArray<GPUExpandEntry> entries(2 * candidates.size());
|
||||||
|
// Store the feature set ptrs so they dont go out of scope before the kernel is called
|
||||||
|
std::vector<std::shared_ptr<HostDeviceVector<bst_feature_t>>> feature_sets;
|
||||||
for (size_t i = 0; i < candidates.size(); i++) {
|
for (size_t i = 0; i < candidates.size(); i++) {
|
||||||
auto candidate = candidates.at(i);
|
auto candidate = candidates.at(i);
|
||||||
int left_nidx = tree[candidate.nid].LeftChild();
|
int left_nidx = tree[candidate.nid].LeftChild();
|
||||||
@@ -314,10 +316,12 @@ struct GPUHistMakerDevice {
|
|||||||
nidx[i * 2 + 1] = right_nidx;
|
nidx[i * 2 + 1] = right_nidx;
|
||||||
auto left_sampled_features = column_sampler.GetFeatureSet(tree.GetDepth(left_nidx));
|
auto left_sampled_features = column_sampler.GetFeatureSet(tree.GetDepth(left_nidx));
|
||||||
left_sampled_features->SetDevice(ctx_->gpu_id);
|
left_sampled_features->SetDevice(ctx_->gpu_id);
|
||||||
|
feature_sets.emplace_back(left_sampled_features);
|
||||||
common::Span<bst_feature_t> left_feature_set =
|
common::Span<bst_feature_t> left_feature_set =
|
||||||
interaction_constraints.Query(left_sampled_features->DeviceSpan(), left_nidx);
|
interaction_constraints.Query(left_sampled_features->DeviceSpan(), left_nidx);
|
||||||
auto right_sampled_features = column_sampler.GetFeatureSet(tree.GetDepth(right_nidx));
|
auto right_sampled_features = column_sampler.GetFeatureSet(tree.GetDepth(right_nidx));
|
||||||
right_sampled_features->SetDevice(ctx_->gpu_id);
|
right_sampled_features->SetDevice(ctx_->gpu_id);
|
||||||
|
feature_sets.emplace_back(right_sampled_features);
|
||||||
common::Span<bst_feature_t> right_feature_set =
|
common::Span<bst_feature_t> right_feature_set =
|
||||||
interaction_constraints.Query(right_sampled_features->DeviceSpan(),
|
interaction_constraints.Query(right_sampled_features->DeviceSpan(),
|
||||||
right_nidx);
|
right_nidx);
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ CPUExpandEntry QuantileHistMaker::Builder::InitRoot(
|
|||||||
|
|
||||||
{
|
{
|
||||||
GradientPairPrecise grad_stat;
|
GradientPairPrecise grad_stat;
|
||||||
if (p_fmat->IsDense()) {
|
if (p_fmat->IsDense() && !collective::IsDistributed()) {
|
||||||
/**
|
/**
|
||||||
* Specialized code for dense data: For dense data (with no missing value), the sum
|
* Specialized code for dense data: For dense data (with no missing value), the sum
|
||||||
* of gradient histogram is equal to snode[nid]
|
* of gradient histogram is equal to snode[nid]
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class TreeRefresher : public TreeUpdater {
|
|||||||
dmlc::BeginPtr(stemp[tid]) + offset);
|
dmlc::BeginPtr(stemp[tid]) + offset);
|
||||||
offset += tree->param.num_nodes;
|
offset += tree->param.num_nodes;
|
||||||
}
|
}
|
||||||
feats.Drop(inst);
|
feats.Drop();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// aggregate the statistics
|
// aggregate the statistics
|
||||||
|
|||||||
@@ -23,10 +23,15 @@ case "${container}" in
|
|||||||
gpu|rmm)
|
gpu|rmm)
|
||||||
BUILD_ARGS="$BUILD_ARGS --build-arg CUDA_VERSION_ARG=$CUDA_VERSION"
|
BUILD_ARGS="$BUILD_ARGS --build-arg CUDA_VERSION_ARG=$CUDA_VERSION"
|
||||||
BUILD_ARGS="$BUILD_ARGS --build-arg RAPIDS_VERSION_ARG=$RAPIDS_VERSION"
|
BUILD_ARGS="$BUILD_ARGS --build-arg RAPIDS_VERSION_ARG=$RAPIDS_VERSION"
|
||||||
|
if [[ $container == "rmm" ]]
|
||||||
|
then
|
||||||
|
BUILD_ARGS="$BUILD_ARGS --build-arg NCCL_VERSION_ARG=$NCCL_VERSION"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
gpu_build_centos7|jvm_gpu_build)
|
gpu_build_centos7|jvm_gpu_build)
|
||||||
BUILD_ARGS="$BUILD_ARGS --build-arg CUDA_VERSION_ARG=$CUDA_VERSION"
|
BUILD_ARGS="$BUILD_ARGS --build-arg CUDA_VERSION_ARG=$CUDA_VERSION"
|
||||||
|
BUILD_ARGS="$BUILD_ARGS --build-arg NCCL_VERSION_ARG=$NCCL_VERSION"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ fi
|
|||||||
|
|
||||||
command_wrapper="tests/ci_build/ci_build.sh rmm docker --build-arg "`
|
command_wrapper="tests/ci_build/ci_build.sh rmm docker --build-arg "`
|
||||||
`"CUDA_VERSION_ARG=$CUDA_VERSION --build-arg "`
|
`"CUDA_VERSION_ARG=$CUDA_VERSION --build-arg "`
|
||||||
`"RAPIDS_VERSION_ARG=$RAPIDS_VERSION"
|
`"RAPIDS_VERSION_ARG=$RAPIDS_VERSION --build-arg "`
|
||||||
|
`"NCCL_VERSION_ARG=$NCCL_VERSION"
|
||||||
|
|
||||||
echo "--- Build libxgboost from the source"
|
echo "--- Build libxgboost from the source"
|
||||||
$command_wrapper tests/ci_build/build_via_cmake.sh --conda-env=gpu_test -DUSE_CUDA=ON \
|
$command_wrapper tests/ci_build/build_via_cmake.sh --conda-env=gpu_test -DUSE_CUDA=ON \
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
command_wrapper="tests/ci_build/ci_build.sh gpu_build_centos7 docker --build-arg "`
|
command_wrapper="tests/ci_build/ci_build.sh gpu_build_centos7 docker --build-arg "`
|
||||||
`"CUDA_VERSION_ARG=$CUDA_VERSION"
|
`"CUDA_VERSION_ARG=$CUDA_VERSION --build-arg "`
|
||||||
|
`"NCCL_VERSION_ARG=$NCCL_VERSION"
|
||||||
|
|
||||||
echo "--- Build libxgboost from the source"
|
echo "--- Build libxgboost from the source"
|
||||||
$command_wrapper tests/ci_build/prune_libnccl.sh
|
$command_wrapper tests/ci_build/prune_libnccl.sh
|
||||||
|
|||||||
@@ -14,5 +14,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
tests/ci_build/ci_build.sh jvm_gpu_build nvidia-docker \
|
tests/ci_build/ci_build.sh jvm_gpu_build nvidia-docker \
|
||||||
--build-arg CUDA_VERSION_ARG=${CUDA_VERSION} tests/ci_build/build_jvm_packages.sh \
|
--build-arg CUDA_VERSION_ARG=${CUDA_VERSION} \
|
||||||
|
--build-arg NCCL_VERSION_ARG=${NCCL_VERSION} \
|
||||||
|
tests/ci_build/build_jvm_packages.sh \
|
||||||
${SPARK_VERSION} -Duse.cuda=ON ${arch_flag}
|
${SPARK_VERSION} -Duse.cuda=ON ${arch_flag}
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ if ( $is_release_branch -eq 0 ) {
|
|||||||
}
|
}
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake .. -G"Visual Studio 15 2017 Win64" -DUSE_CUDA=ON -DCMAKE_VERBOSE_MAKEFILE=ON `
|
cmake .. -G"Visual Studio 17 2022" -A x64 -DUSE_CUDA=ON -DCMAKE_VERBOSE_MAKEFILE=ON `
|
||||||
-DGOOGLE_TEST=ON -DUSE_DMLC_GTEST=ON -DCMAKE_UNITY_BUILD=ON ${arch_flag}
|
-DGOOGLE_TEST=ON -DUSE_DMLC_GTEST=ON ${arch_flag}
|
||||||
$msbuild = -join @(
|
$msbuild = -join @(
|
||||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0"
|
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current"
|
||||||
"\\Bin\\MSBuild.exe"
|
"\\Bin\\MSBuild.exe"
|
||||||
)
|
)
|
||||||
& $msbuild xgboost.sln /m /p:Configuration=Release /nodeReuse:false
|
& $msbuild xgboost.sln /m /p:Configuration=Release /nodeReuse:false
|
||||||
|
|||||||
@@ -22,9 +22,10 @@ function set_buildkite_env_vars_in_container {
|
|||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
CUDA_VERSION=11.0.3
|
CUDA_VERSION=11.8.0
|
||||||
RAPIDS_VERSION=22.10
|
NCCL_VERSION=2.16.5-1
|
||||||
SPARK_VERSION=3.0.1
|
RAPIDS_VERSION=23.02
|
||||||
|
SPARK_VERSION=3.1.1
|
||||||
JDK_VERSION=8
|
JDK_VERSION=8
|
||||||
|
|
||||||
if [[ -z ${BUILDKITE:-} ]]
|
if [[ -z ${BUILDKITE:-} ]]
|
||||||
|
|||||||
@@ -9,5 +9,6 @@ then
|
|||||||
echo "--- Deploy JVM packages to xgboost-maven-repo S3 repo"
|
echo "--- Deploy JVM packages to xgboost-maven-repo S3 repo"
|
||||||
tests/ci_build/ci_build.sh jvm_gpu_build docker \
|
tests/ci_build/ci_build.sh jvm_gpu_build docker \
|
||||||
--build-arg CUDA_VERSION_ARG=${CUDA_VERSION} \
|
--build-arg CUDA_VERSION_ARG=${CUDA_VERSION} \
|
||||||
|
--build-arg NCCL_VERSION_ARG=${NCCL_VERSION} \
|
||||||
tests/ci_build/deploy_jvm_packages.sh ${SPARK_VERSION}
|
tests/ci_build/deploy_jvm_packages.sh ${SPARK_VERSION}
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -2,12 +2,16 @@ import argparse
|
|||||||
import copy
|
import copy
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
import boto3
|
import boto3
|
||||||
import botocore
|
import botocore
|
||||||
from metadata import AMI_ID, COMMON_STACK_PARAMS, STACK_PARAMS
|
from metadata import AMI_ID, COMMON_STACK_PARAMS, STACK_PARAMS
|
||||||
|
|
||||||
current_dir = os.path.dirname(__file__)
|
current_dir = os.path.dirname(__file__)
|
||||||
|
sys.path.append(os.path.join(current_dir, ".."))
|
||||||
|
|
||||||
|
from common_blocks.utils import create_or_update_stack, wait
|
||||||
|
|
||||||
TEMPLATE_URL = "https://s3.amazonaws.com/buildkite-aws-stack/latest/aws-stack.yml"
|
TEMPLATE_URL = "https://s3.amazonaws.com/buildkite-aws-stack/latest/aws-stack.yml"
|
||||||
|
|
||||||
@@ -68,72 +72,7 @@ def get_full_stack_id(stack_id):
|
|||||||
return f"buildkite-{stack_id}-autoscaling-group"
|
return f"buildkite-{stack_id}-autoscaling-group"
|
||||||
|
|
||||||
|
|
||||||
def stack_exists(args, *, stack_name):
|
def create_agent_iam_policy(args, *, client):
|
||||||
client = boto3.client("cloudformation", region_name=args.aws_region)
|
|
||||||
waiter = client.get_waiter("stack_exists")
|
|
||||||
try:
|
|
||||||
waiter.wait(StackName=stack_name, WaiterConfig={"MaxAttempts": 1})
|
|
||||||
return True
|
|
||||||
except botocore.exceptions.WaiterError as e:
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def create_or_update_stack(
|
|
||||||
args, *, stack_name, template_url=None, template_body=None, params=None
|
|
||||||
):
|
|
||||||
kwargs = {
|
|
||||||
"StackName": stack_name,
|
|
||||||
"Capabilities": [
|
|
||||||
"CAPABILITY_IAM",
|
|
||||||
"CAPABILITY_NAMED_IAM",
|
|
||||||
"CAPABILITY_AUTO_EXPAND",
|
|
||||||
],
|
|
||||||
}
|
|
||||||
if template_url:
|
|
||||||
kwargs["TemplateURL"] = template_url
|
|
||||||
if template_body:
|
|
||||||
kwargs["TemplateBody"] = template_body
|
|
||||||
if params:
|
|
||||||
kwargs["Parameters"] = params
|
|
||||||
|
|
||||||
client = boto3.client("cloudformation", region_name=args.aws_region)
|
|
||||||
|
|
||||||
if stack_exists(args, stack_name=stack_name):
|
|
||||||
print(f"Stack {stack_name} already exists. Updating...")
|
|
||||||
try:
|
|
||||||
response = client.update_stack(**kwargs)
|
|
||||||
return {"StackName": stack_name, "Action": "update"}
|
|
||||||
except botocore.exceptions.ClientError as e:
|
|
||||||
if e.response["Error"]["Code"] == "ValidationError" and re.search(
|
|
||||||
"No updates are to be performed", e.response["Error"]["Message"]
|
|
||||||
):
|
|
||||||
print(f"No update was made to {stack_name}")
|
|
||||||
return {"StackName": stack_name, "Action": "noop"}
|
|
||||||
else:
|
|
||||||
raise e
|
|
||||||
else:
|
|
||||||
kwargs.update({"OnFailure": "ROLLBACK", "EnableTerminationProtection": False})
|
|
||||||
response = client.create_stack(**kwargs)
|
|
||||||
return {"StackName": stack_name, "Action": "create"}
|
|
||||||
|
|
||||||
|
|
||||||
def wait(promise):
|
|
||||||
client = boto3.client("cloudformation", region_name=args.aws_region)
|
|
||||||
stack_name = promise["StackName"]
|
|
||||||
print(f"Waiting for {stack_name}...")
|
|
||||||
if promise["Action"] == "create":
|
|
||||||
waiter = client.get_waiter("stack_create_complete")
|
|
||||||
waiter.wait(StackName=stack_name)
|
|
||||||
print(f"Finished creating stack {stack_name}")
|
|
||||||
elif promise["Action"] == "update":
|
|
||||||
waiter = client.get_waiter("stack_update_complete")
|
|
||||||
waiter.wait(StackName=stack_name)
|
|
||||||
print(f"Finished updating stack {stack_name}")
|
|
||||||
elif promise["Action"] != "noop":
|
|
||||||
raise ValueError(f"Invalid promise {promise}")
|
|
||||||
|
|
||||||
|
|
||||||
def create_agent_iam_policy(args):
|
|
||||||
policy_stack_name = "buildkite-agent-iam-policy"
|
policy_stack_name = "buildkite-agent-iam-policy"
|
||||||
print(f"Creating stack {policy_stack_name} for agent IAM policy...")
|
print(f"Creating stack {policy_stack_name} for agent IAM policy...")
|
||||||
with open(
|
with open(
|
||||||
@@ -142,9 +81,9 @@ def create_agent_iam_policy(args):
|
|||||||
) as f:
|
) as f:
|
||||||
policy_template = f.read()
|
policy_template = f.read()
|
||||||
promise = create_or_update_stack(
|
promise = create_or_update_stack(
|
||||||
args, stack_name=policy_stack_name, template_body=policy_template
|
args, client=client, stack_name=policy_stack_name, template_body=policy_template
|
||||||
)
|
)
|
||||||
wait(promise)
|
wait(promise, client=client)
|
||||||
|
|
||||||
cf = boto3.resource("cloudformation", region_name=args.aws_region)
|
cf = boto3.resource("cloudformation", region_name=args.aws_region)
|
||||||
policy = cf.StackResource(policy_stack_name, "BuildkiteAgentManagedPolicy")
|
policy = cf.StackResource(policy_stack_name, "BuildkiteAgentManagedPolicy")
|
||||||
@@ -152,10 +91,10 @@ def create_agent_iam_policy(args):
|
|||||||
|
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
agent_iam_policy = create_agent_iam_policy(args)
|
|
||||||
|
|
||||||
client = boto3.client("cloudformation", region_name=args.aws_region)
|
client = boto3.client("cloudformation", region_name=args.aws_region)
|
||||||
|
|
||||||
|
agent_iam_policy = create_agent_iam_policy(args, client=client)
|
||||||
|
|
||||||
promises = []
|
promises = []
|
||||||
|
|
||||||
for stack_id in AMI_ID:
|
for stack_id in AMI_ID:
|
||||||
@@ -167,13 +106,17 @@ def main(args):
|
|||||||
)
|
)
|
||||||
|
|
||||||
promise = create_or_update_stack(
|
promise = create_or_update_stack(
|
||||||
args, stack_name=stack_id_full, template_url=TEMPLATE_URL, params=params
|
args,
|
||||||
|
client=client,
|
||||||
|
stack_name=stack_id_full,
|
||||||
|
template_url=TEMPLATE_URL,
|
||||||
|
params=params,
|
||||||
)
|
)
|
||||||
promises.append(promise)
|
promises.append(promise)
|
||||||
print(f"CI stack {stack_id_full} is in progress in the background")
|
print(f"CI stack {stack_id_full} is in progress in the background")
|
||||||
|
|
||||||
for promise in promises:
|
for promise in promises:
|
||||||
wait(promise)
|
wait(promise, client=client)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
AMI_ID = {
|
AMI_ID = {
|
||||||
# Managed by XGBoost team
|
# Managed by XGBoost team
|
||||||
"linux-amd64-gpu": {
|
"linux-amd64-gpu": {
|
||||||
"us-west-2": "ami-00ed92bd37f77bc33",
|
"us-west-2": "ami-094271bed4788ddb5",
|
||||||
},
|
},
|
||||||
"linux-amd64-mgpu": {
|
"linux-amd64-mgpu": {
|
||||||
"us-west-2": "ami-00ed92bd37f77bc33",
|
"us-west-2": "ami-094271bed4788ddb5",
|
||||||
},
|
},
|
||||||
"windows-gpu": {
|
"windows-gpu": {
|
||||||
"us-west-2": "ami-0a1a2ea551a07ad5f",
|
"us-west-2": "ami-0839681594a1d7627",
|
||||||
},
|
},
|
||||||
"windows-cpu": {
|
"windows-cpu": {
|
||||||
"us-west-2": "ami-0a1a2ea551a07ad5f",
|
"us-west-2": "ami-0839681594a1d7627",
|
||||||
},
|
},
|
||||||
# Managed by BuildKite
|
# Managed by BuildKite
|
||||||
# from https://s3.amazonaws.com/buildkite-aws-stack/latest/aws-stack.yml
|
# from https://s3.amazonaws.com/buildkite-aws-stack/latest/aws-stack.yml
|
||||||
"linux-amd64-cpu": {
|
"linux-amd64-cpu": {
|
||||||
"us-west-2": "ami-075d4c25d5f0c17c1",
|
"us-west-2": "ami-00f2127550cf03658",
|
||||||
},
|
},
|
||||||
"pipeline-loader": {
|
"pipeline-loader": {
|
||||||
"us-west-2": "ami-075d4c25d5f0c17c1",
|
"us-west-2": "ami-00f2127550cf03658",
|
||||||
},
|
},
|
||||||
"linux-arm64-cpu": {
|
"linux-arm64-cpu": {
|
||||||
"us-west-2": "ami-0952c6fb6db9a9891",
|
"us-west-2": "ami-0c5789068f4a2d1b5",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
97
tests/buildkite/infrastructure/common_blocks/utils.py
Normal file
97
tests/buildkite/infrastructure/common_blocks/utils.py
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
|
import boto3
|
||||||
|
import botocore
|
||||||
|
|
||||||
|
|
||||||
|
def stack_exists(args, *, stack_name):
|
||||||
|
client = boto3.client("cloudformation", region_name=args.aws_region)
|
||||||
|
waiter = client.get_waiter("stack_exists")
|
||||||
|
try:
|
||||||
|
waiter.wait(StackName=stack_name, WaiterConfig={"MaxAttempts": 1})
|
||||||
|
return True
|
||||||
|
except botocore.exceptions.WaiterError as e:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def create_or_update_stack(
|
||||||
|
args, *, client, stack_name, template_url=None, template_body=None, params=None
|
||||||
|
):
|
||||||
|
kwargs = {
|
||||||
|
"StackName": stack_name,
|
||||||
|
"Capabilities": [
|
||||||
|
"CAPABILITY_IAM",
|
||||||
|
"CAPABILITY_NAMED_IAM",
|
||||||
|
"CAPABILITY_AUTO_EXPAND",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
if template_url:
|
||||||
|
kwargs["TemplateURL"] = template_url
|
||||||
|
if template_body:
|
||||||
|
kwargs["TemplateBody"] = template_body
|
||||||
|
if params:
|
||||||
|
kwargs["Parameters"] = params
|
||||||
|
|
||||||
|
if stack_exists(args, stack_name=stack_name):
|
||||||
|
print(f"Stack {stack_name} already exists. Updating...")
|
||||||
|
try:
|
||||||
|
response = client.update_stack(**kwargs)
|
||||||
|
return {"StackName": stack_name, "Action": "update"}
|
||||||
|
except botocore.exceptions.ClientError as e:
|
||||||
|
if e.response["Error"]["Code"] == "ValidationError" and re.search(
|
||||||
|
"No updates are to be performed", e.response["Error"]["Message"]
|
||||||
|
):
|
||||||
|
print(f"No update was made to {stack_name}")
|
||||||
|
return {"StackName": stack_name, "Action": "noop"}
|
||||||
|
else:
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
kwargs.update({"OnFailure": "ROLLBACK", "EnableTerminationProtection": False})
|
||||||
|
response = client.create_stack(**kwargs)
|
||||||
|
return {"StackName": stack_name, "Action": "create"}
|
||||||
|
|
||||||
|
|
||||||
|
def replace_stack(
|
||||||
|
args, *, client, stack_name, template_url=None, template_body=None, params=None
|
||||||
|
):
|
||||||
|
"""Delete an existing stack and create a new stack with identical name"""
|
||||||
|
|
||||||
|
if not stack_exists(args, stack_name=stack_name):
|
||||||
|
raise ValueError(f"Stack {stack_name} does not exist")
|
||||||
|
r = client.delete_stack(StackName=stack_name)
|
||||||
|
delete_waiter = client.get_waiter("stack_delete_complete")
|
||||||
|
delete_waiter.wait(StackName=stack_name)
|
||||||
|
|
||||||
|
kwargs = {
|
||||||
|
"StackName": stack_name,
|
||||||
|
"Capabilities": [
|
||||||
|
"CAPABILITY_IAM",
|
||||||
|
"CAPABILITY_NAMED_IAM",
|
||||||
|
"CAPABILITY_AUTO_EXPAND",
|
||||||
|
],
|
||||||
|
"OnFailure": "ROLLBACK",
|
||||||
|
"EnableTerminationProtection": False,
|
||||||
|
}
|
||||||
|
if template_url:
|
||||||
|
kwargs["TemplateURL"] = template_url
|
||||||
|
if template_body:
|
||||||
|
kwargs["TemplateBody"] = template_body
|
||||||
|
if params:
|
||||||
|
kwargs["Parameters"] = params
|
||||||
|
response = client.create_stack(**kwargs)
|
||||||
|
return {"StackName": stack_name, "Action": "create"}
|
||||||
|
|
||||||
|
|
||||||
|
def wait(promise, *, client):
|
||||||
|
stack_name = promise["StackName"]
|
||||||
|
print(f"Waiting for {stack_name}...")
|
||||||
|
if promise["Action"] == "create":
|
||||||
|
waiter = client.get_waiter("stack_create_complete")
|
||||||
|
waiter.wait(StackName=stack_name)
|
||||||
|
print(f"Finished creating stack {stack_name}")
|
||||||
|
elif promise["Action"] == "update":
|
||||||
|
waiter = client.get_waiter("stack_update_complete")
|
||||||
|
waiter.wait(StackName=stack_name)
|
||||||
|
print(f"Finished updating stack {stack_name}")
|
||||||
|
elif promise["Action"] != "noop":
|
||||||
|
raise ValueError(f"Invalid promise {promise}")
|
||||||
@@ -2,6 +2,7 @@ import argparse
|
|||||||
import copy
|
import copy
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
|
|
||||||
import boto3
|
import boto3
|
||||||
@@ -9,6 +10,9 @@ import cfn_flip
|
|||||||
from metadata import IMAGE_PARAMS
|
from metadata import IMAGE_PARAMS
|
||||||
|
|
||||||
current_dir = os.path.dirname(__file__)
|
current_dir = os.path.dirname(__file__)
|
||||||
|
sys.path.append(os.path.join(current_dir, ".."))
|
||||||
|
|
||||||
|
from common_blocks.utils import replace_stack, wait
|
||||||
|
|
||||||
BUILDKITE_CF_TEMPLATE_URL = (
|
BUILDKITE_CF_TEMPLATE_URL = (
|
||||||
"https://s3.amazonaws.com/buildkite-aws-stack/latest/aws-stack.yml"
|
"https://s3.amazonaws.com/buildkite-aws-stack/latest/aws-stack.yml"
|
||||||
@@ -47,6 +51,9 @@ def main(args):
|
|||||||
|
|
||||||
ami_mapping = get_ami_mapping()
|
ami_mapping = get_ami_mapping()
|
||||||
|
|
||||||
|
client = boto3.client("cloudformation", region_name=args.aws_region)
|
||||||
|
promises = []
|
||||||
|
|
||||||
for stack_id in IMAGE_PARAMS:
|
for stack_id in IMAGE_PARAMS:
|
||||||
stack_id_full = get_full_stack_id(stack_id)
|
stack_id_full = get_full_stack_id(stack_id)
|
||||||
print(f"Creating EC2 image builder stack {stack_id_full}...")
|
print(f"Creating EC2 image builder stack {stack_id_full}...")
|
||||||
@@ -55,28 +62,20 @@ def main(args):
|
|||||||
stack_id=stack_id, aws_region=args.aws_region, ami_mapping=ami_mapping
|
stack_id=stack_id, aws_region=args.aws_region, ami_mapping=ami_mapping
|
||||||
)
|
)
|
||||||
|
|
||||||
client = boto3.client("cloudformation", region_name=args.aws_region)
|
promise = replace_stack(
|
||||||
response = client.create_stack(
|
args,
|
||||||
StackName=stack_id_full,
|
client=client,
|
||||||
TemplateBody=ec2_image_pipeline_template,
|
stack_name=stack_id_full,
|
||||||
Capabilities=[
|
template_body=ec2_image_pipeline_template,
|
||||||
"CAPABILITY_IAM",
|
params=params,
|
||||||
"CAPABILITY_NAMED_IAM",
|
|
||||||
"CAPABILITY_AUTO_EXPAND",
|
|
||||||
],
|
|
||||||
OnFailure="ROLLBACK",
|
|
||||||
EnableTerminationProtection=False,
|
|
||||||
Parameters=params,
|
|
||||||
)
|
)
|
||||||
|
promises.append(promise)
|
||||||
print(
|
print(
|
||||||
f"EC2 image builder stack {stack_id_full} is in progress in the background"
|
f"EC2 image builder stack {stack_id_full} is in progress in the background"
|
||||||
)
|
)
|
||||||
|
|
||||||
for stack_id in IMAGE_PARAMS:
|
for promise in promises:
|
||||||
stack_id_full = get_full_stack_id(stack_id)
|
wait(promise, client=client)
|
||||||
waiter = client.get_waiter("stack_create_complete")
|
|
||||||
waiter.wait(StackName=stack_id_full)
|
|
||||||
print(f"EC2 image builder stack {stack_id_full} is now finished.")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ Resources:
|
|||||||
BootstrapComponent:
|
BootstrapComponent:
|
||||||
Type: AWS::ImageBuilder::Component
|
Type: AWS::ImageBuilder::Component
|
||||||
Properties:
|
Properties:
|
||||||
Name: !Sub "${AWS::StackName}-bootstrap-component"
|
Name: !Join ["-", [!Ref AWS::StackName, "bootstrap-component", !Select [2, !Split ['/', !Ref AWS::StackId]]]]
|
||||||
Platform: !Ref InstanceOperatingSystem
|
Platform: !Ref InstanceOperatingSystem
|
||||||
Version: "1.0.0"
|
Version: "1.0.0"
|
||||||
Description: Execute a bootstrap script.
|
Description: Execute a bootstrap script.
|
||||||
@@ -67,7 +67,7 @@ Resources:
|
|||||||
Recipe:
|
Recipe:
|
||||||
Type: AWS::ImageBuilder::ImageRecipe
|
Type: AWS::ImageBuilder::ImageRecipe
|
||||||
Properties:
|
Properties:
|
||||||
Name: !Sub "${AWS::StackName}-image"
|
Name: !Join ["-", [!Ref AWS::StackName, "image", !Select [2, !Split ['/', !Ref AWS::StackId]]]]
|
||||||
Components:
|
Components:
|
||||||
- ComponentArn: !Ref BootstrapComponent
|
- ComponentArn: !Ref BootstrapComponent
|
||||||
ParentImage: !Ref BaseImageId
|
ParentImage: !Ref BaseImageId
|
||||||
@@ -83,7 +83,7 @@ Resources:
|
|||||||
Infrastructure:
|
Infrastructure:
|
||||||
Type: AWS::ImageBuilder::InfrastructureConfiguration
|
Type: AWS::ImageBuilder::InfrastructureConfiguration
|
||||||
Properties:
|
Properties:
|
||||||
Name: !Sub "${AWS::StackName}-image-pipeline-infrastructure"
|
Name: !Join ["-", [!Ref AWS::StackName, "image-pipeline-infrastructure", !Select [2, !Split ['/', !Ref AWS::StackId]]]]
|
||||||
InstanceProfileName: !Ref InstanceProfile
|
InstanceProfileName: !Ref InstanceProfile
|
||||||
InstanceTypes:
|
InstanceTypes:
|
||||||
- !Ref InstanceType
|
- !Ref InstanceType
|
||||||
@@ -93,7 +93,7 @@ Resources:
|
|||||||
Distribution:
|
Distribution:
|
||||||
Type: AWS::ImageBuilder::DistributionConfiguration
|
Type: AWS::ImageBuilder::DistributionConfiguration
|
||||||
Properties:
|
Properties:
|
||||||
Name: !Sub "${AWS::StackName}-image-pipeline-distribution-config"
|
Name: !Join ["-", [!Ref AWS::StackName, "image-pipeline-distribution-config", !Select [2, !Split ['/', !Ref AWS::StackId]]]]
|
||||||
Distributions:
|
Distributions:
|
||||||
- Region: !Ref AWS::Region
|
- Region: !Ref AWS::Region
|
||||||
AmiDistributionConfiguration: {}
|
AmiDistributionConfiguration: {}
|
||||||
@@ -102,7 +102,7 @@ Resources:
|
|||||||
Pipeline:
|
Pipeline:
|
||||||
Type: AWS::ImageBuilder::ImagePipeline
|
Type: AWS::ImageBuilder::ImagePipeline
|
||||||
Properties:
|
Properties:
|
||||||
Name: !Sub "${AWS::StackName}-image-pipeline"
|
Name: !Join ["-", [!Ref AWS::StackName, "image-pipeline", !Select [2, !Split ['/', !Ref AWS::StackId]]]]
|
||||||
DistributionConfigurationArn: !Ref Distribution
|
DistributionConfigurationArn: !Ref Distribution
|
||||||
ImageRecipeArn: !Ref Recipe
|
ImageRecipeArn: !Ref Recipe
|
||||||
InfrastructureConfigurationArn: !Ref Infrastructure
|
InfrastructureConfigurationArn: !Ref Infrastructure
|
||||||
|
|||||||
@@ -13,6 +13,6 @@ IMAGE_PARAMS = {
|
|||||||
"BootstrapScript": "windows-gpu-bootstrap.yml",
|
"BootstrapScript": "windows-gpu-bootstrap.yml",
|
||||||
"InstanceType": "g4dn.2xlarge",
|
"InstanceType": "g4dn.2xlarge",
|
||||||
"InstanceOperatingSystem": "Windows",
|
"InstanceOperatingSystem": "Windows",
|
||||||
"VolumeSize": "80", # in GiBs
|
"VolumeSize": "120", # in GiBs
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ phases:
|
|||||||
choco --version
|
choco --version
|
||||||
choco feature enable -n=allowGlobalConfirmation
|
choco feature enable -n=allowGlobalConfirmation
|
||||||
|
|
||||||
# CMake 3.18
|
# CMake 3.25
|
||||||
Write-Host '>>> Installing CMake 3.18...'
|
Write-Host '>>> Installing CMake 3.25...'
|
||||||
choco install cmake --version 3.18.0 --installargs "ADD_CMAKE_TO_PATH=System"
|
choco install cmake --version 3.25.2 --installargs "ADD_CMAKE_TO_PATH=System"
|
||||||
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
|
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
|
||||||
|
|
||||||
# Notepad++
|
# Notepad++
|
||||||
@@ -45,18 +45,18 @@ phases:
|
|||||||
choco install graphviz
|
choco install graphviz
|
||||||
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
|
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
|
||||||
|
|
||||||
# Install Visual Studio Community 2017 (15.9)
|
# Install Visual Studio 2022 Community
|
||||||
Write-Host '>>> Installing Visual Studio 2017 Community (15.9)...'
|
Write-Host '>>> Installing Visual Studio 2022 Community...'
|
||||||
choco install visualstudio2017community --version 15.9.23.0 `
|
choco install visualstudio2022community `
|
||||||
--params "--wait --passive --norestart"
|
--params "--wait --passive --norestart"
|
||||||
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
|
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
|
||||||
choco install visualstudio2017-workload-nativedesktop --params `
|
choco install visualstudio2022-workload-nativedesktop --params `
|
||||||
"--wait --passive --norestart --includeOptional"
|
"--wait --passive --norestart --includeOptional"
|
||||||
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
|
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
|
||||||
|
|
||||||
# Install CUDA 11.0
|
# Install CUDA 11.8
|
||||||
Write-Host '>>> Installing CUDA 11.0...'
|
Write-Host '>>> Installing CUDA 11.8...'
|
||||||
choco install cuda --version 11.0.3
|
choco install cuda --version=11.8.0.52206
|
||||||
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
|
if ($LASTEXITCODE -ne 0) { throw "Last command failed" }
|
||||||
|
|
||||||
# Install Python packages
|
# Install Python packages
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ steps:
|
|||||||
queue: linux-amd64-cpu
|
queue: linux-amd64-cpu
|
||||||
- wait
|
- wait
|
||||||
#### -------- BUILD --------
|
#### -------- BUILD --------
|
||||||
- label: ":console: Run clang-tidy"
|
# - label: ":console: Run clang-tidy"
|
||||||
command: "tests/buildkite/run-clang-tidy.sh"
|
# command: "tests/buildkite/run-clang-tidy.sh"
|
||||||
key: run-clang-tidy
|
# key: run-clang-tidy
|
||||||
agents:
|
# agents:
|
||||||
queue: linux-amd64-cpu
|
# queue: linux-amd64-cpu
|
||||||
- wait
|
- wait
|
||||||
- label: ":console: Build CPU"
|
- label: ":console: Build CPU"
|
||||||
command: "tests/buildkite/build-cpu.sh"
|
command: "tests/buildkite/build-cpu.sh"
|
||||||
|
|||||||
@@ -20,4 +20,5 @@ tests/ci_build/ci_build.sh gpu nvidia-docker \
|
|||||||
# tests/ci_build/ci_build.sh rmm nvidia-docker \
|
# tests/ci_build/ci_build.sh rmm nvidia-docker \
|
||||||
# --build-arg CUDA_VERSION_ARG=$CUDA_VERSION \
|
# --build-arg CUDA_VERSION_ARG=$CUDA_VERSION \
|
||||||
# --build-arg RAPIDS_VERSION_ARG=$RAPIDS_VERSION bash -c \
|
# --build-arg RAPIDS_VERSION_ARG=$RAPIDS_VERSION bash -c \
|
||||||
|
# --build-arg NCCL_VERSION_ARG=$NCCL_VERSION bash -c \
|
||||||
# "source activate gpu_test && build/testxgboost --use-rmm-pool"
|
# "source activate gpu_test && build/testxgboost --use-rmm-pool"
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ RUN \
|
|||||||
add-apt-repository -u 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main' && \
|
add-apt-repository -u 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main' && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install -y llvm-11 clang-tidy-11 clang-11 && \
|
apt-get install -y llvm-11 clang-tidy-11 clang-11 && \
|
||||||
wget -nv -nc https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.sh --no-check-certificate && \
|
wget -nv -nc https://cmake.org/files/v3.18/cmake-3.18.0-Linux-x86_64.sh --no-check-certificate && \
|
||||||
bash cmake-3.14.0-Linux-x86_64.sh --skip-license --prefix=/usr
|
bash cmake-3.18.0-Linux-x86_64.sh --skip-license --prefix=/usr
|
||||||
|
|
||||||
# Set default clang-tidy version
|
# Set default clang-tidy version
|
||||||
RUN \
|
RUN \
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ RUN \
|
|||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install -y tar unzip wget git build-essential doxygen graphviz llvm libasan2 libidn11 ninja-build gcc-8 g++-8 openjdk-8-jdk-headless && \
|
apt-get install -y tar unzip wget git build-essential doxygen graphviz llvm libasan2 libidn11 ninja-build gcc-8 g++-8 openjdk-8-jdk-headless && \
|
||||||
# CMake
|
# CMake
|
||||||
wget -nv -nc https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.sh --no-check-certificate && \
|
wget -nv -nc https://cmake.org/files/v3.18/cmake-3.18.0-Linux-x86_64.sh --no-check-certificate && \
|
||||||
bash cmake-3.14.0-Linux-x86_64.sh --skip-license --prefix=/usr && \
|
bash cmake-3.18.0-Linux-x86_64.sh --skip-license --prefix=/usr && \
|
||||||
# Python
|
# Python
|
||||||
wget -nv https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh && \
|
wget -nv https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh && \
|
||||||
bash Mambaforge-Linux-x86_64.sh -b -p /opt/python
|
bash Mambaforge-Linux-x86_64.sh -b -p /opt/python
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ ENV PATH=/opt/python/bin:$PATH
|
|||||||
RUN \
|
RUN \
|
||||||
conda install -c conda-forge mamba && \
|
conda install -c conda-forge mamba && \
|
||||||
mamba create -n gpu_test -c rapidsai-nightly -c rapidsai -c nvidia -c conda-forge -c defaults \
|
mamba create -n gpu_test -c rapidsai-nightly -c rapidsai -c nvidia -c conda-forge -c defaults \
|
||||||
python=3.9 cudf=$RAPIDS_VERSION_ARG* rmm=$RAPIDS_VERSION_ARG* cudatoolkit=$CUDA_VERSION_ARG \
|
python=3.10 cudf=$RAPIDS_VERSION_ARG* rmm=$RAPIDS_VERSION_ARG* cudatoolkit=$CUDA_VERSION_ARG \
|
||||||
dask dask-cuda=$RAPIDS_VERSION_ARG* dask-cudf=$RAPIDS_VERSION_ARG* cupy \
|
dask dask-cuda=$RAPIDS_VERSION_ARG* dask-cudf=$RAPIDS_VERSION_ARG* cupy \
|
||||||
numpy pytest pytest-timeout scipy scikit-learn pandas matplotlib wheel python-kubernetes urllib3 graphviz hypothesis \
|
numpy pytest pytest-timeout scipy scikit-learn pandas matplotlib wheel python-kubernetes urllib3 graphviz hypothesis \
|
||||||
pyspark cloudpickle cuda-python=11.7.0 && \
|
pyspark cloudpickle cuda-python && \
|
||||||
mamba clean --all && \
|
mamba clean --all && \
|
||||||
conda run --no-capture-output -n gpu_test pip install buildkite-test-collector
|
conda run --no-capture-output -n gpu_test pip install buildkite-test-collector
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
ARG CUDA_VERSION_ARG
|
ARG CUDA_VERSION_ARG
|
||||||
FROM nvidia/cuda:$CUDA_VERSION_ARG-devel-centos7
|
FROM nvidia/cuda:$CUDA_VERSION_ARG-devel-centos7
|
||||||
ARG CUDA_VERSION_ARG
|
ARG CUDA_VERSION_ARG
|
||||||
|
ARG NCCL_VERSION_ARG
|
||||||
|
|
||||||
# Install all basic requirements
|
# Install all basic requirements
|
||||||
RUN \
|
RUN \
|
||||||
@@ -21,7 +22,7 @@ RUN \
|
|||||||
# NCCL2 (License: https://docs.nvidia.com/deeplearning/sdk/nccl-sla/index.html)
|
# NCCL2 (License: https://docs.nvidia.com/deeplearning/sdk/nccl-sla/index.html)
|
||||||
RUN \
|
RUN \
|
||||||
export CUDA_SHORT=`echo $CUDA_VERSION_ARG | grep -o -E '[0-9]+\.[0-9]'` && \
|
export CUDA_SHORT=`echo $CUDA_VERSION_ARG | grep -o -E '[0-9]+\.[0-9]'` && \
|
||||||
export NCCL_VERSION=2.13.4-1 && \
|
export NCCL_VERSION=$NCCL_VERSION_ARG && \
|
||||||
wget -nv -nc https://developer.download.nvidia.com/compute/machine-learning/repos/rhel7/x86_64/nvidia-machine-learning-repo-rhel7-1.0.0-1.x86_64.rpm && \
|
wget -nv -nc https://developer.download.nvidia.com/compute/machine-learning/repos/rhel7/x86_64/nvidia-machine-learning-repo-rhel7-1.0.0-1.x86_64.rpm && \
|
||||||
rpm -i nvidia-machine-learning-repo-rhel7-1.0.0-1.x86_64.rpm && \
|
rpm -i nvidia-machine-learning-repo-rhel7-1.0.0-1.x86_64.rpm && \
|
||||||
yum -y update && \
|
yum -y update && \
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ RUN \
|
|||||||
bash Miniconda3.sh -b -p /opt/python && \
|
bash Miniconda3.sh -b -p /opt/python && \
|
||||||
/opt/python/bin/python -m pip install auditwheel awscli && \
|
/opt/python/bin/python -m pip install auditwheel awscli && \
|
||||||
# CMake
|
# CMake
|
||||||
wget -nv -nc https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.sh --no-check-certificate && \
|
wget -nv -nc https://cmake.org/files/v3.18/cmake-3.18.0-Linux-x86_64.sh --no-check-certificate && \
|
||||||
bash cmake-3.14.0-Linux-x86_64.sh --skip-license --prefix=/usr
|
bash cmake-3.18.0-Linux-x86_64.sh --skip-license --prefix=/usr
|
||||||
|
|
||||||
ENV GOSU_VERSION 1.10
|
ENV GOSU_VERSION 1.10
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ RUN \
|
|||||||
wget -nv -nc -O Miniconda3.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
|
wget -nv -nc -O Miniconda3.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
|
||||||
bash Miniconda3.sh -b -p /opt/python && \
|
bash Miniconda3.sh -b -p /opt/python && \
|
||||||
# CMake
|
# CMake
|
||||||
wget -nv -nc https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.sh --no-check-certificate && \
|
wget -nv -nc https://cmake.org/files/v3.18/cmake-3.18.0-Linux-x86_64.sh --no-check-certificate && \
|
||||||
bash cmake-3.14.0-Linux-x86_64.sh --skip-license --prefix=/usr && \
|
bash cmake-3.18.0-Linux-x86_64.sh --skip-license --prefix=/usr && \
|
||||||
# Maven
|
# Maven
|
||||||
wget -nv -nc https://archive.apache.org/dist/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz && \
|
wget -nv -nc https://archive.apache.org/dist/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz && \
|
||||||
tar xvf apache-maven-3.6.1-bin.tar.gz -C /opt && \
|
tar xvf apache-maven-3.6.1-bin.tar.gz -C /opt && \
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
ARG CUDA_VERSION_ARG
|
ARG CUDA_VERSION_ARG
|
||||||
FROM nvidia/cuda:$CUDA_VERSION_ARG-devel-centos7
|
FROM nvidia/cuda:$CUDA_VERSION_ARG-devel-centos7
|
||||||
ARG CUDA_VERSION_ARG
|
ARG CUDA_VERSION_ARG
|
||||||
|
ARG NCCL_VERSION_ARG
|
||||||
|
|
||||||
# Install all basic requirements
|
# Install all basic requirements
|
||||||
RUN \
|
RUN \
|
||||||
@@ -14,8 +15,8 @@ RUN \
|
|||||||
wget -nv -nc -O Miniconda3.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
|
wget -nv -nc -O Miniconda3.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
|
||||||
bash Miniconda3.sh -b -p /opt/python && \
|
bash Miniconda3.sh -b -p /opt/python && \
|
||||||
# CMake
|
# CMake
|
||||||
wget -nv -nc https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.sh --no-check-certificate && \
|
wget -nv -nc https://cmake.org/files/v3.18/cmake-3.18.0-Linux-x86_64.sh --no-check-certificate && \
|
||||||
bash cmake-3.14.0-Linux-x86_64.sh --skip-license --prefix=/usr && \
|
bash cmake-3.18.0-Linux-x86_64.sh --skip-license --prefix=/usr && \
|
||||||
# Maven
|
# Maven
|
||||||
wget -nv -nc https://archive.apache.org/dist/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz && \
|
wget -nv -nc https://archive.apache.org/dist/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz && \
|
||||||
tar xvf apache-maven-3.6.1-bin.tar.gz -C /opt && \
|
tar xvf apache-maven-3.6.1-bin.tar.gz -C /opt && \
|
||||||
@@ -24,7 +25,7 @@ RUN \
|
|||||||
# NCCL2 (License: https://docs.nvidia.com/deeplearning/sdk/nccl-sla/index.html)
|
# NCCL2 (License: https://docs.nvidia.com/deeplearning/sdk/nccl-sla/index.html)
|
||||||
RUN \
|
RUN \
|
||||||
export CUDA_SHORT=`echo $CUDA_VERSION_ARG | grep -o -E '[0-9]+\.[0-9]'` && \
|
export CUDA_SHORT=`echo $CUDA_VERSION_ARG | grep -o -E '[0-9]+\.[0-9]'` && \
|
||||||
export NCCL_VERSION=2.13.4-1 && \
|
export NCCL_VERSION=$NCCL_VERSION_ARG && \
|
||||||
yum-config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo && \
|
yum-config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo && \
|
||||||
yum -y update && \
|
yum -y update && \
|
||||||
yum install -y libnccl-${NCCL_VERSION}+cuda${CUDA_SHORT} libnccl-devel-${NCCL_VERSION}+cuda${CUDA_SHORT} libnccl-static-${NCCL_VERSION}+cuda${CUDA_SHORT}
|
yum install -y libnccl-${NCCL_VERSION}+cuda${CUDA_SHORT} libnccl-devel-${NCCL_VERSION}+cuda${CUDA_SHORT} libnccl-static-${NCCL_VERSION}+cuda${CUDA_SHORT}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
ARG CUDA_VERSION_ARG
|
ARG CUDA_VERSION_ARG
|
||||||
FROM nvidia/cuda:$CUDA_VERSION_ARG-devel-ubuntu18.04
|
FROM nvidia/cuda:$CUDA_VERSION_ARG-devel-ubuntu20.04
|
||||||
ARG CUDA_VERSION_ARG
|
ARG CUDA_VERSION_ARG
|
||||||
ARG RAPIDS_VERSION_ARG
|
ARG RAPIDS_VERSION_ARG
|
||||||
|
ARG NCCL_VERSION_ARG
|
||||||
|
|
||||||
# Environment
|
# Environment
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
@@ -19,7 +20,7 @@ RUN \
|
|||||||
# NCCL2 (License: https://docs.nvidia.com/deeplearning/sdk/nccl-sla/index.html)
|
# NCCL2 (License: https://docs.nvidia.com/deeplearning/sdk/nccl-sla/index.html)
|
||||||
RUN \
|
RUN \
|
||||||
export CUDA_SHORT=`echo $CUDA_VERSION_ARG | grep -o -E '[0-9]+\.[0-9]'` && \
|
export CUDA_SHORT=`echo $CUDA_VERSION_ARG | grep -o -E '[0-9]+\.[0-9]'` && \
|
||||||
export NCCL_VERSION=2.13.4-1 && \
|
export NCCL_VERSION=$NCCL_VERSION_ARG && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install -y --allow-downgrades --allow-change-held-packages libnccl2=${NCCL_VERSION}+cuda${CUDA_SHORT} libnccl-dev=${NCCL_VERSION}+cuda${CUDA_SHORT}
|
apt-get install -y --allow-downgrades --allow-change-held-packages libnccl2=${NCCL_VERSION}+cuda${CUDA_SHORT} libnccl-dev=${NCCL_VERSION}+cuda${CUDA_SHORT}
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ ENV PATH=/opt/python/bin:$PATH
|
|||||||
RUN \
|
RUN \
|
||||||
conda install -c conda-forge mamba && \
|
conda install -c conda-forge mamba && \
|
||||||
mamba create -n gpu_test -c rapidsai-nightly -c rapidsai -c nvidia -c conda-forge -c defaults \
|
mamba create -n gpu_test -c rapidsai-nightly -c rapidsai -c nvidia -c conda-forge -c defaults \
|
||||||
python=3.9 rmm=$RAPIDS_VERSION_ARG* cudatoolkit=$CUDA_VERSION_ARG cmake && \
|
python=3.10 rmm=$RAPIDS_VERSION_ARG* cudatoolkit=$CUDA_VERSION_ARG cmake && \
|
||||||
mamba clean --all
|
mamba clean --all
|
||||||
|
|
||||||
ENV GOSU_VERSION 1.10
|
ENV GOSU_VERSION 1.10
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ mv xgboost/ xgboost_rpack/
|
|||||||
|
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake .. -G"Visual Studio 15 2017 Win64" -DUSE_CUDA=ON -DR_LIB=ON -DLIBR_HOME="c:\\Program Files\\R\\R-3.6.3"
|
cmake .. -G"Visual Studio 17 2022" -A x64 -DUSE_CUDA=ON -DR_LIB=ON -DLIBR_HOME="c:\\Program Files\\R\\R-3.6.3"
|
||||||
cmake --build . --config Release --parallel
|
cmake --build . --config Release --parallel
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,5 @@ dependencies:
|
|||||||
- pyspark
|
- pyspark
|
||||||
- cloudpickle
|
- cloudpickle
|
||||||
- pip:
|
- pip:
|
||||||
- shap
|
|
||||||
- awscli
|
- awscli
|
||||||
- auditwheel
|
- auditwheel
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ dependencies:
|
|||||||
- pyarrow
|
- pyarrow
|
||||||
- protobuf
|
- protobuf
|
||||||
- cloudpickle
|
- cloudpickle
|
||||||
- shap
|
|
||||||
- modin
|
- modin
|
||||||
# TODO: Replace it with pyspark>=3.4 once 3.4 released.
|
# TODO: Replace it with pyspark>=3.4 once 3.4 released.
|
||||||
# - https://ml-team-public-read.s3.us-west-2.amazonaws.com/pyspark-3.4.0.dev0.tar.gz
|
# - https://ml-team-public-read.s3.us-west-2.amazonaws.com/pyspark-3.4.0.dev0.tar.gz
|
||||||
|
|||||||
@@ -1,19 +1,102 @@
|
|||||||
import sys
|
import argparse
|
||||||
import re
|
import base64
|
||||||
import zipfile
|
|
||||||
import glob
|
import glob
|
||||||
|
import hashlib
|
||||||
|
import os
|
||||||
|
import pathlib
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
import tempfile
|
||||||
|
|
||||||
if len(sys.argv) != 2:
|
VCOMP140_PATH = "C:\\Windows\\System32\\vcomp140.dll"
|
||||||
print('Usage: {} [wheel]'.format(sys.argv[0]))
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
vcomp140_path = 'C:\\Windows\\System32\\vcomp140.dll'
|
|
||||||
|
|
||||||
for wheel_path in sorted(glob.glob(sys.argv[1])):
|
def get_sha256sum(path):
|
||||||
m = re.search(r'xgboost-(.*)-py3', wheel_path)
|
return (
|
||||||
assert m, f'wheel_path = {wheel_path}'
|
base64.urlsafe_b64encode(hashlib.sha256(open(path, "rb").read()).digest())
|
||||||
version = m.group(1)
|
.decode("latin1")
|
||||||
|
.rstrip("=")
|
||||||
|
)
|
||||||
|
|
||||||
print(f"Inserting vcomp140.dll into {wheel_path}...")
|
|
||||||
with zipfile.ZipFile(wheel_path, 'a') as f:
|
def update_record(*, wheel_content_dir, xgboost_version):
|
||||||
f.write(vcomp140_path, 'xgboost-{}.data/data/xgboost/vcomp140.dll'.format(version))
|
vcomp140_size = os.path.getsize(VCOMP140_PATH)
|
||||||
|
vcomp140_hash = get_sha256sum(VCOMP140_PATH)
|
||||||
|
|
||||||
|
record_path = wheel_content_dir / pathlib.Path(
|
||||||
|
f"xgboost-{xgboost_version}.dist-info/RECORD"
|
||||||
|
)
|
||||||
|
with open(record_path, "r") as f:
|
||||||
|
record_content = f.read()
|
||||||
|
record_content += f"xgboost-{xgboost_version}.data/data/xgboost/vcomp140.dll,"
|
||||||
|
record_content += f"sha256={vcomp140_hash},{vcomp140_size}\n"
|
||||||
|
with open(record_path, "w") as f:
|
||||||
|
f.write(record_content)
|
||||||
|
|
||||||
|
|
||||||
|
def main(args):
|
||||||
|
candidates = list(sorted(glob.glob(args.wheel_path)))
|
||||||
|
for wheel_path in candidates:
|
||||||
|
print(f"Processing wheel {wheel_path}")
|
||||||
|
m = re.search(r"xgboost-(.*)\+.*-py3", wheel_path)
|
||||||
|
if not m:
|
||||||
|
raise ValueError(f"Wheel {wheel_path} has unexpected name")
|
||||||
|
version = m.group(1)
|
||||||
|
print(f" Detected version for {wheel_path}: {version}")
|
||||||
|
print(f" Inserting vcomp140.dll into {wheel_path}...")
|
||||||
|
with tempfile.TemporaryDirectory() as tempdir:
|
||||||
|
wheel_content_dir = pathlib.Path(tempdir) / "wheel_content"
|
||||||
|
print(f" Extract {wheel_path} into {wheel_content_dir}")
|
||||||
|
shutil.unpack_archive(
|
||||||
|
wheel_path, extract_dir=wheel_content_dir, format="zip"
|
||||||
|
)
|
||||||
|
data_dir = wheel_content_dir / pathlib.Path(
|
||||||
|
f"xgboost-{version}.data/data/xgboost"
|
||||||
|
)
|
||||||
|
data_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
print(f" Copy {VCOMP140_PATH} -> {data_dir}")
|
||||||
|
shutil.copy(VCOMP140_PATH, data_dir)
|
||||||
|
|
||||||
|
print(f" Update RECORD")
|
||||||
|
update_record(wheel_content_dir=wheel_content_dir, xgboost_version=version)
|
||||||
|
|
||||||
|
print(f" Content of {wheel_content_dir}:")
|
||||||
|
for e in sorted(wheel_content_dir.rglob("*")):
|
||||||
|
if e.is_file():
|
||||||
|
r = e.relative_to(wheel_content_dir)
|
||||||
|
print(f" {r}")
|
||||||
|
|
||||||
|
print(f" Create new wheel...")
|
||||||
|
new_wheel_tmp_path = pathlib.Path(tempdir) / "new_wheel"
|
||||||
|
shutil.make_archive(
|
||||||
|
str(new_wheel_tmp_path.resolve()),
|
||||||
|
format="zip",
|
||||||
|
root_dir=wheel_content_dir,
|
||||||
|
)
|
||||||
|
new_wheel_tmp_path = new_wheel_tmp_path.resolve().with_suffix(".zip")
|
||||||
|
new_wheel_tmp_path = new_wheel_tmp_path.rename(
|
||||||
|
new_wheel_tmp_path.with_suffix(".whl")
|
||||||
|
)
|
||||||
|
print(f" Created new wheel {new_wheel_tmp_path}")
|
||||||
|
|
||||||
|
# Rename the old wheel with suffix .bak
|
||||||
|
# The new wheel takes the name of the old wheel
|
||||||
|
wheel_path_obj = pathlib.Path(wheel_path).resolve()
|
||||||
|
backup_path = wheel_path_obj.with_suffix(".whl.bak")
|
||||||
|
print(f" Rename {wheel_path_obj} -> {backup_path}")
|
||||||
|
wheel_path_obj.replace(backup_path)
|
||||||
|
print(f" Rename {new_wheel_tmp_path} -> {wheel_path_obj}")
|
||||||
|
new_wheel_tmp_path.replace(wheel_path_obj)
|
||||||
|
|
||||||
|
shutil.rmtree(wheel_content_dir)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument(
|
||||||
|
"wheel_path", type=str, help="Path to wheel (wildcard permitted)"
|
||||||
|
)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
main(args)
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "../../../src/tree/constraints.h"
|
#include "../../../src/tree/constraints.h"
|
||||||
|
#include "../../../src/tree/hist/evaluate_splits.h"
|
||||||
|
#include "../../../src/tree/hist/expand_entry.h"
|
||||||
|
#include "../helpers.h"
|
||||||
|
|
||||||
namespace xgboost {
|
namespace xgboost {
|
||||||
namespace tree {
|
namespace tree {
|
||||||
@@ -56,5 +59,38 @@ TEST(CPUFeatureInteractionConstraint, Basic) {
|
|||||||
ASSERT_FALSE(constraints.Query(1, 5));
|
ASSERT_FALSE(constraints.Query(1, 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(CPUMonoConstraint, Basic) {
|
||||||
|
std::size_t kRows{64}, kCols{16};
|
||||||
|
Context ctx;
|
||||||
|
|
||||||
|
TrainParam param;
|
||||||
|
std::vector<std::int32_t> mono(kCols, 1);
|
||||||
|
I32Array arr;
|
||||||
|
for (std::size_t i = 0; i < kCols; ++i) {
|
||||||
|
arr.GetArray().push_back(mono[i]);
|
||||||
|
}
|
||||||
|
Json jarr{std::move(arr)};
|
||||||
|
std::string str_mono;
|
||||||
|
Json::Dump(jarr, &str_mono);
|
||||||
|
str_mono.front() = '(';
|
||||||
|
str_mono.back() = ')';
|
||||||
|
|
||||||
|
param.UpdateAllowUnknown(Args{{"monotone_constraints", str_mono}});
|
||||||
|
|
||||||
|
auto Xy = RandomDataGenerator{kRows, kCols, 0.0}.GenerateDMatrix(true);
|
||||||
|
auto sampler = std::make_shared<common::ColumnSampler>();
|
||||||
|
|
||||||
|
HistEvaluator<CPUExpandEntry> evalutor{param, Xy->Info(), ctx.Threads(), sampler};
|
||||||
|
evalutor.InitRoot(GradStats{2.0, 2.0});
|
||||||
|
|
||||||
|
SplitEntry split;
|
||||||
|
split.Update(1.0f, 0, 3.0, false, false, GradStats{1.0, 1.0}, GradStats{1.0, 1.0});
|
||||||
|
CPUExpandEntry entry{0, 0, split};
|
||||||
|
RegTree tree;
|
||||||
|
tree.param.UpdateAllowUnknown(Args{{"num_feature", std::to_string(kCols)}});
|
||||||
|
evalutor.ApplyTreeSplit(entry, &tree);
|
||||||
|
|
||||||
|
ASSERT_TRUE(evalutor.Evaluator().has_constraint);
|
||||||
|
}
|
||||||
} // namespace tree
|
} // namespace tree
|
||||||
} // namespace xgboost
|
} // namespace xgboost
|
||||||
|
|||||||
@@ -216,6 +216,7 @@ class TestGPUPredict:
|
|||||||
def test_inplace_predict_cupy(self):
|
def test_inplace_predict_cupy(self):
|
||||||
self.run_inplace_predict_cupy(0)
|
self.run_inplace_predict_cupy(0)
|
||||||
|
|
||||||
|
@pytest.mark.xfail
|
||||||
@pytest.mark.skipif(**tm.no_cupy())
|
@pytest.mark.skipif(**tm.no_cupy())
|
||||||
@pytest.mark.mgpu
|
@pytest.mark.mgpu
|
||||||
def test_inplace_predict_cupy_specified_device(self):
|
def test_inplace_predict_cupy_specified_device(self):
|
||||||
|
|||||||
@@ -215,3 +215,34 @@ class TestGPUUpdaters:
|
|||||||
@pytest.mark.parametrize("weighted", [True, False])
|
@pytest.mark.parametrize("weighted", [True, False])
|
||||||
def test_adaptive(self, weighted) -> None:
|
def test_adaptive(self, weighted) -> None:
|
||||||
self.cputest.run_adaptive("gpu_hist", weighted)
|
self.cputest.run_adaptive("gpu_hist", weighted)
|
||||||
|
|
||||||
|
@pytest.mark.skipif(**tm.no_pandas())
|
||||||
|
def test_issue8824(self):
|
||||||
|
# column sampling by node crashes because shared pointers go out of scope
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
data = pd.DataFrame(np.random.rand(1024, 8))
|
||||||
|
data.columns = "x" + data.columns.astype(str)
|
||||||
|
features = data.columns
|
||||||
|
data["y"] = data.sum(axis=1) < 4
|
||||||
|
dtrain = xgb.DMatrix(data[features], label=data["y"])
|
||||||
|
model = xgb.train(
|
||||||
|
dtrain=dtrain,
|
||||||
|
params={
|
||||||
|
"max_depth": 5,
|
||||||
|
"learning_rate": 0.05,
|
||||||
|
"objective": "binary:logistic",
|
||||||
|
"tree_method": "gpu_hist",
|
||||||
|
"colsample_bytree": 0.5,
|
||||||
|
"colsample_bylevel": 0.5,
|
||||||
|
"colsample_bynode": 0.5, # Causes issues
|
||||||
|
"reg_alpha": 0.05,
|
||||||
|
"reg_lambda": 0.005,
|
||||||
|
"seed": 66,
|
||||||
|
"subsample": 0.5,
|
||||||
|
"gamma": 0.2,
|
||||||
|
"predictor": "auto",
|
||||||
|
"eval_metric": "auc",
|
||||||
|
},
|
||||||
|
num_boost_round=150,
|
||||||
|
)
|
||||||
|
|||||||
@@ -578,7 +578,7 @@ class TestModels:
|
|||||||
y = rng.randn(rows)
|
y = rng.randn(rows)
|
||||||
feature_names = ["test_feature_" + str(i) for i in range(cols)]
|
feature_names = ["test_feature_" + str(i) for i in range(cols)]
|
||||||
X_pd = pd.DataFrame(X, columns=feature_names)
|
X_pd = pd.DataFrame(X, columns=feature_names)
|
||||||
X_pd.iloc[:, 3] = X_pd.iloc[:, 3].astype(np.int32)
|
X_pd[f"test_feature_{3}"] = X_pd.iloc[:, 3].astype(np.int32)
|
||||||
|
|
||||||
Xy = xgb.DMatrix(X_pd, y)
|
Xy = xgb.DMatrix(X_pd, y)
|
||||||
assert Xy.feature_types[3] == "int"
|
assert Xy.feature_types[3] == "int"
|
||||||
|
|||||||
@@ -75,7 +75,10 @@ class TestPandas:
|
|||||||
np.testing.assert_array_equal(result, exp)
|
np.testing.assert_array_equal(result, exp)
|
||||||
dm = xgb.DMatrix(dummies)
|
dm = xgb.DMatrix(dummies)
|
||||||
assert dm.feature_names == ['B', 'A_X', 'A_Y', 'A_Z']
|
assert dm.feature_names == ['B', 'A_X', 'A_Y', 'A_Z']
|
||||||
assert dm.feature_types == ['int', 'int', 'int', 'int']
|
if int(pd.__version__[0]) >= 2:
|
||||||
|
assert dm.feature_types == ['int', 'i', 'i', 'i']
|
||||||
|
else:
|
||||||
|
assert dm.feature_types == ['int', 'int', 'int', 'int']
|
||||||
assert dm.num_row() == 3
|
assert dm.num_row() == 3
|
||||||
assert dm.num_col() == 4
|
assert dm.num_col() == 4
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user