<commit_before>###################
XGBoost GPU Support
###################

This page contains information about GPU algorithms supported in XGBoost.

.. note:: CUDA 10.0, Compute Capability 3.5 required

  The GPU algorithms in XGBoost require a graphics card with compute capability 3.5 or higher, with
  CUDA toolkits 10.0 or later.
  (See `this list <https://en.wikipedia.org/wiki/CUDA#GPUs_supported>`_ to look up compute capability of your GPU card.)

*********************************************
CUDA Accelerated Tree Construction Algorithms
*********************************************
Tree construction (training) and prediction can be accelerated with CUDA-capable GPUs.

Usage
=====
Specify the ``tree_method`` parameter as one of the following algorithms.

Algorithms
----------

+-----------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tree_method           | Description                                                                                                                                                           |
+=======================+=======================================================================================================================================================================+
| gpu_hist              | Equivalent to the XGBoost fast histogram algorithm. Much faster and uses considerably less memory. NOTE: May run very slowly on GPUs older than Pascal architecture.  |
+-----------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Supported parameters
--------------------

.. |tick| unicode:: U+2714
.. |cross| unicode:: U+2718

+--------------------------------+--------------+
| parameter                      | ``gpu_hist`` |
+================================+==============+
| ``subsample``                  | |tick|       |
+--------------------------------+--------------+
| ``sampling_method``            | |tick|       |
+--------------------------------+--------------+
| ``colsample_bytree``           | |tick|       |
+--------------------------------+--------------+
| ``colsample_bylevel``          | |tick|       |
+--------------------------------+--------------+
| ``max_bin``                    | |tick|       |
+--------------------------------+--------------+
| ``gamma``                      | |tick|       |
+--------------------------------+--------------+
| ``gpu_id``                     | |tick|       |
+--------------------------------+--------------+
| ``predictor``                  | |tick|       |
+--------------------------------+--------------+
| ``grow_policy``                | |tick|       |
+--------------------------------+--------------+
| ``monotone_constraints``       | |tick|       |
+--------------------------------+--------------+
| ``interaction_constraints``    | |tick|       |
+--------------------------------+--------------+
| ``single_precision_histogram`` | |tick|       |
+--------------------------------+--------------+

GPU accelerated prediction is enabled by default for the above mentioned ``tree_method`` parameters but can be switched to CPU prediction by setting ``predictor`` to ``cpu_predictor``. This could be useful if you want to conserve GPU memory. Likewise when using CPU algorithms, GPU accelerated prediction can be enabled by setting ``predictor`` to ``gpu_predictor``.

The experimental parameter ``single_precision_histogram`` can be set to True to enable building histograms using single precision. This may improve speed, in particular on older architectures.

The device ordinal (which GPU to use if you have many of them) can be selected using the
``gpu_id`` parameter, which defaults to 0 (the first device reported by CUDA runtime).


The GPU algorithms currently work with CLI, Python, R, and JVM packages. See :doc:`/install` for details.

.. code-block:: python
  :caption: Python example

  param['gpu_id'] = 0
  param['tree_method'] = 'gpu_hist'

.. code-block:: python
  :caption: With Scikit-Learn interface

  XGBRegressor(tree_method='gpu_hist', gpu_id=0)


GPU-Accelerated SHAP values
=============================
XGBoost makes use of `GPUTreeShap <https://github.com/rapidsai/gputreeshap>`_ as a backend for computing shap values when the GPU predictor is selected.

.. code-block:: python

  model.set_param({"predictor": "gpu_predictor"})
  shap_values = model.predict(dtrain, pred_contribs=True)
  shap_interaction_values = model.predict(dtrain, pred_interactions=True)

See examples `here
<https://github.com/dmlc/xgboost/tree/master/demo/gpu_acceleration>`__.

Multi-node Multi-GPU Training
=============================
XGBoost supports fully distributed GPU training using `Dask <https://dask.org/>`_. For
getting started see our tutorial :doc:`/tutorials/dask` and worked examples `here
<https://github.com/dmlc/xgboost/tree/master/demo/dask>`__, also Python documentation
:ref:`dask_api` for complete reference.


Objective functions
===================
Most of the objective functions implemented in XGBoost can be run on GPU.  Following table shows current support status.

+----------------------+-------------+
| Objectives           | GPU support |
+----------------------+-------------+
| reg:squarederror     | |tick|      |
+----------------------+-------------+
| reg:squaredlogerror  | |tick|      |
+----------------------+-------------+
| reg:logistic         | |tick|      |
+----------------------+-------------+
| reg:pseudohubererror | |tick|      |
+----------------------+-------------+
| binary:logistic      | |tick|      |
+----------------------+-------------+
| binary:logitraw      | |tick|      |
+----------------------+-------------+
| binary:hinge         | |tick|      |
+----------------------+-------------+
| count:poisson        | |tick|      |
+----------------------+-------------+
| reg:gamma            | |tick|      |
+----------------------+-------------+
| reg:tweedie          | |tick|      |
+----------------------+-------------+
| multi:softmax        | |tick|      |
+----------------------+-------------+
| multi:softprob       | |tick|      |
+----------------------+-------------+
| survival:cox         | |cross|     |
+----------------------+-------------+
| survival:aft         | |tick|      |
+----------------------+-------------+
| rank:pairwise        | |tick|      |
+----------------------+-------------+
| rank:ndcg            | |tick|      |
+----------------------+-------------+
| rank:map             | |tick|      |
+----------------------+-------------+

Objective will run on GPU if GPU updater (``gpu_hist``), otherwise they will run on CPU by
default.  For unsupported objectives XGBoost will fall back to using CPU implementation by
default.  Note that when using GPU ranking objective, the result is not deterministic due
to the non-associative aspect of floating point summation.

Metric functions
===================
Following table shows current support status for evaluation metrics on the GPU.

+------------------------------+-------------+
| Metric                       | GPU Support |
+==============================+=============+
| rmse                         | |tick|      |
+------------------------------+-------------+
| rmsle                        | |tick|      |
+------------------------------+-------------+
| mae                          | |tick|      |
+------------------------------+-------------+
| mape                         | |tick|      |
+------------------------------+-------------+
| mphe                         | |tick|      |
+------------------------------+-------------+
| logloss                      | |tick|      |
+------------------------------+-------------+
| error                        | |tick|      |
+------------------------------+-------------+
| merror                       | |tick|      |
+------------------------------+-------------+
| mlogloss                     | |tick|      |
+------------------------------+-------------+
| auc                          | |tick|      |
+------------------------------+-------------+
| aucpr                        | |cross|     |
+------------------------------+-------------+
| ndcg                         | |tick|      |
+------------------------------+-------------+
| map                          | |tick|      |
+------------------------------+-------------+
| poisson-nloglik              | |tick|      |
+------------------------------+-------------+
| gamma-nloglik                | |tick|      |
+------------------------------+-------------+
| cox-nloglik                  | |cross|     |
+------------------------------+-------------+
| aft-nloglik                  | |tick|      |
+------------------------------+-------------+
| interval-regression-accuracy | |tick|      |
+------------------------------+-------------+
| gamma-deviance               | |tick|      |
+------------------------------+-------------+
| tweedie-nloglik              | |tick|      |
+------------------------------+-------------+
<commit_msg>Update GPU doc for PR-AUC. [skip ci] (#7368)<commit_after>###################
XGBoost GPU Support
###################

This page contains information about GPU algorithms supported in XGBoost.

.. note:: CUDA 10.0, Compute Capability 3.5 required

  The GPU algorithms in XGBoost require a graphics card with compute capability 3.5 or higher, with
  CUDA toolkits 10.0 or later.
  (See `this list <https://en.wikipedia.org/wiki/CUDA#GPUs_supported>`_ to look up compute capability of your GPU card.)

*********************************************
CUDA Accelerated Tree Construction Algorithms
*********************************************
Tree construction (training) and prediction can be accelerated with CUDA-capable GPUs.

Usage
=====
Specify the ``tree_method`` parameter as one of the following algorithms.

Algorithms
----------

+-----------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tree_method           | Description                                                                                                                                                           |
+=======================+=======================================================================================================================================================================+
| gpu_hist              | Equivalent to the XGBoost fast histogram algorithm. Much faster and uses considerably less memory. NOTE: May run very slowly on GPUs older than Pascal architecture.  |
+-----------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Supported parameters
--------------------

.. |tick| unicode:: U+2714
.. |cross| unicode:: U+2718

+--------------------------------+--------------+
| parameter                      | ``gpu_hist`` |
+================================+==============+
| ``subsample``                  | |tick|       |
+--------------------------------+--------------+
| ``sampling_method``            | |tick|       |
+--------------------------------+--------------+
| ``colsample_bytree``           | |tick|       |
+--------------------------------+--------------+
| ``colsample_bylevel``          | |tick|       |
+--------------------------------+--------------+
| ``max_bin``                    | |tick|       |
+--------------------------------+--------------+
| ``gamma``                      | |tick|       |
+--------------------------------+--------------+
| ``gpu_id``                     | |tick|       |
+--------------------------------+--------------+
| ``predictor``                  | |tick|       |
+--------------------------------+--------------+
| ``grow_policy``                | |tick|       |
+--------------------------------+--------------+
| ``monotone_constraints``       | |tick|       |
+--------------------------------+--------------+
| ``interaction_constraints``    | |tick|       |
+--------------------------------+--------------+
| ``single_precision_histogram`` | |tick|       |
+--------------------------------+--------------+

GPU accelerated prediction is enabled by default for the above mentioned ``tree_method`` parameters but can be switched to CPU prediction by setting ``predictor`` to ``cpu_predictor``. This could be useful if you want to conserve GPU memory. Likewise when using CPU algorithms, GPU accelerated prediction can be enabled by setting ``predictor`` to ``gpu_predictor``.

The experimental parameter ``single_precision_histogram`` can be set to True to enable building histograms using single precision. This may improve speed, in particular on older architectures.

The device ordinal (which GPU to use if you have many of them) can be selected using the
``gpu_id`` parameter, which defaults to 0 (the first device reported by CUDA runtime).


The GPU algorithms currently work with CLI, Python, R, and JVM packages. See :doc:`/install` for details.

.. code-block:: python
  :caption: Python example

  param['gpu_id'] = 0
  param['tree_method'] = 'gpu_hist'

.. code-block:: python
  :caption: With Scikit-Learn interface

  XGBRegressor(tree_method='gpu_hist', gpu_id=0)


GPU-Accelerated SHAP values
=============================
XGBoost makes use of `GPUTreeShap <https://github.com/rapidsai/gputreeshap>`_ as a backend for computing shap values when the GPU predictor is selected.

.. code-block:: python

  model.set_param({"predictor": "gpu_predictor"})
  shap_values = model.predict(dtrain, pred_contribs=True)
  shap_interaction_values = model.predict(dtrain, pred_interactions=True)

See examples `here
<https://github.com/dmlc/xgboost/tree/master/demo/gpu_acceleration>`__.

Multi-node Multi-GPU Training
=============================
XGBoost supports fully distributed GPU training using `Dask <https://dask.org/>`_. For
getting started see our tutorial :doc:`/tutorials/dask` and worked examples `here
<https://github.com/dmlc/xgboost/tree/master/demo/dask>`__, also Python documentation
:ref:`dask_api` for complete reference.


Objective functions
===================
Most of the objective functions implemented in XGBoost can be run on GPU.  Following table shows current support status.

+----------------------+-------------+
| Objectives           | GPU support |
+----------------------+-------------+
| reg:squarederror     | |tick|      |
+----------------------+-------------+
| reg:squaredlogerror  | |tick|      |
+----------------------+-------------+
| reg:logistic         | |tick|      |
+----------------------+-------------+
| reg:pseudohubererror | |tick|      |
+----------------------+-------------+
| binary:logistic      | |tick|      |
+----------------------+-------------+
| binary:logitraw      | |tick|      |
+----------------------+-------------+
| binary:hinge         | |tick|      |
+----------------------+-------------+
| count:poisson        | |tick|      |
+----------------------+-------------+
| reg:gamma            | |tick|      |
+----------------------+-------------+
| reg:tweedie          | |tick|      |
+----------------------+-------------+
| multi:softmax        | |tick|      |
+----------------------+-------------+
| multi:softprob       | |tick|      |
+----------------------+-------------+
| survival:cox         | |cross|     |
+----------------------+-------------+
| survival:aft         | |tick|      |
+----------------------+-------------+
| rank:pairwise        | |tick|      |
+----------------------+-------------+
| rank:ndcg            | |tick|      |
+----------------------+-------------+
| rank:map             | |tick|      |
+----------------------+-------------+

Objective will run on GPU if GPU updater (``gpu_hist``), otherwise they will run on CPU by
default.  For unsupported objectives XGBoost will fall back to using CPU implementation by
default.  Note that when using GPU ranking objective, the result is not deterministic due
to the non-associative aspect of floating point summation.

Metric functions
===================
Following table shows current support status for evaluation metrics on the GPU.

+------------------------------+-------------+
| Metric                       | GPU Support |
+==============================+=============+
| rmse                         | |tick|      |
+------------------------------+-------------+
| rmsle                        | |tick|      |
+------------------------------+-------------+
| mae                          | |tick|      |
+------------------------------+-------------+
| mape                         | |tick|      |
+------------------------------+-------------+
| mphe                         | |tick|      |
+------------------------------+-------------+
| logloss                      | |tick|      |
+------------------------------+-------------+
| error                        | |tick|      |
+------------------------------+-------------+
| merror                       | |tick|      |
+------------------------------+-------------+
| mlogloss                     | |tick|      |
+------------------------------+-------------+
| auc                          | |tick|      |
+------------------------------+-------------+
| aucpr                        | |tick|      |
+------------------------------+-------------+
| ndcg                         | |tick|      |
+------------------------------+-------------+
| map                          | |tick|      |
+------------------------------+-------------+
| poisson-nloglik              | |tick|      |
+------------------------------+-------------+
| gamma-nloglik                | |tick|      |
+------------------------------+-------------+
| cox-nloglik                  | |cross|     |
+------------------------------+-------------+
| aft-nloglik                  | |tick|      |
+------------------------------+-------------+
| interval-regression-accuracy | |tick|      |
+------------------------------+-------------+
| gamma-deviance               | |tick|      |
+------------------------------+-------------+
| tweedie-nloglik              | |tick|      |
+------------------------------+-------------+

{'fraction_non_alphanumeric': 0.415519196500891, 'fraction_numerical': 0.0024839354176791405, 'mean_word_length': 0.9971961608972285, 'pattern_counts': {'":': 2, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3990067', 'n_tokens_mistral': 3966, 'n_tokens_neox': 3636, 'n_words': 1045}