From 2bfdebb37189d03c4cfb2f60af8ef1100ed87d9a Mon Sep 17 00:00:00 2001 From: jeremiedbb Date: Thu, 23 Feb 2023 13:14:32 +0100 Subject: [PATCH 1/2] add the custom compiler section back and updated --- doc/developers/advanced_installation.rst | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/doc/developers/advanced_installation.rst b/doc/developers/advanced_installation.rst index bb65e6b7fad17..03a25bead459a 100644 --- a/doc/developers/advanced_installation.rst +++ b/doc/developers/advanced_installation.rst @@ -466,6 +466,46 @@ the base system and these steps will not be necessary. .. _conda environment: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html .. _Miniforge3: https://github.com/conda-forge/miniforge#miniforge3 +Alternative compilers +===================== + +The command: + +.. prompt:: bash $ + + pip install --verbose --editable . + +will build scikit-learn using your default C/C++ compiler. If you want to build +scikit-learn with another compiler handled by ``setuptools`` or by use the +following command: + +.. prompt:: bash $ + + python setup.py build_ext --compiler= -i build_clib --compiler= + +To see the list of available compilers run: + +.. prompt:: bash $ + + python setup.py build_ext --help-compiler + +If your compiler is not listed here, you can specify it through some environment +variables (does not work on windows). This `section +`_ +of the setuptools documentation explains in details which environment variables +are used by ``setuptools``, and at which stage of the compilation, to set the +compiler and linker options. + +When setting these environment variables, it is advised to first check their +``sysconfig`` counterparts variables and adapt them to your compiler. For instance:: + + import sysconfig + print(sysconfig.get_config_var('CC')) + print(sysconfig.get_config_var('LDFLAGS')) + +In addition, since Scikit-learn uses OpenMP, you need to include the appropriate OpenMP +flag of your compiler into the ``CFLAGS`` and ``CPPFLAGS`` environment variables. + Parallel builds =============== From e05d2bf3e19dcc435bdee4cd52b0449e5299a6a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20du=20Boisberranger?= <34657725+jeremiedbb@users.noreply.github.com> Date: Thu, 23 Feb 2023 23:23:09 +0100 Subject: [PATCH 2/2] Update doc/developers/advanced_installation.rst Co-authored-by: Thomas J. Fan --- doc/developers/advanced_installation.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/developers/advanced_installation.rst b/doc/developers/advanced_installation.rst index 03a25bead459a..695db88b4e66b 100644 --- a/doc/developers/advanced_installation.rst +++ b/doc/developers/advanced_installation.rst @@ -469,15 +469,14 @@ the base system and these steps will not be necessary. Alternative compilers ===================== -The command: +The following command will build scikit-learn using your default C/C++ compiler. .. prompt:: bash $ pip install --verbose --editable . -will build scikit-learn using your default C/C++ compiler. If you want to build -scikit-learn with another compiler handled by ``setuptools`` or by use the -following command: +If you want to build scikit-learn with another compiler handled by ``setuptools``, +use the following command: .. prompt:: bash $