Skip to content

Commit

Permalink
[docs] document sanitizers (#4365)
Browse files Browse the repository at this point in the history
* document sanitizers

* rephrase
  • Loading branch information
StrikerRUS authored Jun 14, 2021
1 parent 53ffba7 commit df79713
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/Development-Guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Tests

C++ unit tests are located in the ``./tests/cpp_tests`` folder and written with the help of Google Test framework.
To run tests locally first refer to the `Installation Guide <./Installation-Guide.rst#build-c-unit-tests>`__ for how to build tests and then simply run compiled executable file.
It is highly recommended to build tests with `sanitizers <./Installation-Guide.rst#sanitizers>`__.

High Level Language Package
---------------------------
Expand Down
17 changes: 17 additions & 0 deletions docs/Installation-Guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ Users who want to perform benchmarking can make LightGBM output time costs for d

It is possible to build LightGBM in debug mode. In this mode all compiler optimizations are disabled and LightGBM performs more checks internally. To enable debug mode you can add ``-DUSE_DEBUG=ON`` to CMake flags or choose ``Debug_*`` configuration (e.g. ``Debug_DLL``, ``Debug_mpi``) in Visual Studio depending on how you are building LightGBM.

.. _sanitizers:

In addition to the debug mode, LightGBM can be built with compiler sanitizers.
To enable them add ``-DUSE_SANITIZER=ON -DENABLED_SANITIZERS="address;leak;undefined"`` to CMake flags.
These values refer to the following supported sanitizers:

- ``address`` - AddressSanitizer (ASan);
- ``leak`` - LeakSanitizer (LSan);
- ``undefined`` - UndefinedBehaviorSanitizer (UBSan);
- ``thread`` - ThreadSanitizer (TSan).

Please note, that ThreadSanitizer cannot be used together with other sanitizers.
For more info and additional sanitizers' parameters please refer to the `following docs`_.
It is very useful to build `C++ unit tests <#build-c-unit-tests>`__ with sanitizers.

.. _nightly-builds:

You can also download the artifacts of the latest successful build on master branch (nightly builds) here: |download artifacts|.
Expand Down Expand Up @@ -914,3 +929,5 @@ gcc
.. _SWIG: http://www.swig.org/download.html

.. _this detailed guide: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html

.. _following docs: https://github.com/google/sanitizers/wiki

0 comments on commit df79713

Please sign in to comment.