Closed cjliux closed 6 years ago
The OpenCL 2.0 library is probably a generic ICD (installable client driver) library and headers provided by the OS, which is automatically detected by CMake. At runtime, the ICD library dispatches actual OpenCL function calls to the vendor specific OpenCL libraries provided by AMD/Nvidia/Intel.
In LightGBM, only OpenCL 1.2 is required, and OpenCL 2.0 should be backwards compatible. In fact, all NVIDIA GPUs support 1.2 only; most AMD GPUs after 2014 theoretically support 2.0, but getting it working on Linux can be tricky. If LightGBM compiles and works fine for you, you don't need to worry about it.
Actually, OpenCL2.0 isn't present on my machine, and cmake raised the error because it cannot find the correct version identifier in the libopencl.so
file since it had recognised it to be of version 2.0 rather than 1.2.
@cjliux Can you provide more information, including your GPU vendor and CMake log?
OSError Traceback (most recent call last)
I have the same problem. Everything is ok during installation (both command line and python version), and I can use both CPU and GPU on the command line. But when I try to import it in python, it raises an error:
>>> import lightgbm
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.5/dist-packages/lightgbm/__init__.py", line 8, in <module> from .basic import Booster, Dataset File "/usr/local/lib/python3.5/dist-packages/lightgbm/basic.py", line 32, in <module> _LIB = _load_lib() File "/usr/local/lib/python3.5/dist-packages/lightgbm/basic.py", line 27, in _load_lib lib = ctypes.cdll.LoadLibrary(lib_path[0]) File "/usr/lib/python3.5/ctypes/__init__.py", line 425, in LoadLibrary return self._dlltype(name) File "/usr/lib/python3.5/ctypes/__init__.py", line 347, in __init__ self._handle = _dlopen(self._name, mode) OSError: /usr/local/lib/python3.5/dist-packages/lightgbm/lib_lightgbm.so: symbol clCreateCommandQueueWithProperties, version OPENCL_2.0 not defined in file libOpenCL.so.1 with link time reference
System Info:
cl-icd-libopencl1
, cl-icd-opencl-dev
, libboost-dev
, libboost-system-dev
, libboost-filesystem-dev
I think it's due to CUDA, maybe it links to a wrong version of OpenCL? And I didn't add these variables below because I don't know which path should I add. How can I fix this?
You need to add
OpenCL_INCLUDE_DIR
to the environmental variable 'PATH' and exportBOOST_ROOT
before installation.
Thx a lot! Look forward to your reply. @huanzhang12 @wxchan @henry0312 @StrikerRUS
@luozm When I installed the python package, I modified setup.py
as followings:
cmake_cmd = ["cmake", "../compile/"]
if use_gpu:
cmake_cmd.append("-DUSE_GPU=ON")
cmake_cmd.append("-DOpenCL_LIBRARY=/usr/local/cuda/lib64/libOpenCL.so")
I also set the environment variable CUDA_ROOT
as the following:
export CUDA_ROOT=/usr/local/cuda
After that, ran python setup.py install --gpu
.
@Tony-Y Really thanks for your help!
@luozm If you use master branch of CMake, you need not modify setup.py
. You can find the commit message about the fix at https://github.com/Kitware/CMake/commit/b361990007a4d40f5a0f682455bcea89efd7eecc
Hey guys, I'm having this exact problem installing the R package at the moment. I'm using Laurae's lgbdl package to attempt to build the gpu version. It is able to build the package using:
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp
-- Looking for CL_VERSION_2_0
-- Looking for CL_VERSION_2_0 - found
-- Found OpenCL: /usr/lib/x86_64-linux-gnu/libOpenCL.so (found version "2.0")
-- OpenCL include directory:/usr/include
-- Boost version: 1.58.0
-- Found the following Boost libraries:
-- filesystem
-- system
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/Rtmp3Qfite/LightGBM/lightgbm_r/src/build
but then reports:
symbol clCreateCommandQueueWithProperties, version OPENCL_2.0 not defined in file libOpenCL.so.1 with link time reference
And then fails. My system is:
MRAN 3.5.1 on Ubuntu 16.04
Help is much appreciated.
I followed the installation guide in wiki to build the gpu version of lightGBM. However, the version detected when I entered
sudo cmake -USE_MPI=ON -USE-GPU=1 ..
is 2.0, while the version actually installed is 1.0. Do any one know the reason?