简体   繁体   中英

How can i solve problem with installing lightgbm gpu on windows 10?

I'm trying to install lightgbm gpu on Windows 10 pro x64. My GPU is NVIDIA Geforce GTX 950.

I tried to follow this guide first: https://lightgbm.readthedocs.io/en/latest/GPU-Windows.html where I used Mingw for compiling. The result was that I could successfully import LightGBM in python, but when I tried to fit the model with parameter device ='gpu' I got error:

LightGBMError: GPU Tree Learner was not enabled in this build.
Please recompile with CMake option -DUSE_GPU=1


Then i followed that guide: https://github.com/Microsoft/LightGBM/blob/master/docs/Installation-Guide.rst#build-gpu-version and after successful compilation with Visual Studio 2019 I can't install gpu version of lightgbm: I always get exactly the same error as here: https://github.com/Microsoft/LightGBM/issues/1121

It doesnt matter whether I type just

pip install lightgbm --install-option=--gpu


or tell the paths to my boost and 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"

I also tried various versions of boost but always get the same error. I would be so thankful if somebody explains to me what is the problem.

The Ultimate Guide to install Lightgbm with GPU support on Python/Anaconda/Windows 8.1/10 x64.

To install Lightgmb with GPU support you need to rebuild from the source code and there is no other way around.

Things you need:

1) Visual Studio 20xx ( xx >=15, Community would do.)

On Windows 8.1: Need to additionally install Windows SDK version 8.1 . It is not included in the standard installation , so you either make a custom installation or, if you already installed it, modify the installation by adding Windows SDK version 8.1.

2) Download and install the Booster files ( version 1_56_0 or later ) in C:/local which is the default folder. You need to change these number in some of the commands to match your own version of the Booster and Visual Studio respectively. Beware .

3) Cmake

4) Git

If installing on Anaconda , activate the right environment before proceeding.

Now to the command line:

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

Now you call CMake GUI and (after you fill Where is the source code and Where to build the binaries fields) you should see something like this:

在此处输入图片说明

If USE_GPU or USE_OPENMP are not checked, you check them before proceed.

Click CONFIGURE and then GENERATE .

Close CMake.

Now you type

cmake --build . --target ALL_BUILD --config Release

At this point, you will find that there is a Release folder in the LightGBM folder. Great.

Then, finally :

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
.......

That's all folks.

As a relative novice I found the "ultimate guide" above good but still hard to follow. Crucially it forgets to mention which version of boost you should download to match your Visual Studio version. This is explained in the LightBGM website as follows:

Note: Match your Visual C++ version:

Visual Studio 2015 -> msvc-14.0-64.exe,

Visual Studio 2017 -> msvc-14.1-64.exe,

Visual Studio 2019 -> msvc-14.2-64.exe.

The lightGBM website also suggest install OpenCL files which is missing from the above instructions but I'm not sure that is necessary.

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