Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support LightGBM on macOS with real (possibly external) GPU device #4333

Closed
kshv190 opened this issue Jun 1, 2021 · 3 comments
Closed

Support LightGBM on macOS with real (possibly external) GPU device #4333

kshv190 opened this issue Jun 1, 2021 · 3 comments

Comments

@kshv190
Copy link

kshv190 commented Jun 1, 2021

Description

Getting error of invalid kernel on MacBook Pro i9 with AMD Radeon Pro 5500M GPU.
Here is the log

$ ../../lightgbm config=train.conf data=regression.train

[LightGBM] [Warning] data is set=regression.train, data=regression.train will be ignored. Current value: data=regression.train
[LightGBM] [Info] Finished loading parameters
[LightGBM] [Info] Loading initial scores...
[LightGBM] [Info] Construct bin mappers from text data time 0.01 seconds
[LightGBM] [Info] Loading initial scores...
[LightGBM] [Info] Finished loading data in 0.050829 seconds
[LightGBM] [Info] This is the GPU trainer!!
[LightGBM] [Info] Total Bins 6132
[LightGBM] [Info] Number of data points in the train set: 7000, number of used features: 28
[LightGBM] [Info] Using requested OpenCL platform 0 device 2
[LightGBM] [Info] Using GPU Device: AMD Radeon Pro 5500M Compute Engine, Vendor: AMD
[LightGBM] [Info] Compiling OpenCL Kernel with 256 bins...
[LightGBM] [Info] GPU programs have been built
[LightGBM] [Info] Size of histogram bin entry: 8
[LightGBM] [Info] 27 dense feature groups (0.19 MB) transferred to GPU in 0.181396 secs. 1 sparse feature groups
Met Exceptions:
Invalid Kernel

Reproducible example

I am using the regression example in the example folders.
I modified the train.conf file with the following lines:

device = gpu
gpu_platform_id = 0
gpu_device_id = 2

Environment info

Mac book Pro 16 inch 2019.
GPU: AMD Radeon Pro 5500M

LightGBM version or commit hash: 3.2.1.99

Command(s) you used to install LightGBM

git clone --recursive https://github.com/microsoft/LightGBM
cd LightGBM
mkdir build
cd build
export CXX=g++-11 CC=gcc-11
cmake -DUSE_GPU=1 ..
make -j4

Additional Comments

@StrikerRUS
Copy link
Collaborator

LightGBM GPU version is not supported on macOS for now: #1523 (comment). But theoretically it's supposed to be working with a real GPU device (AMD Radeon Pro 5500M in this case): #1523 (comment).

@kshv190
Copy link
Author

kshv190 commented Jun 2, 2021

I built the R package with:
Rscript build_r.R --use-gpu

and it seems to work, please look at the log.

model <- lgb.cv(params = list(objective = "regression", metric = "l2", device='gpu', gpu_platform_id=0, gpu_device_id = 2), data = dtrain)
[LightGBM] [Info] This is the GPU trainer!!
[LightGBM] [Info] Total Bins 412
[LightGBM] [Info] Number of data points in the train set: 18834, number of used features: 9
[LightGBM] [Info] Using requested OpenCL platform 0 device 2
[LightGBM] [Info] Using GPU Device: AMD Radeon Pro 5500M Compute Engine, Vendor: AMD
[LightGBM] [Info] Compiling OpenCL Kernel with 64 bins...
[LightGBM] [Info] GPU programs have been built
[LightGBM] [Info] Size of histogram bin entry: 8
[LightGBM] [Info] 9 dense feature groups (0.22 MB) transferred to GPU in 0.006214 secs. 0 sparse feature groups
[LightGBM] [Info] This is the GPU trainer!!
[LightGBM] [Info] Total Bins 412
[LightGBM] [Info] Number of data points in the train set: 18833, number of used features: 9
[LightGBM] [Info] Using requested OpenCL platform 0 device 2
[LightGBM] [Info] Using GPU Device: AMD Radeon Pro 5500M Compute Engine, Vendor: AMD
[LightGBM] [Info] Compiling OpenCL Kernel with 64 bins...
[LightGBM] [Info] GPU programs have been built
[LightGBM] [Info] Size of histogram bin entry: 8
[LightGBM] [Info] 9 dense feature groups (0.22 MB) transferred to GPU in 0.003041 secs. 0 sparse feature groups
[LightGBM] [Info] This is the GPU trainer!!
[LightGBM] [Info] Total Bins 412
[LightGBM] [Info] Number of data points in the train set: 18833, number of used features: 9
[LightGBM] [Info] Using requested OpenCL platform 0 device 2
[LightGBM] [Info] Using GPU Device: AMD Radeon Pro 5500M Compute Engine, Vendor: AMD
[LightGBM] [Info] Compiling OpenCL Kernel with 64 bins...
[LightGBM] [Info] GPU programs have been built
[LightGBM] [Info] Size of histogram bin entry: 8
[LightGBM] [Info] 9 dense feature groups (0.22 MB) transferred to GPU in 0.003050 secs. 0 sparse feature groups
[LightGBM] [Info] Start training from score -0.000390
[LightGBM] [Info] Start training from score -0.000361
[LightGBM] [Info] Start training from score -0.000363
[1] "[1]: valid's l2:0.000198784+1.9672e-05"

@StrikerRUS StrikerRUS changed the title Kernel Invalid on Mac book Pro AMD GPU Support LightGBM on macOS with real (possibly external) GPU device Jun 9, 2021
@StrikerRUS
Copy link
Collaborator

Closed in favor of being in #2302. We decided to keep all feature requests in one place.

Welcome to contribute this feature! Please re-open this issue (or post a comment if you are not a topic starter) if you are actively working on implementing this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants