rapidsai / cuml

cuML - RAPIDS Machine Learning Library
https://docs.rapids.ai/api/cuml/stable/
Apache License 2.0
4.23k stars 532 forks source link

[BUG] Always bad_alloc: out_of_memory when fit large numpy array. #5291

Closed zhaoyewei closed 1 year ago

zhaoyewei commented 1 year ago

Describe the bug I have a big numpy array with shape about (500*10000, 400) to fit, the random forest, Linear Regression and xgboost are all work well. But when using: SVR, Logistic Regression, Elasticnet, there is always MemoryError: std::bad_alloc: out_of_memory: CUDA error at: conda/envs/dl/include/rmm/mr/device/cuda_memory_resource.hpp.

Steps/Code to reproduce bug Generate a larget Numpy array X=(500*10000,500), Y=(500*10000), and generate a model: ' model = cuml.ElasticNet(alpha=1.0,l1_ratio=0.5,max_iter=1000,tol=1e-3,solver='cd',selection="random",verbose=4) ' , we will reproduct the bug.

Expected behavior The fit function can work well as sklearn does.

Environment details (please complete the following information):

beckernick commented 1 year ago

The RTX 3090 has 24GB of memory. Your X array would be about 20GB with float32 data and 10 GB with float32 data. Different algorithms may require different amounts of intermediate (or output) memory, some of which will overwhelm your GPU.

We're working on supporting sparse inputs in SVMs, which may be useful in the future if your data is sparse.

You may want to use a larger GPU if you'd like to use SVR or other algorithms that require more memory than you have available (or train on a smaller sample your data). cuML also supports a variety of multi-GPU algorithms and XGBoost supports multi-GPU training, too.

I'm going to close this issue as answered, but please feel free to reopen to continue the discussion.