{
  "id": 475947,
  "title": "GPU low utilization while training LGBM with device = \"gpu\"",
  "url": "/competitions/home-credit-credit-risk-model-stability/discussion/475947",
  "author_name": "",
  "post_date": "2024-02-10T14:44:06.379895500Z",
  "votes": 8,
  "comment_count": 7,
  "views": 0,
  "content": "<p>This is often the picture that I see:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F494641%2F81207b4bcb6f2949804091a4fed6a235%2Fgpu_low.png?generation=1707576020679909&amp;alt=media\"></p>\n<p>Sometimes GPU utilization jumps to 7% at maximum.</p>\n<p>These are the parameters I use:</p>\n<pre><code> = {\n    : ,\n    : ,\n    : ,\n    : ,\n    : ,\n    : ,\n    : , \n    : ,\n    : ,\n    : ,\n    : \n}\n</code></pre>\n<p>It seems to me it does not utilize GPU. Do you experience something similar?</p>",
  "messages": [
    {
      "id": "2645915",
      "postDate": "02/10/2024 14:44:06",
      "content": "<p>This is often the picture that I see:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F494641%2F81207b4bcb6f2949804091a4fed6a235%2Fgpu_low.png?generation=1707576020679909&amp;alt=media\"></p>\n<p>Sometimes GPU utilization jumps to 7% at maximum.</p>\n<p>These are the parameters I use:</p>\n<pre><code> = {\n    : ,\n    : ,\n    : ,\n    : ,\n    : ,\n    : ,\n    : , \n    : ,\n    : ,\n    : ,\n    : \n}\n</code></pre>\n<p>It seems to me it does not utilize GPU. Do you experience something similar?</p>",
      "rawMarkdown": "This is often the picture that I see:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F494641%2F81207b4bcb6f2949804091a4fed6a235%2Fgpu_low.png?generation=1707576020679909&alt=media)\n\nSometimes GPU utilization jumps to 7% at maximum.\n\nThese are the parameters I use:\n```\nparams = {\n    \"boosting_type\": \"gbdt\",\n    \"objective\": \"binary\",\n    \"metric\": \"auc\",\n    \"max_depth\": 8,\n    \"learning_rate\": 0.1,\n    \"n_estimators\": 100,\n    \"colsample_bytree\": 0.8, \n    \"colsample_bynode\": 0.8,\n    \"verbose\": -1,\n    \"random_state\": 42,\n    \"device\": 'gpu'\n}\n```\n\nIt seems to me it does not utilize GPU. Do you experience something similar?",
      "votes": null
    },
    {
      "id": "2645938",
      "postDate": "02/10/2024 14:56:44",
      "content": "<p>yup, same here</p>",
      "rawMarkdown": "yup, same here",
      "votes": null
    },
    {
      "id": "2646072",
      "postDate": "02/10/2024 16:15:44",
      "content": "<p>For the LGB GPU model, you need to reduce the <code>num_threads</code>, from my experience, use 2 threads fewer than all of your available threads.</p>\n<p>If you need more speed up (lower performance), you can change <code>max_bin</code> and <code>gpu_use_dp</code>.</p>\n<p><a href=\"https://lightgbm.readthedocs.io/en/latest/GPU-Performance.html\" target=\"_blank\">https://lightgbm.readthedocs.io/en/latest/GPU-Performance.html</a></p>",
      "rawMarkdown": "For the LGB GPU model, you need to reduce the `num_threads`, from my experience, use 2 threads fewer than all of your available threads.\n\nIf you need more speed up (lower performance), you can change `max_bin` and `gpu_use_dp`.\n\nhttps://lightgbm.readthedocs.io/en/latest/GPU-Performance.html",
      "votes": null
    },
    {
      "id": "2646400",
      "postDate": "02/10/2024 21:26:38",
      "content": "<p>Thanks, I will try it</p>",
      "rawMarkdown": "Thanks, I will try it",
      "votes": null
    },
    {
      "id": "2648890",
      "postDate": "02/12/2024 13:34:58",
      "content": "<p>I did try it, however it did not change almost anything in my case.</p>",
      "rawMarkdown": "I did try it, however it did not change almost anything in my case.",
      "votes": null
    },
    {
      "id": "2648933",
      "postDate": "02/12/2024 14:01:50",
      "content": "<p>maybe you can also try using the actual number cores instead of threads.</p>\n<p>From the link above:</p>\n<pre><code>During on CPU we used only  physical cores of the CPU, not use hyper-threading cores, we found that using too many threads actually makes performance worse\n</code></pre>\n<p>For example, most CPUs nowadays have 2 threads per core, for a 2 core 4 thread machine, use num_threads=2.</p>\n<p>I haven't tried this on Kaggle, but this has been my experience with my local machine.</p>",
      "rawMarkdown": "maybe you can also try using the actual number cores instead of threads.\n\nFrom the link above:\n```\nDuring benchmarking on CPU we used only 28 physical cores of the CPU, and did not use hyper-threading cores, because we found that using too many threads actually makes performance worse\n```\nFor example, most CPUs nowadays have 2 threads per core, for a 2 core 4 thread machine, use num_threads=2.\n\nI haven't tried this on Kaggle, but this has been my experience with my local machine.",
      "votes": null
    },
    {
      "id": "2749236",
      "postDate": "04/12/2024 23:43:12",
      "content": "<p>Did you find any explanation or solution for this?</p>",
      "rawMarkdown": "Did you find any explanation or solution for this?",
      "votes": null
    },
    {
      "id": "2749472",
      "postDate": "04/13/2024 04:33:37",
      "content": "<p>Unfortunately not</p>",
      "rawMarkdown": "Unfortunately not",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2645938,
      "author_name": "ags299",
      "author_url": "",
      "post_date": "02/10/2024 14:56:44",
      "content": "<p>yup, same here</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 2646072,
      "author_name": "kingychiu",
      "author_url": "",
      "post_date": "02/10/2024 16:15:44",
      "content": "<p>For the LGB GPU model, you need to reduce the <code>num_threads</code>, from my experience, use 2 threads fewer than all of your available threads.</p>\n<p>If you need more speed up (lower performance), you can change <code>max_bin</code> and <code>gpu_use_dp</code>.</p>\n<p><a href=\"https://lightgbm.readthedocs.io/en/latest/GPU-Performance.html\" target=\"_blank\">https://lightgbm.readthedocs.io/en/latest/GPU-Performance.html</a></p>",
      "votes": null,
      "replies": [
        {
          "id": 2646400,
          "author_name": "narsil",
          "author_url": "",
          "post_date": "02/10/2024 21:26:38",
          "content": "<p>Thanks, I will try it</p>",
          "votes": null,
          "replies": [
            {
              "id": 2648890,
              "author_name": "narsil",
              "author_url": "",
              "post_date": "02/12/2024 13:34:58",
              "content": "<p>I did try it, however it did not change almost anything in my case.</p>",
              "votes": null,
              "replies": [
                {
                  "id": 2648933,
                  "author_name": "kingychiu",
                  "author_url": "",
                  "post_date": "02/12/2024 14:01:50",
                  "content": "<p>maybe you can also try using the actual number cores instead of threads.</p>\n<p>From the link above:</p>\n<pre><code>During on CPU we used only  physical cores of the CPU, not use hyper-threading cores, we found that using too many threads actually makes performance worse\n</code></pre>\n<p>For example, most CPUs nowadays have 2 threads per core, for a 2 core 4 thread machine, use num_threads=2.</p>\n<p>I haven't tried this on Kaggle, but this has been my experience with my local machine.</p>",
                  "votes": null,
                  "replies": []
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "id": 2749236,
      "author_name": "manuelandersen",
      "author_url": "",
      "post_date": "04/12/2024 23:43:12",
      "content": "<p>Did you find any explanation or solution for this?</p>",
      "votes": null,
      "replies": [
        {
          "id": 2749472,
          "author_name": "narsil",
          "author_url": "",
          "post_date": "04/13/2024 04:33:37",
          "content": "<p>Unfortunately not</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2645915": "This is often the picture that I see:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F494641%2F81207b4bcb6f2949804091a4fed6a235%2Fgpu_low.png?generation=1707576020679909&alt=media)\n\nSometimes GPU utilization jumps to 7% at maximum.\n\nThese are the parameters I use:\n```\nparams = {\n    \"boosting_type\": \"gbdt\",\n    \"objective\": \"binary\",\n    \"metric\": \"auc\",\n    \"max_depth\": 8,\n    \"learning_rate\": 0.1,\n    \"n_estimators\": 100,\n    \"colsample_bytree\": 0.8, \n    \"colsample_bynode\": 0.8,\n    \"verbose\": -1,\n    \"random_state\": 42,\n    \"device\": 'gpu'\n}\n```\n\nIt seems to me it does not utilize GPU. Do you experience something similar?",
    "2645938": "yup, same here",
    "2646072": "For the LGB GPU model, you need to reduce the `num_threads`, from my experience, use 2 threads fewer than all of your available threads.\n\nIf you need more speed up (lower performance), you can change `max_bin` and `gpu_use_dp`.\n\nhttps://lightgbm.readthedocs.io/en/latest/GPU-Performance.html",
    "2646400": "Thanks, I will try it",
    "2648890": "I did try it, however it did not change almost anything in my case.",
    "2648933": "maybe you can also try using the actual number cores instead of threads.\n\nFrom the link above:\n```\nDuring benchmarking on CPU we used only 28 physical cores of the CPU, and did not use hyper-threading cores, because we found that using too many threads actually makes performance worse\n```\nFor example, most CPUs nowadays have 2 threads per core, for a 2 core 4 thread machine, use num_threads=2.\n\nI haven't tried this on Kaggle, but this has been my experience with my local machine.",
    "2749236": "Did you find any explanation or solution for this?",
    "2749472": "Unfortunately not"
  },
  "source": "meta"
}