8000 DOC Add the custom compiler section back (#25667) · scikit-learn/scikit-learn@95b8c46 · GitHub
[go: up one dir, main page]

Skip to content

Commit 95b8c46

Browse files
DOC Add the custom compiler section back (#25667)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
1 parent 3a13677 commit 95b8c46

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

doc/developers/advanced_installation.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,45 @@ the base system and these steps will not be necessary.
466466
.. _conda environment: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
467467
.. _Miniforge3: https://github.com/conda-forge/miniforge#miniforge3
468468

469+
Alternative compilers
470+
=====================
471+
472+
The following command will build scikit-learn using your default C/C++ compiler.
473+
474+
.. prompt:: bash $
475+
476+
pip install --verbose --editable .
477+
478+
If you want to build scikit-learn with another compiler handled by ``setuptools``,
479+
use the following command:
480+
481+
.. prompt:: bash $
482+
483+
python setup.py build_ext --compiler=<compiler> -i build_clib --compiler=<compiler>
484+
485+
To see the list of available compilers run:
486+
487+
.. prompt:: bash $
488+
489+
python setup.py build_ext --help-compiler
490+
491+
If your compiler is not listed here, you can specify it through some environment
492+
variables (does not work on windows). This `section
493+
<https://setuptools.pypa.io/en/stable/userguide/ext_modules.html#compiler-and-linker-options>`_
494+
of the setuptools documentation explains in details which environment variables
495+
are used by ``setuptools``, and at which stage of the compilation, to set the
496+
compiler and linker options.
497+
498+
When setting these environment variables, it is advised to first check their
499+
``sysconfig`` counterparts variables and adapt them to your compiler. For instance::
500+
501+
import sysconfig
502+
print(sysconfig.get_config_var('CC'))
503+
print(sysconfig.get_config_var('LDFLAGS'))
504+
505+
In addition, since Scikit-learn uses OpenMP, you need to include the appropriate OpenMP
506+
flag of your compiler into the ``CFLAGS`` and ``CPPFLAGS`` environment variables.
507+
469508
Parallel builds
470509
===============
471510

0 commit comments

Comments
 (0)
0