简体   繁体   中英

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM