4

CPU Utilization

When I ran best_model = compare_models() there is a huge load on CPU memory, while my GPU is unutilized. How do I run the setup() or compare_models() on GPU? Is there an in-built method in PyCaret?

LITDataScience
  • 380
  • 5
  • 14

2 Answers2

6

Only some models can run on GPU, and they must be properly installed to use GPU. For example, for xgboost, you must install it with pip and have CUDA 10+ installed (or install a GPU xgboost version from anaconda, etc). Here is the list of estimators that can use GPU and their requirements: https://pycaret.readthedocs.io/en/latest/installation.html?highlight=gpu#pycaret-on-gpu

As Yatin said, you need to use use_gpu=True in setup(). Or you can specify it when creating an individual model, like xgboost_gpu = create_model('xgboost', fold=3, tree_method='gpu_hist', gpu_id=0).

For installing CUDA, I like using Anaconda since it makes it easy, like conda install -c anaconda cudatoolkit. It looks like for the non-boosted methods, you need to install cuML for GPU use.

Oh, and looks like pycaret can't use tune-sklearn with GPU (in the warnings here at the bottom of the tune_model doc section).

wordsforthewise
  • 13,746
  • 5
  • 87
  • 117
2

To use gpu in PyCaret you have to simply pas use_gpu=True as parameter in setup function. Example: model = setup(data,target_variable,use_gpu=True)

Yatin Jain
  • 21
  • 1
  • Doesn't work with Kaggle. Tried this already and it is only using the RAM and the CPU, and not the GPU. – LITDataScience Jun 30 '21 at 12:20
  • 1
    @LITDataScience possibly because the models that can use GPU are not compiled for it (e.g. xgboost should be installed with pip and CUDA 10+ needs to be installed). Here is the list and requirements: https://pycaret.readthedocs.io/en/latest/installation.html?highlight=gpu#pycaret-on-gpu – wordsforthewise Aug 29 '21 at 17:04