LightGBM can work faster in GPU. In PyCaret, I’m passing parameter use_gpu=True
in TSForecastingExperiment() and got errors:
[LightGBM] [Fatal] GPU Tree Learner was not enabled in this build.
Please recompile with CMake option -DUSE_GPU=1
[LightGBM] [Fatal] GPU Tree Learner was not enabled in this build.
Please recompile with CMake option -DUSE_GPU=1
[LightGBM] [Fatal] GPU Tree Learner was not enabled in this build.
Please recompile with CMake option -DUSE_GPU=1
To enable this, we need to uninstall the current LightGBM and re-install the LightGBM with GPU. For Linux Ubuntu, its better to install pre-requisite packages
sudo apt install cmake build-essential libboost-all-dev
Make sure you already have Nvidia Toolkit installed
sudo apt install nvidia-cuda-toolkit
The first option, is installation inside conda environment
pip uninstall lightgbm -y
conda install -c conda-forge gcc=12.1.0
pip install lightgbm --config-settings=cmake.define.USE_GPU=ON --config-settings=cmake.define.OpenCL_INCLUDE_DIR="/usr/local/cuda/include/" --config-settings=cmake.define.OpenCL_LIBRARY="/usr/local/cuda/lib64/libOpenCL.so"
Second options, installation without environment
# Get LightGBM source.
git clone --recursive https://github.com/Microsoft/LightGBM.git
cd LightGBM/python-package/
# cmake specifying locations of OpenCL files.
sudo cmake -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda-8.0/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda-8.0/include/ ..
# Compile.
sudo make
# Install for Python, using what we just compiled.
python setup.py install --precompile