Skip to content

Commit

Permalink
[docs] documented version without OpenMP support (#1811)
Browse files Browse the repository at this point in the history
  • Loading branch information
StrikerRUS authored and guolinke committed Nov 5, 2018
1 parent 59f1045 commit 5d46771
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 2 deletions.
147 changes: 147 additions & 0 deletions docs/Installation-Guide.rst
Expand Up @@ -15,6 +15,8 @@ For the build of Python-package and R-package, please refer to `Python-package`_

- `Docker <#docker>`__

- `Threadless Version (not Recommended) <#build-threadless-version-not-recommended>`__

- `MPI Version <#build-mpi-version>`__

- `GPU Version <#build-gpu-version>`__
Expand Down Expand Up @@ -177,6 +179,151 @@ Docker

Refer to `Docker folder <https://github.com/Microsoft/LightGBM/tree/master/docker>`__.

Build Threadless Version (not Recommended)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The default build version of LightGBM is based on OpenMP.
However, you can build the LightGBM without OpenMP support, but it is **strongly not recommended**.

Windows
^^^^^^^

On Windows version of LightGBM without OpenMP support can be built using

- **Visual Studio**;

- **CMake** and **VS Build Tools**;

- **CMake** and **MinGW**.

Visual Studio (or VS Build Tools)
*********************************

With GUI
--------

1. Install `Visual Studio`_ (2015 or newer).

2. Download `zip archive`_ and unzip it.

3. Go to ``LightGBM-master/windows`` folder.

4. Open ``LightGBM.sln`` file with **Visual Studio**.

5. Go to ``PROJECT`` -> ``Properties`` -> ``Configuration Properties`` -> ``C/C++`` -> ``Language`` and change the ``OpenMP Support`` property to ``No (/openmp-)``.

6. Get back to the project's main screen, then choose ``Release`` configuration and click ``BUILD`` -> ``Build Solution (Ctrl+Shift+B)``.

If you have errors about **Platform Toolset**, go to ``PROJECT`` -> ``Properties`` -> ``Configuration Properties`` -> ``General`` and select the toolset installed on your machine.

The exe file will be in ``LightGBM-master/windows/x64/Release`` folder.

From Command Line
-----------------

1. Install `Git for Windows`_, `CMake`_ (3.8 or higher) and `VS Build Tools`_ (**VS Build Tools** is not needed if **Visual Studio** (2015 or newer) is already installed).

2. Run the following commands:

.. code::
git clone --recursive https://github.com/Microsoft/LightGBM
cd LightGBM
mkdir build
cd build
cmake -DCMAKE_GENERATOR_PLATFORM=x64 -DUSE_OPENMP=OFF ..
cmake --build . --target ALL_BUILD --config Release
The exe and dll files will be in ``LightGBM/Release`` folder.

MinGW-w64
*********

1. Install `Git for Windows`_, `CMake`_ and `MinGW-w64`_.

2. Run the following commands:

.. code::
git clone --recursive https://github.com/Microsoft/LightGBM
cd LightGBM
mkdir build
cd build
cmake -G "MinGW Makefiles" -DUSE_OPENMP=OFF ..
mingw32-make.exe -j4
The exe and dll files will be in ``LightGBM/`` folder.

**Note**: You may need to run the ``cmake -G "MinGW Makefiles" -DUSE_OPENMP=OFF ..`` one more time if you encounter the ``sh.exe was found in your PATH`` error.

Linux
^^^^^

On Linux version of LightGBM without OpenMP support can be built using **CMake** and **gcc** or **Clang**.

1. Install `CMake`_.

2. Run the following commands:

.. code::
git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
mkdir build ; cd build
cmake -DUSE_OPENMP=OFF ..
make -j4
**Note**: glibc >= 2.14 is required.

macOS
^^^^^

On macOS version of LightGBM without OpenMP support can be built using **CMake** and **Apple Clang** or **gcc**.

Apple Clang
***********

Only **Apple Clang** version 8.1 or higher is supported.

1. Install `CMake`_ (3.12 or higher):

.. code::
brew install cmake
2. Run the following commands:

.. code::
git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
mkdir build ; cd build
cmake -DUSE_OPENMP=OFF ..
make -j4
gcc
***

1. Install `CMake`_ (3.2 or higher):

.. code::
brew install cmake
2. Install **gcc**:

.. code::
brew install gcc
3. Run the following commands:

.. code::
git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
export CXX=g++-7 CC=gcc-7 # replace "7" with version of gcc installed on your machine
mkdir build ; cd build
cmake -DUSE_OPENMP=OFF ..
make -j4
Build MPI Version
~~~~~~~~~~~~~~~~~

Expand Down
3 changes: 2 additions & 1 deletion docs/_static/js/script.js
Expand Up @@ -6,7 +6,8 @@ $(function() {
/* Collapse specified sections in the installation guide */
if(window.location.pathname.toLocaleLowerCase().indexOf('installation-guide') != -1) {
$('<style>.closed, .opened {cursor: pointer;} .closed:before, .opened:before {font-family: FontAwesome; display: inline-block; padding-right: 6px;} .closed:before {content: "\\f078";} .opened:before {content: "\\f077";}</style>').appendTo('body');
var collapsable = ['#build-mpi-version', '#build-gpu-version', '#build-hdfs-version', '#build-java-wrapper'];
var collapsable = ['#build-threadless-version-not-recommended', '#build-mpi-version', '#build-gpu-version',
'#build-hdfs-version', '#build-java-wrapper'];
$.each(collapsable, function(i, val) {
var header = val + ' > :header:first';
var content = val + ' :not(:header:first)';
Expand Down
13 changes: 13 additions & 0 deletions python-package/README.rst
Expand Up @@ -47,6 +47,17 @@ For **macOS** users, you can perform installation either with **Apple Clang** or

For **Windows** users, **Visual Studio** (or `VS Build Tools <https://visualstudio.microsoft.com/downloads/>`_) is needed. If you get any errors during installation, you may need to install `CMake`_ (version 3.8 or higher).

Build Threadless Version
~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: sh
pip install lightgbm --install-option=--nomp
All remarks, except the **OpenMP** requirement for macOS users, from `Build from Sources section <#build-from-sources>`__ are actual in this case.

It is **strongly not recommended** to use this version of LightGBM!

Build MPI Version
~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -129,6 +140,8 @@ For **Windows** users, if you get any errors during installation and there is th
Note: ``sudo`` (or administrator rights in **Windows**) may be needed to perform the command.

Run ``python setup.py install --nomp`` to disable **OpenMP** support. All remarks from `Build Threadless Version section <#build-threadless-version>`__ are actual in this case.

Run ``python setup.py install --mpi`` to enable **MPI** support. All remarks from `Build MPI Version section <#build-mpi-version>`__ are actual in this case.

Run ``python setup.py install --mingw``, if you want to use **MinGW-w64** on **Windows** instead of **Visual Studio**. All remarks from `Build with MinGW-w64 on Windows section <#build-with-mingw-w64-on-windows>`__ are actual in this case.
Expand Down
2 changes: 1 addition & 1 deletion python-package/setup.py
Expand Up @@ -186,7 +186,7 @@ class CustomInstall(install):
('mingw', 'm', 'Compile with MinGW'),
('gpu', 'g', 'Compile GPU version'),
('mpi', None, 'Compile MPI version'),
('nomp', None, 'Compile without openmp'),
('nomp', None, 'Compile version without OpenMP support'),
('hdfs', 'h', 'Compile HDFS version'),
('precompile', 'p', 'Use precompiled library'),
('boost-root=', None, 'Boost preferred installation prefix'),
Expand Down

0 comments on commit 5d46771

Please sign in to comment.