{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Using rmm on a single node device\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import rmm\nfrom sklearn.datasets import make_classification\n\nimport xgboost as xgb\n\n# Initialize RMM pool allocator\nrmm.reinitialize(pool_allocator=True)\n# Optionally force XGBoost to use RMM for all GPU memory allocation, see ./README.md\n# xgb.set_config(use_rmm=True)\n\nX, y = make_classification(n_samples=10000, n_informative=5, n_classes=3)\ndtrain = xgb.DMatrix(X, label=y)\n\nparams = {\n    \"max_depth\": 8,\n    \"eta\": 0.01,\n    \"objective\": \"multi:softprob\",\n    \"num_class\": 3,\n    \"tree_method\": \"hist\",\n    \"device\": \"cuda\",\n}\n# XGBoost will automatically use the RMM pool allocator\nbst = xgb.train(params, dtrain, num_boost_round=100, evals=[(dtrain, \"train\")])"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.10.17"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}