Unverified Commit df797137 authored by Nikita Titov's avatar Nikita Titov Committed by GitHub
Browse files

[docs] document sanitizers (#4365)

* document sanitizers

* rephrase
parent 53ffba7c
...@@ -80,6 +80,7 @@ Tests ...@@ -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. 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. 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 High Level Language Package
--------------------------- ---------------------------
......
...@@ -13,6 +13,21 @@ Users who want to perform benchmarking can make LightGBM output time costs for d ...@@ -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. 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: .. _nightly-builds:
You can also download the artifacts of the latest successful build on master branch (nightly builds) here: |download artifacts|. You can also download the artifacts of the latest successful build on master branch (nightly builds) here: |download artifacts|.
...@@ -914,3 +929,5 @@ gcc ...@@ -914,3 +929,5 @@ gcc
.. _SWIG: http://www.swig.org/download.html .. _SWIG: http://www.swig.org/download.html
.. _this detailed guide: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html .. _this detailed guide: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
.. _following docs: https://github.com/google/sanitizers/wiki
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment