microsoft / LightGBM

A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.
https://lightgbm.readthedocs.io/en/latest/
MIT License
16.35k stars 3.8k forks source link

[python-package] [gpu] GPU install on Windows fails #6510

Closed CWJ666 closed 6 days ago

CWJ666 commented 6 days ago

Description

I used https://lightgbm.readthedocs.io/en/stable/GPU-Windows.html to install the GPU version of LightGBM for Python on Windows 10 PC. But on the final step https://lightgbm.readthedocs.io/en/stable/GPU-Windows.htmllightgbm-compilation-cli-final-step, I successfully compiled the CPU version; however, the compilation of the GPU version failed,I have already tried the methods from issue #1206,, but they failed.

Additional Comments

I have been trying to figure out this issue for a week. I've tried changing the CMake version, switching the MinGW version, modifying the Boost environment variables, and adding the Boost path to the CMakeLists.txt file. I've tried at least 20 times, but I really don't know where the problem is. Since 2020, I have tried many times but have never succeeded on my computer. I don't want to give up, please help me. Thank you very much.

Environment info

My GPU is NVIDIA GeForce RTX 3080Ti. I have already installed:

Visual Studio Community 2017(including C++), 2019 (including C++,I selected 'Desktop development with C++' and then clicked all the components in the installation details。) CUDA 11.2 CMake 3.30.0 rc4(win64-x64) mingw-w64 (x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z) Git 2.37.3 Boost 1.63.0

my computer environment path is :

Path=D:\ProgramData\Anaconda3;D:\ProgramData\Anaconda3\Library\mingw-w64\bin;D:\ProgramData\Anaconda3\Library\usr\bin;D:\ProgramData\Anaconda3\Library\bin;D:\ProgramData\Anaconda3\Scripts;D:\ProgramData\Anaconda3\bin;D:\ProgramData\Anaconda3\condabin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\libnvvp;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\Common Files\microsoft shared\TigerKin;D:\Program Files\Bandizip;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;d:\ProgramData\cudnn_cuda11.6-archive\bin;C:\Program Files\NVIDIA Corporation\Nsight Compute 2020.3.0;D:\ProgramData\MongoDB\Server\5.0\bin;C:\Program Files (x86)\Microsoft Visual Studio;d:\Program Files\Git\cmd;C:\Program Files\dotnet;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\Microsoft Office\root\Office16\ODBC Drivers\Salesforce\lib\OpenSSL64.DllA;d:\ProgramData\MinGW\bin;D:\Program Files\CMake;D:\Program Files\CMake\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\include;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\lib;C:\Users\NINGMEI\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Tencent\QQGameTempest\Hall.57702;D:\Program Files\Microsoft Visual Studio\Microsoft VS Code\bin
BOOST_INCLUDE_DIR=D:\ProgramData\boost\boost-build\include
BOOST_LIBRARY_DIR=D:\ProgramData\boost\boost-build\lib
BOOST_ROOT=D:\ProgramData\boost\boost-build
OpenCL_INCLUDE_DIR=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\include
OpenCL_LIBRARY=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\lib
CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2
NVCUDASAMPLES11_2_ROOT=C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.2
NVCUDASAMPLES_ROOT=C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.2
NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt\

ChocolateyInstall=C:\ProgramData\chocolatey
ChocolateyLastPathUpdate=133425919662478080
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=CHEN
ComSpec=C:\Windows\system32\cmd.exe
CONDA_DEFAULT_ENV=base
CONDA_EXE=D:\ProgramData\Anaconda3\Scripts\conda.exe
CONDA_PREFIX=D:\ProgramData\Anaconda3
CONDA_PROMPT_MODIFIER=(base)
CONDA_PYTHON_EXE=D:\ProgramData\Anaconda3\python.exe
CONDA_SHLVL=1
DriverData=C:\Windows\System32\Drivers\DriverData
HOMEDRIVE=C:
HOMEPATH=\Users\NINGMEI
LOCALAPPDATA=C:\Users\NINGMEI\AppData\Local
LOGONSERVER=\\CHEN
NUMBER_OF_PROCESSORS=24
OneDrive=C:\Users\NINGMEI\OneDrive
OS=Windows_NT
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 151 Stepping 2, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=9702
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=(base) $P$G
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=C:\Users\Public
RlsSvcPort=22112
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\NINGMEI\AppData\Local\Temp
TigerKin=C:\Program Files (x86)\Common Files\microsoft shared\TigerKin
TMP=C:\Users\NINGMEI\AppData\Local\Temp
USERDOMAIN=CHEN
USERDOMAIN_ROAMINGPROFILE=CHEN
USERNAME=Chen
USERPROFILE=C:\Users\NINGMEI
VS140COMNTOOLS=d:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
windir=C:\Windows
WSLENV=WT_SESSION:WT_PROFILE_ID:
WT_PROFILE_ID={f3ebf207-5a62-4cf4-90ad-a53ada6d9048}
WT_SESSION=e7c0f816-90c1-443a-9e6a-08059ee702ef
ZES_ENABLE_SYSMAN=1
ACSvcPort=17532
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\NINGMEI\AppData\Roaming

LightGBM version or commit hash:

4.4.0.99

Command(s) you used to install LightGBM

CPU Version


Chen@chen MINGW64 /d/work/Lightgbm/build (master)
$ alias make='mingw32-make'
Chen@chen MINGW64 /d/work/Lightgbm/build (master)
$ make
...
[ 97%] Built target lightgbm_capi_objs
[100%] Linking CXX shared library D:\work\LightGBM\lib_lightgbm.dll
[100%] Built target _lightgbm
>GPU Version
```shell
Chen@chen MINGW64 /d/work/Lightgbm/build (master)
$ make
[  2%] Building CXX object CMakeFiles/lightgbm_objs.dir/src/boosting/boosting.cpp.obj
[  5%] Building CXX object CMakeFiles/lightgbm_objs.dir/src/boosting/gbdt.cpp.obj
[  7%] Building CXX object CMakeFiles/lightgbm_objs.dir/src/boosting/gbdt_model_text.cpp.obj
...
[ 69%] Building CXX object CMakeFiles/lightgbm_objs.dir/src/treelearner/feature_parallel_tree_learner.cpp.obj
[ 71%] Building CXX object CMakeFiles/lightgbm_objs.dir/src/treelearner/gpu_tree_learner.cpp.obj
[ 74%] Building CXX object CMakeFiles/lightgbm_objs.dir/src/treelearner/gradient_discretizer.cpp.obj
[ 76%] Building CXX object CMakeFiles/lightgbm_objs.dir/src/treelearner/linear_tree_learner.cpp.obj
[ 79%] Building CXX object CMakeFiles/lightgbm_objs.dir/src/treelearner/serial_tree_learner.cpp.obj
[ 82%] Building CXX object CMakeFiles/lightgbm_objs.dir/src/treelearner/tree_learner.cpp.obj
[ 84%] Building CXX object CMakeFiles/lightgbm_objs.dir/src/treelearner/voting_parallel_tree_learner.cpp.obj
[ 87%] Building CXX object CMakeFiles/lightgbm_objs.dir/src/utils/openmp_wrapper.cpp.obj
[ 87%] Built target lightgbm_objs
[ 89%] Building CXX object CMakeFiles/lightgbm.dir/src/main.cpp.obj
[ 92%] Building CXX object CMakeFiles/lightgbm.dir/src/application/application.cpp.obj
[ 94%] Linking CXX executable D:\work\LightGBM\lightgbm.exe
CMakeFiles\lightgbm.dir/objects.a(data_parallel_tree_learner.cpp.obj):data_parallel_tree_learner.cpp:(.text.startup+0x1d): undefined reference to `boost::system::generic_category()'
CMakeFiles\lightgbm.dir/objects.a(data_parallel_tree_learner.cpp.obj):data_parallel_tree_learner.cpp:(.text.startup+0x22): undefined reference to `boost::system::generic_category()'
CMakeFiles\lightgbm.dir/objects.a(data_parallel_tree_learner.cpp.obj):data_parallel_tree_learner.cpp:(.text.startup+0x27): undefined reference to `boost::system::system_category()'
CMakeFiles\lightgbm.dir/objects.a(feature_parallel_tree_learner.cpp.obj):feature_parallel_tree_learner.cpp:(.text.startup+0x1d): undefined reference to `boost::system::generic_category()'
CMakeFiles\lightgbm.dir/objects.a(feature_parallel_tree_learner.cpp.obj):feature_parallel_tree_learner.cpp:(.text.startup+0x22): undefined reference to `boost::system::generic_category()'
CMakeFiles\lightgbm.dir/objects.a(feature_parallel_tree_learner.cpp.obj):feature_parallel_tree_learner.cpp:(.text.startup+0x27): undefined reference to `boost::system::system_category()'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text+0x382a): undefined reference to `boost::filesystem::path::make_preferred()'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text+0x389b): undefined reference to `boost::filesystem::path::codecvt()'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text+0x38ac): undefined reference to `boost::filesystem::path_traits::convert(char const*, char const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, int> const&)'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text+0x38bd): undefined reference to `boost::filesystem::path::codecvt()'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text+0x38d2): undefined reference to `boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::codecvt<wchar_t, char, int> const&)'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text$_ZN5boost7compute6detail19program_binary_pathERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb[_ZN5boost7compute6detail19program_binary_pathERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb]+0x221): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text$_ZN5boost7compute6detail19program_binary_pathERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb[_ZN5boost7compute6detail19program_binary_pathERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb]+0x291): undefined reference to `boost::filesystem::detail::create_directories(boost::filesystem::path const&, boost::system::error_code*)'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text$_ZN5boost7compute6detail19program_binary_pathERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb[_ZN5boost7compute6detail19program_binary_pathERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb]+0x2be): undefined reference to `boost::filesystem::path::codecvt()'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text$_ZN5boost7compute6detail19program_binary_pathERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb[_ZN5boost7compute6detail19program_binary_pathERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb]+0x2cf): undefined reference to `boost::filesystem::path_traits::convert(char const*, char const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, int> const&)'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text$_ZN5boost7compute6detail19program_binary_pathERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb[_ZN5boost7compute6detail19program_binary_pathERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb]+0x2ea): undefined reference to `boost::filesystem::path::codecvt()'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text$_ZN5boost7compute6detail19program_binary_pathERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb[_ZN5boost7compute6detail19program_binary_pathERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb]+0x2fb): undefined reference to `boost::filesystem::path_traits::convert(char const*, char const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, int> const&)'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text$_ZNK5boost7compute6detail15parameter_cache14make_file_nameB5cxx11Ev[_ZNK5boost7compute6detail15parameter_cache14make_file_nameB5cxx11Ev]+0x87e): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text$_ZNK5boost7compute6detail15parameter_cache14make_file_nameB5cxx11Ev[_ZNK5boost7compute6detail15parameter_cache14make_file_nameB5cxx11Ev]+0xbf6): undefined reference to `boost::filesystem::detail::create_directories(boost::filesystem::path const&, boost::system::error_code*)'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text$_ZNK5boost7compute6detail15parameter_cache14make_file_nameB5cxx11Ev[_ZNK5boost7compute6detail15parameter_cache14make_file_nameB5cxx11Ev]+0xc2c): undefined reference to `boost::filesystem::path::codecvt()'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text$_ZNK5boost7compute6detail15parameter_cache14make_file_nameB5cxx11Ev[_ZNK5boost7compute6detail15parameter_cache14make_file_nameB5cxx11Ev]+0xc3f): undefined reference to `boost::filesystem::path_traits::convert(char const*, char const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, int> const&)'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text$_ZNK5boost7compute6detail15parameter_cache14make_file_nameB5cxx11Ev[_ZNK5boost7compute6detail15parameter_cache14make_file_nameB5cxx11Ev]+0xc62): undefined reference to `boost::filesystem::path::codecvt()'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text$_ZNK5boost7compute6detail15parameter_cache14make_file_nameB5cxx11Ev[_ZNK5boost7compute6detail15parameter_cache14make_file_nameB5cxx11Ev]+0xc73): undefined reference to `boost::filesystem::path_traits::convert(char const*, char const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, int> const&)'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text$_ZN5boost11make_sharedINS_7compute6detail15parameter_cacheEJRKNS1_6deviceEEEENS_6detail15sp_if_not_arrayIT_E4typeEDpOT0_[_ZN5boost11make_sharedINS_7compute6detail15parameter_cacheEJRKNS1_6deviceEEEENS_6detail15sp_if_not_arrayIT_E4typeEDpOT0_]+0x12c): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text$_ZN5boost11make_sharedINS_7compute6detail15parameter_cacheEJRKNS1_6deviceEEEENS_6detail15sp_if_not_arrayIT_E4typeEDpOT0_[_ZN5boost11make_sharedINS_7compute6detail15parameter_cacheEJRKNS1_6deviceEEEENS_6detail15sp_if_not_arrayIT_E4typeEDpOT0_]+0x189): undefined reference to `boost::filesystem::path::codecvt()'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text$_ZN5boost11make_sharedINS_7compute6detail15parameter_cacheEJRKNS1_6deviceEEEENS_6detail15sp_if_not_arrayIT_E4typeEDpOT0_[_ZN5boost11make_sharedINS_7compute6detail15parameter_cacheEJRKNS1_6deviceEEEENS_6detail15sp_if_not_arrayIT_E4typeEDpOT0_]+0x19a): undefined reference to `boost::filesystem::path_traits::convert(char const*, char const*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, int> const&)'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text.startup+0x1d): undefined reference to `boost::system::generic_category()'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text.startup+0x22): undefined reference to `boost::system::generic_category()'
CMakeFiles\lightgbm.dir/objects.a(gpu_tree_learner.cpp.obj):gpu_tree_learner.cpp:(.text.startup+0x27): undefined reference to `boost::system::system_category()'
CMakeFiles\lightgbm.dir/objects.a(tree_learner.cpp.obj):tree_learner.cpp:(.text.startup+0x1d): undefined reference to `boost::system::generic_category()'
CMakeFiles\lightgbm.dir/objects.a(tree_learner.cpp.obj):tree_learner.cpp:(.text.startup+0x22): undefined reference to `boost::system::generic_category()'
CMakeFiles\lightgbm.dir/objects.a(tree_learner.cpp.obj):tree_learner.cpp:(.text.startup+0x27): undefined reference to `boost::system::system_category()'
CMakeFiles\lightgbm.dir/objects.a(voting_parallel_tree_learner.cpp.obj):voting_parallel_tree_learner.cpp:(.text.startup+0x1d): undefined reference to `boost::system::generic_category()'
CMakeFiles\lightgbm.dir/objects.a(voting_parallel_tree_learner.cpp.obj):voting_parallel_tree_learner.cpp:(.text.startup+0x22): undefined reference to `boost::system::generic_category()'
CMakeFiles\lightgbm.dir/objects.a(voting_parallel_tree_learner.cpp.obj):voting_parallel_tree_learner.cpp:(.text.startup+0x27): undefined reference to `boost::system::system_category()'
collect2.exe: error: ld returned 1 exit status
CMakeFiles\lightgbm.dir\build.make:186: recipe for target 'D:/work/LightGBM/lightgbm.exe' failed
mingw32-make[2]: *** [D:/work/LightGBM/lightgbm.exe] Error 1
CMakeFiles\Makefile2:113: recipe for target 'CMakeFiles/lightgbm.dir/all' failed
mingw32-make[1]: *** [CMakeFiles/lightgbm.dir/all] Error 2
Makefile:134: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
jameslamb commented 6 days ago

Thanks for using LightGBM.

What happens when you install the package as documented in https://github.com/microsoft/LightGBM/blob/master/python-package/README.rst?

sh build-python.sh install --gpu

Also note... building from source like this is only necessary if you want to use a non-released version of LightGBM or customize the build. If using the latest release is sufficient for you, just run the following:

pip install 'lightgbm>=4.4.0'

That package on PyPI already has GPU supported compiled in for Windows. So you'll be able to immediately use the OpenCL-based GPU code with that package (by passing "device": "gpu" in params).

CWJ666 commented 6 days ago

Thanks for using LightGBM.

What happens when you install the package as documented in https://github.com/microsoft/LightGBM/blob/master/python-package/README.rst?

sh build-python.sh install --gpu

Also note... building from source like this is only necessary if you want to use a non-released version of LightGBM or customize the build. If using the latest release is sufficient for you, just run the following:

pip install 'lightgbm>=4.4.0'

That package on PyPI already has GPU supported compiled in for Windows. So you'll be able to immediately use the OpenCL-based GPU code with that package (by passing "device": "gpu" in params).

By installing the latest version of Anaconda (which includes LightGBM 4.4.0), I was able to use the GPU. LightGBM is my primary tool for modeling, and I had always been using the 3.x CPU version, thinking that the GPU version needed to be compiled. Thank you very much; this will greatly increase my work efficiency. Thanks again!