Skip to content
Advertisement

Get LightGBM/ LGBM run with GPU on Google Colabratory

I often run LGBM on Google Colabratory and I just found out this page saying that LGBM it set to CPU by default so you need to set up first. https://medium.com/@am.sharma/lgbm-on-colab-with-gpu-c1c09e83f2af So I executed the code recommended on the page or some other codes recommended on stackoverflow as follows, !git clone --recursive https://github.com/Microsoft/LightGBM %cd LightGBM !mkdir build %cd build !cmake ../../LightGBM !make -j4 !git clone --recursive https://github.com/Microsoft/LightGBM.git %cd LightGBM/python-package !python3 setup.py install --gpu !pip install cmake

But I still get an Error GPU Tree Learner was not enabled in this build.Please recompile with CMake option -DUSE_GPU=1

How can I fix it? Thank you!

Advertisement

Answer

After running

! git clone --recursive https://github.com/Microsoft/LightGBM

You can run this oneliner which will build and compile LightGBM with GPU enabled in colab:

! cd LightGBM && rm -rf build && mkdir build && cd build && cmake -DUSE_GPU=1 ../../LightGBM && make -j4 && cd ../python-package && python3 setup.py install --precompile --gpu;

Hope that helps ;D

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement