Linux下安装LightGBM-GPU版本

安装依赖

sudo apt-get install --no-install-recommends git cmake build-essential libboost-dev libboost-system-dev libboost-filesystem-dev

安装库

pip install setuptools wheel numpy scipy scikit-learn -U

安装GPU版本的LightGBM

方法一

sudo pip3 install lightgbm --install-option=--gpu --install-option="--opencl-include-dir=/usr/local/cuda/include/" --install-option="--opencl-library=/usr/local/cuda/lib64/libOpenCL.so"
不知道大家怎么样,反正这个方法我一直不行。经过我后期分析,如果上述代码安装失败的化,估计使用sudo pip3 install lightgbm --install-option=--gpu即可。

方法二

git clone --recursive https://github.com/microsoft/LightGBM ; cd LightGBM
mkdir build ; cd build
cmake -DUSE_GPU=1 ..
# if you have installed NVIDIA CUDA to a customized location, you should specify paths to OpenCL headers and library like the following:
# cmake -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda/include/ ..
make -j4

本人使用方法二成功安装。
但是需要注意的是,还需要在你想要的环境里进行这个步骤:

cd ../python-package/
python setup.py install
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章