Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cuda GPU install bug , windows10 #1632

Closed
jaewoo-so opened this issue Aug 31, 2018 · 6 comments
Closed

Cuda GPU install bug , windows10 #1632

jaewoo-so opened this issue Aug 31, 2018 · 6 comments

Comments

@jaewoo-so
Copy link

jaewoo-so commented Aug 31, 2018

I build from source and install.
when i run lightgbm with gpu mode, i got error like below

(first text is step that i run , and second text is error message when i import and run lightgbm)

Environment info

Operating System:

CPU: Ryzen5 1600
GPU: GTX1050Ti
Cuda : 9.2
python = 3.6.6

Error message

Reproducible examples

Steps to reproduce

--- setup message
(tf19) C:\PyLib>Set BOOST_ROOT=C:\local\boost_1_64_0\

(tf19) C:\PyLib>Set BOOST_LIBRARYDIR=C:\local\boost_1_64_0\lib64-msvc-14.0

(tf19) C:\PyLib>git clone --recursive https://github.com/Microsoft/LightGBM
Cloning into 'LightGBM'...
remote: Counting objects: 11308, done.
remote: Compressing objects: 100% (126/126), done.
remote: Total 11308 (delta 73), reused 64 (delta 38), pack-reused 11142
Receiving objects: 100% (11308/11308), 8.51 MiB | 3.04 MiB/s, done.
Resolving deltas: 100% (7928/7928), done.
Submodule 'include/boost/compute' (https://github.com/boostorg/compute) registered for path 'compute'
Cloning into 'C:/PyLib/LightGBM/compute'...
remote: Counting objects: 21464, done.
remote: Total 21464 (delta 0), reused 0 (delta 0), pack-reused 21464
Receiving objects: 100% (21464/21464), 8.45 MiB | 2.82 MiB/s, done.
Resolving deltas: 100% (17406/17406), done.
Submodule path 'compute': checked out '509ebe4a9282eec8a92c65ce3bbc1925f1fdbe07'

(tf19) C:\PyLib> qcd LightGBM
'qcd' is not recognized as an internal or external command,
operable program or batch file.

(tf19) C:\PyLib>cd LightGBM

(tf19) C:\PyLib\LightGBM>mkdir build

(tf19) C:\PyLib\LightGBM>cd build

(tf19) C:\PyLib\LightGBM\build>cmake -DCMAKE_GENERATOR_PLATFORM=x64 -DUSE_GPU=1 ..
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.15063.0 to target Windows 10.0.17134.
-- The C compiler identification is MSVC 19.11.25508.2
-- The CXX compiler identification is MSVC 19.11.25508.2
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -openmp (found version "2.0")
-- Found OpenMP_CXX: -openmp (found version "2.0")
-- Found OpenMP: TRUE (found version "2.0")
-- Looking for CL_VERSION_2_2
-- Looking for CL_VERSION_2_2 - not found
-- Looking for CL_VERSION_2_1
-- Looking for CL_VERSION_2_1 - not found
-- Looking for CL_VERSION_2_0
-- Looking for CL_VERSION_2_0 - not found
-- Looking for CL_VERSION_1_2
-- Looking for CL_VERSION_1_2 - found
-- Found OpenCL: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2/lib/x64/OpenCL.lib (found version "1.2")
-- OpenCL include directory:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2/include
CMake Warning (dev) at CMakeLists.txt:97 (find_package):
Policy CMP0074 is not set: find_package uses _ROOT variables.
Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.

Environment variable Boost_ROOT is set to:

C:\local\boost_1_64_0\

For compatibility, CMake is ignoring the variable.
This warning is for project developers. Use -Wno-dev to suppress it.

-- Boost version: 1.64.0
-- Found the following Boost libraries:
-- filesystem
-- system
-- Configuring done
-- Generating done
-- Build files have been written to: C:/PyLib/LightGBM/build

(tf19) C:\PyLib\LightGBM\build>cd ..

(tf19) C:\PyLib\LightGBM>cd python-package

(tf19) C:\PyLib\LightGBM\python-package>python setup.py install
running install
INFO:LightGBM:Starting to compile the library.
INFO:LightGBM:Starting to compile with MSBuild from existing solution file.
WARNING:LightGBM:Compilation with MSBuild from existing solution file failed.
INFO:LightGBM:Starting to compile with Visual Studio 15 2017 Win64.
running build
running build_py
creating build
creating build\lib
creating build\lib\lightgbm
copying lightgbm\basic.py -> build\lib\lightgbm
copying lightgbm\callback.py -> build\lib\lightgbm
copying lightgbm\compat.py -> build\lib\lightgbm
copying lightgbm\engine.py -> build\lib\lightgbm
copying lightgbm\libpath.py -> build\lib\lightgbm
copying lightgbm\plotting.py -> build\lib\lightgbm
copying lightgbm\sklearn.py -> build\lib\lightgbm
copying lightgbm_init_.py -> build\lib\lightgbm
running egg_info
creating lightgbm.egg-info
writing lightgbm.egg-info\PKG-INFO
writing dependency_links to lightgbm.egg-info\dependency_links.txt
writing requirements to lightgbm.egg-info\requires.txt
writing top-level names to lightgbm.egg-info\top_level.txt
writing manifest file 'lightgbm.egg-info\SOURCES.txt'
reading manifest file 'lightgbm.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'build'
warning: no files found matching '.txt'
warning: no files found matching '
.so' under directory 'lightgbm'
warning: no files found matching '.so' under directory 'compile'
warning: no files found matching '
' under directory 'compile\compute'
warning: no files found matching '.dll' under directory 'compile\windows\x64\DLL'
warning: no previously-included files matching '
.py[co]' found anywhere in distribution
writing manifest file 'lightgbm.egg-info\SOURCES.txt'
copying lightgbm\VERSION.txt -> build\lib\lightgbm
running install_lib
creating C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm
copying build\lib\lightgbm\basic.py -> C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm
copying build\lib\lightgbm\callback.py -> C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm
copying build\lib\lightgbm\compat.py -> C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm
copying build\lib\lightgbm\engine.py -> C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm
copying build\lib\lightgbm\libpath.py -> C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm
copying build\lib\lightgbm\plotting.py -> C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm
copying build\lib\lightgbm\sklearn.py -> C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm
copying build\lib\lightgbm\VERSION.txt -> C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm
copying build\lib\lightgbm_init_.py -> C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm
INFO:root:Installing lib_lightgbm from: ['compile\Release\lib_lightgbm.dll']
copying compile\Release\lib_lightgbm.dll -> C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm
byte-compiling C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm\basic.py to basic.cpython-37.pyc
byte-compiling C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm\callback.py to callback.cpython-37.pyc
byte-compiling C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm\compat.py to compat.cpython-37.pyc
byte-compiling C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm\engine.py to engine.cpython-37.pyc
byte-compiling C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm\libpath.py to libpath.cpython-37.pyc
byte-compiling C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm\plotting.py to plotting.cpython-37.pyc
byte-compiling C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm\sklearn.py to sklearn.cpython-37.pyc
byte-compiling C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm_init_.py to init.cpython-37.pyc
running install_egg_info
Copying lightgbm.egg-info to C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\Lib\site-packages\lightgbm-2.1.2.4-py3.7.egg-info
running install_scripts

--- code run message

from sklearn import datasets
from sklearn.cross_validation import StratifiedKFold
from sklearn.model_selection import train_test_split , KFold
from sklearn.feature_selection import SelectFromModel
from sklearn.cross_validation import cross_val_score
from sklearn.metrics import accuracy_score
iris = datasets.load_iris()
X = iris.data
y = iris.target

xtrain, xtest, ytrain, ytest = train_test_split(X, y, test_size=0.2, random_state=42)

import lightgbm as lgb

train_data = lgb.Dataset(xtrain , label = ytrain)
test_data = lgb.Dataset(xtest , label = ytest)
param = {'num_leaves':31, 'num_trees':100, 'objective':'multiclass' , 'num_class' : 3}
param['metric'] = 'multi_error'
param['device_type'] = 'gpu'

model = lgb.LGBMClassifier(**param)
model.fit(xtrain,ytrain)

C:\Users\So-Ryzen\AppData\Local\conda\conda\envs\tf19\lib\site-packages\lightgbm\engine.py:110: UserWarning: Found num_trees in params. Will use it instead of argument
warnings.warn("Found {} in params. Will use it instead of argument".format(alias))


LightGBMError Traceback (most recent call last)
in ()
20
21 model = lgb.LGBMClassifier(**param)
---> 22 model.fit(xtrain,ytrain)

~\AppData\Local\conda\conda\envs\tf19\lib\site-packages\lightgbm\sklearn.py in fit(self, X, y, sample_weight, init_score, eval_set, eval_names, eval_sample_weight, eval_class_weight, eval_init_score, eval_metric, early_stopping_rounds, verbose, feature_name, categorical_feature, callbacks)
723 verbose=verbose, feature_name=feature_name,
724 categorical_feature=categorical_feature,
--> 725 callbacks=callbacks)
726 return self
727

~\AppData\Local\conda\conda\envs\tf19\lib\site-packages\lightgbm\sklearn.py in fit(self, X, y, sample_weight, init_score, group, eval_set, eval_names, eval_sample_weight, eval_class_weight, eval_init_score, eval_group, eval_metric, early_stopping_rounds, verbose, feature_name, categorical_feature, callbacks)
496 verbose_eval=verbose, feature_name=feature_name,
497 categorical_feature=categorical_feature,
--> 498 callbacks=callbacks)
499
500 if evals_result:

~\AppData\Local\conda\conda\envs\tf19\lib\site-packages\lightgbm\engine.py in train(params, train_set, num_boost_round, valid_sets, valid_names, fobj, feval, init_model, feature_name, categorical_feature, early_stopping_rounds, evals_result, verbose_eval, learning_rates, keep_training_booster, callbacks)
184 # construct booster
185 try:
--> 186 booster = Booster(params=params, train_set=train_set)
187 if is_valid_contain_train:
188 booster.set_train_data_name(train_data_name)

~\AppData\Local\conda\conda\envs\tf19\lib\site-packages\lightgbm\basic.py in init(self, params, train_set, model_file, silent)
1444 train_set.construct().handle,
1445 c_str(params_str),
-> 1446 ctypes.byref(self.handle)))
1447 # save reference to data
1448 self.train_set = train_set

~\AppData\Local\conda\conda\envs\tf19\lib\site-packages\lightgbm\basic.py in _safe_call(ret)
42 """
43 if ret != 0:
---> 44 raise LightGBMError(decode_string(_LIB.LGBM_GetLastError()))
45
46

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

@StrikerRUS
Copy link
Collaborator

StrikerRUS commented Aug 31, 2018

Hi @nchos88 !

The problem is here:

(tf19) C:\PyLib\LightGBM\python-package>python setup.py install

You've forgotten either --precompile flag to tell the Python installation script to use the library file that you've just compiled, or --gpu flag to tell the Python installation script to build GPU version. In the second case, there was no need to build the library file on yourself.

@jaewoo-so
Copy link
Author

@StrikerRUS
Thank you for reply.
I tried with --precompile , but i got same erorr,.
When i use --gpu option, problem is solved.

@StrikerRUS
Copy link
Collaborator

ping @huanzhang12 for the strange warning:

CMake Warning (dev) at CMakeLists.txt:97 (find_package):
Policy CMP0074 is not set: find_package uses _ROOT variables.
Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Environment variable Boost_ROOT is set to:
C:\local\boost_1_64_0\
For compatibility, CMake is ignoring the variable.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Boost version: 1.64.0
-- Found the following Boost libraries:
-- filesystem
-- system
-- Configuring done
-- Generating done
-- Build files have been written to: C:/PyLib/LightGBM/build

@StrikerRUS
Copy link
Collaborator

@huanzhang12 What do you think about the warning above?

@huanzhang12
Copy link
Contributor

@StrikerRUS There are some small compatibility changes since CMake 3.12. I guess you are using a very new CMake version (mine on Ubuntu 18.04 is still 3.10).
For a fix we can refer to PointCloudLibrary/pcl#2425

@StrikerRUS
Copy link
Collaborator

@nchos88 Can you please tell us what is your CMake version?

@lock lock bot locked as resolved and limited conversation to collaborators Mar 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants