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

[python-package] Using sparse features with CUDA is currently not supported. #6631

Closed
OrangeAoo opened this issue Aug 30, 2024 · 5 comments
Closed

Comments

@OrangeAoo
Copy link

Description

I got the following warnings when setting device_type='cuda'

 [Warning] Using sparse features with CUDA is currently not supported.
 [Fatal] CUDA Tree Learner was not enabled in this build.
Please recompile with CMake option -DUSE_CUDA=1

Reproducible example

## Train-test split 
# X_train.shape==(18840083, 3), y_train.shape==(18840083,1)
# X_val.shape==(2379462, 3), y_val.shape==(2379462, 1)

## parameters 
params = {
    'learning_rate': 0.01,
    'metric':'mse',
    'max_bin':63,
    'max_depth':15,
    'num_leaves':10000,
    'gpu_use_dp':True,
    'n_estimators':750,
    'tree_type':'data_parallel',
    'device_type':'cuda',
    'n_jobs':-1,
    'verbose':1
}

## Train 
start=time.time()
LGBmodel = lgb.LGBMRegressor(**params)
LGBmodel.fit(X_train,y_train,eval_set=[(X_val,y_val)])  
print(f"Training LGBoost completed in {time.time()-start:.4f} seconds!")
@jameslamb
Copy link
Collaborator

Thanks for using LightGBM.

That warning is expected, but the error means you haven't installed a CUDA-enabled build of LightGBM. To install a CUDA-enabled build of LightGBM, follow the instructions in the docs:

@jameslamb jameslamb changed the title Using sparse features with CUDA is currently not supported. [python-package] Using sparse features with CUDA is currently not supported. Aug 30, 2024
Copy link

This issue has been automatically closed because it has been awaiting a response for too long. When you have time to to work with the maintainers to resolve this issue, please post a new comment and it will be re-opened. If the issue has been locked for editing by the time you return to it, please open a new issue and reference this one. Thank you for taking the time to improve LightGBM!

@Zaffer
Copy link

Zaffer commented Dec 17, 2024

using pip install lightgbm --config-settings=cmake.define.USE_CUDA=ON does not fix this issue. It simply returns the same error. I tried purging the pip cache and using -no-cache-dir, but still does nothing.

@jameslamb
Copy link
Collaborator

@Zaffer if you can provide the complete logs from running that command, we can help you. I strongly suspect there's an error in those logs somewhere, or maybe a warning where pip is refusing to update your already-installed lightgbm.

@StrikerRUS
Copy link
Collaborator

@Zaffer Could you please try the following command?

pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.USE_CUDA=ON

I guess instructions in the README document are incorrect. Without --no-binary flag pip doesn't try to build from sources but simply installs precompiled wheel file regardless specified --config-settings flags.

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

4 participants