diff --git a/docs/Installation-Guide.rst b/docs/Installation-Guide.rst index 00cb99aad..e528cec50 100644 --- a/docs/Installation-Guide.rst +++ b/docs/Installation-Guide.rst @@ -558,6 +558,35 @@ Docker Refer to `GPU Docker folder `__. +Build CUDA Version (Experimental) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The `original GPU build <#build-gpu-version>`__ of LightGBM is based on OpenCL. + +The CUDA-based build is a separate implementation and requires an NVIDIA graphics card with compute capability 6.0 and higher. It should be considered experimental, and we suggest using it only when it is impossible to use OpenCL version (for example, on IBM POWER microprocessors). + +**Note**: only Linux is supported, other operating systems are not supported yet. + +Linux +^^^^^ + +On Linux a CUDA version of LightGBM can be built using **CUDA**, **CMake** and **gcc**. + +The following dependencies should be installed before compilation: + +- **CUDA** libraries. Please refer to `this detailed guide`_. + +- **CMake** 3.16 or later. + +To build LightGBM CUDA version, run the following commands: + +.. code:: + + git clone --recursive https://github.com/microsoft/LightGBM ; cd LightGBM + mkdir build ; cd build + cmake -DUSE_CUDA=1 .. + make -j4 + Build HDFS Version ~~~~~~~~~~~~~~~~~~ @@ -755,3 +784,5 @@ Also, you may want to read `gcc Tips <./gcc-Tips.rst>`__. .. _Boost Binaries: https://bintray.com/boostorg/release/boost-binaries/_latestVersion#files .. _SWIG: http://www.swig.org/download.html + +.. _this detailed guide: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html diff --git a/docs/Parameters.rst b/docs/Parameters.rst index 4fc9173a6..5a4880154 100644 --- a/docs/Parameters.rst +++ b/docs/Parameters.rst @@ -1176,7 +1176,9 @@ GPU Parameters - ``gpu_use_dp`` :raw-html:`🔗︎`, default = ``false``, type = bool - - set this to ``true`` to use double precision math on GPU (by default single precision is used in OpenCL implementation and double precision is used in CUDA implementation) + - set this to ``true`` to use double precision math on GPU (by default single precision is used) + + - **Note**: can be used only in OpenCL implementation, in CUDA implementation only double precision is currently supported - ``num_gpu`` :raw-html:`🔗︎`, default = ``1``, type = int, constraints: ``num_gpu > 0`` diff --git a/docs/_static/js/script.js b/docs/_static/js/script.js index 7863eedbc..fea43d369 100644 --- a/docs/_static/js/script.js +++ b/docs/_static/js/script.js @@ -6,7 +6,7 @@ $(function() { if(window.location.pathname.toLocaleLowerCase().indexOf('installation-guide') != -1) { $('').appendTo('body'); var collapsable = ['#build-threadless-version-not-recommended', '#build-mpi-version', '#build-gpu-version', - '#build-hdfs-version', '#build-java-wrapper']; + '#build-cuda-version-experimental', '#build-hdfs-version', '#build-java-wrapper']; $.each(collapsable, function(i, val) { var header = val + ' > :header:first'; var content = val + ' :not(:header:first)'; diff --git a/include/LightGBM/config.h b/include/LightGBM/config.h index 1d6c6ac21..8b0800007 100644 --- a/include/LightGBM/config.h +++ b/include/LightGBM/config.h @@ -997,7 +997,8 @@ struct Config { // desc = **Note**: refer to `GPU Targets <./GPU-Targets.rst#query-opencl-devices-in-your-system>`__ for more details int gpu_device_id = -1; - // desc = set this to ``true`` to use double precision math on GPU (by default single precision is used in OpenCL implementation and double precision is used in CUDA implementation) + // desc = set this to ``true`` to use double precision math on GPU (by default single precision is used) + // desc = **Note**: can be used only in OpenCL implementation, in CUDA implementation only double precision is currently supported bool gpu_use_dp = false; // check = >0 diff --git a/python-package/README.rst b/python-package/README.rst index 121def9b1..e4a13b50e 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -110,6 +110,17 @@ All available options: For more details see `FindBoost `__ and `FindOpenCL `__. +Build CUDA Version +~~~~~~~~~~~~~~~~~~ + +.. code:: sh + + pip install lightgbm --install-option=--cuda + +All remarks from `Build from Sources section <#build-from-sources>`__ are actual in this case and `CMake`_ (version 3.16 or higher) is strongly required. + +**CUDA** library is needed: details for installation can be found in `Installation Guide `__. + Build HDFS Version ~~~~~~~~~~~~~~~~~~ @@ -177,6 +188,8 @@ Run ``python setup.py install --mingw``, if you want to use **MinGW-w64** on **W Run ``python setup.py install --gpu`` to enable GPU support. All remarks from `Build GPU Version section <#build-gpu-version>`__ are actual in this case. To pass additional options to **CMake** use the following syntax: ``python setup.py install --gpu --opencl-include-dir=/usr/local/cuda/include/``, see `Build GPU Version section <#build-gpu-version>`__ for the complete list of them. +Run ``python setup.py install --cuda`` to enable CUDA support. All remarks from `Build CUDA Version section <#build-cuda-version>`__ are actual in this case. + Run ``python setup.py install --hdfs`` to enable HDFS support. All remarks from `Build HDFS Version section <#build-hdfs-version>`__ are actual in this case. Run ``python setup.py install --bit32``, if you want to use 32-bit version. All remarks from `Build 32-bit Version with 32-bit Python section <#build-32-bit-version-with-32-bit-python>`__ are actual in this case. diff --git a/python-package/setup.py b/python-package/setup.py index 08cc7d0c0..e468d05cd 100644 --- a/python-package/setup.py +++ b/python-package/setup.py @@ -163,7 +163,7 @@ def compile_cpp(use_mingw=False, use_gpu=False, use_cuda=False, use_mpi=False, else: status = 1 lib_path = os.path.join(CURRENT_DIR, "compile", "windows", "x64", "DLL", "lib_lightgbm.dll") - if not any((use_gpu, use_mpi, use_hdfs, nomp, bit32, integrated_opencl)): + if not any((use_gpu, use_cuda, use_mpi, use_hdfs, nomp, bit32, integrated_opencl)): logger.info("Starting to compile with MSBuild from existing solution file.") platform_toolsets = ("v142", "v141", "v140") for pt in platform_toolsets: