If you have errors about **Platform Toolset**, go to ``PROJECT``->\ ``Properties``->\ ``Configuration Properties``->\ ``General`` and select the toolset installed on your machine.
If you have errors about **Platform Toolset**, go to ``PROJECT``->\ ``Properties``->\ ``Configuration Properties``->\ ``General`` and select the toolset installed on your machine.
The exe and dll files will be in ``LightGBM/Release`` folder.
**Note**: Build MPI version by **MinGW** is not supported due to the miss of MPI library in it.
Linux
^^^^^
You need to install `Open MPI`_ first.
Then run the following commands:
..code::
git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
mkdir build ; cd build
cmake -DUSE_MPI=ON ..
make -j4
**Note**: glibc >= 2.14 is required.
OSX
^^^
Install **gcc** and **Open MPI** first:
..code::
brew install openmpi
brew install cmake
brew install gcc --without-multilib
Then run the following commands:
..code::
git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
export CXX=g++-7 CC=gcc-7
mkdir build ; cd build
cmake -DUSE_MPI=ON ..
make -j4
Build GPU Version
~~~~~~~~~~~~~~~~~
Linux
^^^^^
The following dependencies should be installed before compilation:
- OpenCL 1.2 headers and libraries, which is usually provided by GPU manufacture.
The generic OpenCL ICD packages (for example, Debian package ``cl-icd-libopencl1`` and ``cl-icd-opencl-dev``) can also be used.
- libboost 1.56 or later (1.61 or later recommended).
We use Boost.Compute as the interface to GPU, which is part of the Boost library since version 1.61. However, since we include the source code of Boost.Compute as a submodule, we only require the host has Boost 1.56 or later installed. We also use Boost.Align for memory allocation. Boost.Compute requires Boost.System and Boost.Filesystem to store offline kernel cache.
The following Debian packages should provide necessary Boost libraries: ``libboost-dev``, ``libboost-system-dev``, ``libboost-filesystem-dev``.
- CMake 3.2 or later.
To build LightGBM GPU version, run the following commands:
..code::
git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
If you use **MinGW**, the build procedure are similar to the build in Linux. Refer to `GPU Windows Compilation <./GPU-Windows.rst>`__ to get more details.
**Note**: ``C:\local\boost_1_64_0\`` and ``C:\local\boost_1_64_0\lib64-msvc-14.0`` are locations of your Boost binaries. You also can set them to the environment variable to avoid ``Set ...`` commands when build.
If you want to use protobuf to save and load models, install `protobuf c++ version <https://github.com/google/protobuf/blob/master/src/README.md>`__ first.
Then run cmake with USE_PROTO on, for example:
..code::
cmake -DUSE_PROTO=ON ..
You can then use ``model_format=proto`` in parameters when save and load models.
**Note**: for windows user, it's only tested with mingw.