如何解决在 Windows 10 上安装 lightgbm gpu 的问题?

Ант*_*кий 2 python boost gpu cmake lightgbm

我正在尝试在 Windows 10 pro x64 上安装 lightgbm gpu。我的 GPU 是 NVIDIA Geforce GTX 950。

我首先尝试遵循本指南:https : //lightgbm.readthedocs.io/en/latest/GPU-Windows.html,我使用 Mingw 进行编译。结果是我可以在python中成功导入LightGBM,但是当我尝试使用参数device='gpu'拟合模型时出现错误:

LightGBMError: GPU Tree Learner was not enabled in this build.
Please recompile with CMake option -DUSE_GPU=1
Run Code Online (Sandbox Code Playgroud)


然后我遵循了该指南:https : //github.com/Microsoft/LightGBM/blob/master/docs/Installation-Guide.rst#build-gpu-version 并且在使用 Visual Studio 2019 成功编译后我无法安装 gpu 版本lightgbm 的:我总是得到与这里完全相同的错误:https : //github.com/Microsoft/LightGBM/issues/1121

我是否只输入并不重要

pip install lightgbm --install-option=--gpu
Run Code Online (Sandbox Code Playgroud)


或者告诉我的 boost 和 cuda 的路径

pip install lightgbm --install-option=--gpu --install-option="--opencl- 
include-dir=C:/Program Files/NVIDIA GPU Computing 
Toolkit/CUDA/v10.1/include" --install-option="--opencl-library=C:/Program 
Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/lib/x64/OpenCL.lib" -- 
install-option="--boost-librarydir= C:/local/boost_1_69_0/lib64-msvc-14.1" 
--install-option="--boost-root= C:/local/boost_1_69_0"
Run Code Online (Sandbox Code Playgroud)

我也尝试了各种版本的 boost 但总是得到同样的错误。如果有人向我解释问题出在哪里,我将非常感激。

小智 5

在 Python/Anaconda/Windows 8.1/10 x64 上安装支持 GPU 的 Lightgbm 的终极指南。

要安装支持 GPU 的 Lightgmb,您需要从源代码重建,没有其他办法。

你需要的东西:

1) Visual Studio 20xxxx >=15,社区可以。)

在 Windows 8.1 上:需要另外安装Windows SDK 版本 8.1它不包含在标准安装中,因此您可以进行自定义安装,或者,如果您已经安装了它,请通过添加 Windows SDK 版本 8.1 来修改安装。

2)下载并安装Booster文件(版本 1_56_0 或更高版本),C:/local这是默认文件夹。您需要在某些命令中更改这些数字以分别匹配您自己的BoosterVisual Studio版本。当心

3)制作

4)吉特

如果在Anaconda 上安装,请在继续之前激活正确的环境

现在到命令行:

git clone --recursive https://github.com/microsoft/LightGBM   
cd LightGBM
mkdir build
cd build
cmake -A x64 -DUSE_GPU=1 -DBOOST_ROOT= -DBOOST_LIBRARYDIR=C:/local/boost_1_71_0/lib64-msvc-14.0 .. 

-- Building for: Visual Studio 14 2015
-- Selecting Windows SDK version  to target Windows 10.0.18362.
-- The C compiler identification is MSVC 19.0.24215.1
   ...................
   ...................
-- Build files have been written to: J:/LightGBM/build
Run Code Online (Sandbox Code Playgroud)

现在您调用CMake GUI并且(在您填写源代码构建二进制文件的位置之后)您应该看到如下内容:

在此处输入图片说明

如果未选中USE_GPUUSE_OPENMP,请在继续之前检查它们。

单击CONFIGURE,然后单击GENERATE

关闭 CMake。

现在你输入

cmake --build . --target ALL_BUILD --config Release
Run Code Online (Sandbox Code Playgroud)

此时,你会发现LightGBM文件夹中有一个Release文件夹。伟大的。

然后,最后

cd ..\python-package
python setup.py install --gpu

running install
INFO:LightGBM:Starting to compile the library.
INFO:LightGBM:Starting to compile with Visual Studio 16 2019.
INFO:LightGBM:Starting to compile with Visual Studio 15 2017.
INFO:LightGBM:Starting to compile with Visual Studio 14 2015.
running build
running build_py
creating build
creating build\lib
creating build\lib\lightgbm
.......
Run Code Online (Sandbox Code Playgroud)

这就是所有的人。