dotnet / dotnet/machinelearning

LightGBM GPU switch (res["device_type"] == "gpu")

Open
#6,666 7 comments 0 reactions 0 assignees View on GitHub
area-Trees needs-further-triage
Dominant language
C#
Stars
9.4k
Forks
2k
Avg merge
2d 20h
Merged PRs (30d)
11

Description

**System Information (please complete the following information):**
daily build

**Feature request**
LightGBM support GPU for the 2nd part of the algorithm. However, the binary for GPU support needs to be built manually ( https://lightgbm.readthedocs.io/en/latest/GPU-Tutorial.html ) and AFAIK it is not distributed officially or unofficial ATM.

GPU support can be easily enabled:
1) compile LightGBM GPU (take note to use same version as Microsoft.ML)
2) update res["device_type"]="gpu" array in *.LightGBM
3) update library dll name in source to use your compiled version, mine is lightgbm_gpu, same file as above

My experience is on Windows platform with 1080Ti and 3090. GPU becomes helpful with huge datasets (10+ GB). In small datasets I did not see as much a big difference due to the 1st part still being CPU bound.

I've seen a few requests here and in modelbuilders repo.

**Discussion and suggestion**
If the device_type switch would be exposed then users could use unmodified Microsoft.ML library with custom GPU binary.

However, because this requires a custom binary (unless it would be included in nuget.org) so putting it together with all other LightGBM parameters could cause confusion with users who expect it to work just by setting it. 2nd, the AutoML pipelines need also some changes.

Do you think it would be reasonable to expose this parameter, and what would be the best way to do it?

After a short while of thinking the best I could come up with is putting it as a static method. For example LightGBMTrainer.SetGPUBinary("lightgbm_gpu.dll"); If user sets this binary, then device_type would also be changed. The change would be global. This interface would also let users know they must provide a custom binary for it to work as they can not call the method without.

Opinions on this?

If there is a good plan I can work on this because I would really prefer to use the daily feed instead of a custom build Microsoft.ML. It is the remaining feature I would need to upgrade to the daily build from our modified 1.x version. However, I am not sure if this is something you would like to include in the library considering the absence of GPU binaries, and if there is a good way to implement it. Any advice appreciated.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.