Skip to content

Commit 72a3259

Browse files
DOC: Clarify requirements for running on GPU and supported configurations (#2286)
* update conda install instructions * simplify tables * further simplify * clarify requirements for running on GPU * typos * add note about support for FPGAs and SPMD * clarify optional aspect of dpctl * clarify requirements for SPMD, clarify conda-forge status * more clarifications about requirements * small details * wording * order * link to dpctl docs programmatically * don't use automated section naming * use unnamed reference for mpi4py * more corrections * clarify sycl device support * clarify dpctl not required for spmd * clarify integrated chipsets not supported * typo * single link occurrence for dpctl * clarify mpi4py requirements * more spmd details * wording * mention detail about queues * correction oneMath->oneMKL * more corrections * copyright header * update main page too * more improvements * spacing * mention multi-gpu setups in readme
1 parent 19fd721 commit 72a3259

File tree

8 files changed

+236
-184
lines changed

8 files changed

+236
-184
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ The software acceleration is achieved with vector instructions, AI hardware-spec
4545

4646
With Intel(R) Extension for Scikit-learn, you can:
4747

48-
* Speed up training and inference by up to 100x with the equivalent mathematical accuracy
49-
* Benefit from performance improvements across different Intel(R) hardware configurations
48+
* Speed up training and inference by up to 100x with equivalent mathematical accuracy
49+
* Benefit from performance improvements across different Intel(R) hardware configurations, including GPUs and multi-GPU configurations
5050
* Integrate the extension into your existing Scikit-learn applications without code modifications
5151
* Continue to use the open-source scikit-learn API
5252
* Enable and disable the extension with a couple of lines of code or at the command line
@@ -71,12 +71,14 @@ Intel(R) Extension for Scikit-learn is also a part of [Intel(R) AI Tools](https:
7171
from sklearn.cluster import DBSCAN
7272

7373
X = np.array([[1., 2.], [2., 2.], [2., 3.],
74-
[8., 7.], [8., 8.], [25., 80.]], dtype=np.float32)
74+
[8., 7.], [8., 8.], [25., 80.]], dtype=np.float32)
7575
clustering = DBSCAN(eps=3, min_samples=2).fit(X)
7676
```
7777

7878
- **Enable Intel(R) GPU optimizations**
7979

80+
_Note: executing on GPU has [additional system software requirements](https://www.intel.com/content/www/us/en/developer/articles/system-requirements/intel-oneapi-dpcpp-system-requirements.html) - see [details](https://uxlfoundation.github.io/scikit-learn-intelex/latest/oneapi-gpu.html)._
81+
8082
```py
8183
import numpy as np
8284
import dpctl
@@ -86,7 +88,7 @@ Intel(R) Extension for Scikit-learn is also a part of [Intel(R) AI Tools](https:
8688
from sklearn.cluster import DBSCAN
8789

8890
X = np.array([[1., 2.], [2., 2.], [2., 3.],
89-
[8., 7.], [8., 8.], [25., 80.]], dtype=np.float32)
91+
[8., 7.], [8., 8.], [25., 80.]], dtype=np.float32)
9092
with config_context(target_offload="gpu:0"):
9193
clustering = DBSCAN(eps=3, min_samples=2).fit(X)
9294
```

doc/sources/algorithms.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
.. See the License for the specific language governing permissions and
1313
.. limitations under the License.
1414
15+
.. include:: substitutions.rst
1516
.. _sklearn_algorithms:
1617

1718
####################
1819
Supported Algorithms
1920
####################
2021

21-
Applying |intelex| impacts the following scikit-learn algorithms:
22+
Applying |intelex| impacts the following |sklearn| estimators:
2223

2324
on CPU
2425
------
@@ -380,6 +381,8 @@ Other Tasks
380381
- All parameters are supported
381382
- Only dense data is supported
382383

384+
.. _spmd-support:
385+
383386
SPMD Support
384387
------------
385388

doc/sources/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575

7676
intersphinx_mapping = {
7777
"sklearn": ("https://scikit-learn.org/stable/", None),
78+
"dpctl": ("https://intelpython.github.io/dpctl/latest", None),
7879
# from scikit-learn, in case some object in sklearnex points to them:
7980
# https://github.com/scikit-learn/scikit-learn/blob/main/doc/conf.py
8081
"python": ("https://docs.python.org/{.major}".format(sys.version_info), None),

doc/sources/distributed-mode.rst

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,85 @@
1212
.. See the License for the specific language governing permissions and
1313
.. limitations under the License.
1414
15+
.. include:: substitutions.rst
16+
1517
.. _distributed:
1618

17-
Distributed Mode
18-
================
19+
Distributed Mode (SPMD)
20+
=======================
1921

2022
|intelex| offers Single Program, Multiple Data (SPMD) supported interfaces for distributed computing.
21-
Several `GPU-supported algorithms <https://uxlfoundation.github.io/scikit-learn-intelex/latest/oneapi-gpu.html#>`_
22-
also provide distributed, multi-GPU computing capabilities via integration with ``mpi4py``. The prerequisites
23+
Several :doc:`GPU-supported algorithms <oneapi-gpu>`
24+
also provide distributed, multi-GPU computing capabilities via integration with |mpi4py|. The prerequisites
2325
match those of GPU computing, along with an MPI backend of your choice (`Intel MPI recommended
2426
<https://www.intel.com/content/www/us/en/developer/tools/oneapi/mpi-library.html#gs.dcan6r>`_, available
25-
via ``impi-devel`` python package) and the ``mpi4py`` python package. If using |intelex|
27+
via ``impi_rt`` python package) and the |mpi4py| python package. If using |intelex|
2628
`installed from sources <https://github.com/uxlfoundation/scikit-learn-intelex/blob/main/INSTALL.md#build-from-sources>`_,
2729
ensure that the spmd_backend is built.
2830

29-
Note that |intelex| now supports GPU offloading to speed up MPI operations. This is supported automatically with
30-
some MPI backends, but in order to use GPU offloading with Intel MPI, set the following environment variable (providing
31+
.. important::
32+
SMPD mode requires the |mpi4py| package used at runtime to be compiled with the same MPI backend as the |intelex|. The PyPI and Conda distributions of |intelex| both use Intel's MPI as backend, and hence require an |mpi4py| also built with Intel's MPI - it can be easily installed from Intel's conda channel as follows::
33+
34+
conda install -c https://software.repos.intel.com/python/conda/ mpi4py
35+
36+
It also requires the MPI runtime executable (``mpiexec`` / ``mpirun``) to be from the same library that was used to compile the |intelex| - Intel's MPI runtime library is offered as a Python package ``impi_rt`` and will be installed together with the ``mpi4py`` package if executing the command above, but otherwise, it can be installed separately from different distribution channels:
37+
38+
- Intel's conda channel (recommended)::
39+
40+
conda install -c https://software.repos.intel.com/python/conda/ impi_rt
41+
42+
- Conda-Forge::
43+
44+
conda install -c conda-forge impi_rt
45+
46+
- PyPI (not recommended, might require setting additional environment variables)::
47+
48+
pip install impi_rt
49+
50+
Using other MPI backends (e.g. OpenMPI) requires building |intelex| from source with that backend.
51+
52+
Note that |intelex| supports GPU offloading to speed up MPI operations. This is supported automatically with
53+
some MPI backends, but in order to use GPU offloading with Intel MPI, it is required to set the environment variable ``I_MPI_OFFLOAD`` to ``1`` (providing
3154
data on device without this may lead to a runtime error):
3255

33-
::
56+
- On Linux*::
57+
58+
export I_MPI_OFFLOAD=1
59+
60+
- On Windows*::
61+
62+
set I_MPI_OFFLOAD=1
63+
64+
SMPD-aware versions of estimators can be imported from the ``sklearnex.spmd`` module. Data should be distributed across multiple nodes as
65+
desired, and should be transfered to a |dpctl| or `dpnp <https://github.com/IntelPython/dpnp>`__ array before being passed to the estimator.
66+
67+
Note that SPMD estimators allow an additional argument ``queue`` in their ``.fit`` / ``.predict`` methods, which accept :obj:`dpctl.SyclQueue` objects. For example, while the signature for :obj:`sklearn.linear_model.LinearRegression.predict` would be
68+
69+
.. code-block:: python
70+
71+
def predict(self, X): ...
72+
73+
The signature for the corresponding predict method in ``sklearnex.spmd.linear_model.LinearRegression.predict`` is:
74+
75+
.. code-block:: python
76+
77+
def predict(self, X, queue=None): ...
78+
79+
Examples of SPMD usage can be found in the GitHub repository for the |intelex| under `examples/sklearnex <https://github.com/uxlfoundation/scikit-learn-intelex/blob/main/examples/sklearnex>`__.
3480

35-
export I_MPI_OFFLOAD=1
81+
To run on SPMD mode, first create a python file using SPMD estimators from ``sklearnex.spmd``, such as `linear_regression_spmd.py <https://github.com/uxlfoundation/scikit-learn-intelex/blob/main/examples/sklearnex/linear_regression_spmd.py>`__.
3682

37-
Estimators can be imported from the ``sklearnex.spmd`` module. Data should be distributed across multiple nodes as
38-
desired, and should be transfered to a dpctl or dpnp array before being passed to the estimator. View a full
39-
example of this process in the |intelex| repository, where many examples of our SPMD-supported estimators are
40-
available: https://github.com/uxlfoundation/scikit-learn-intelex/blob/main/examples/sklearnex/. To run:
83+
Then, execute the file through MPI under multiple ranks - for example:
4184

42-
::
85+
- On Linux*::
86+
87+
mpirun -n 4 python linear_regression_spmd.py
4388

44-
mpirun -n 4 python linear_regression_spmd.py
89+
- On Windows*::
90+
91+
mpiexec -n 4 python linear_regression_spmd.py
4592

46-
Note that additional mpirun arguments can be added as desired. SPMD-supported estimators are listed in the
47-
`algorithms support documentation <https://uxlfoundation.github.io/scikit-learn-intelex/latest/algorithms.html#spmd-support>`_.
93+
Note that additional ``mpirun`` arguments can be added as desired. SPMD-supported estimators are listed in the :ref:`spmd-support` section.
4894

49-
Additionally, daal4py offers some distributed functionality, see
95+
Additionally, ``daal4py`` (previously a separate package, now an importable module within ``scikit-learn-intelex``) offers some distributed functionality, see
5096
`documentation <https://intelpython.github.io/daal4py/scaling.html>`_ for further details.

doc/sources/index.rst

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,28 @@
1212
.. See the License for the specific language governing permissions and
1313
.. limitations under the License.
1414
15-
.. |intelex_repo| replace:: |intelex| repository
16-
.. _intelex_repo: https://github.com/uxlfoundation/scikit-learn-intelex
15+
.. include:: substitutions.rst
1716

1817
.. _index:
1918

2019
#########
2120
|intelex|
2221
#########
2322

24-
Intel(R) Extension for Scikit-learn is a **free software AI accelerator** designed to deliver up to **100X** faster performance for your existing scikit-learn code.
23+
|intelex| is a **free software AI accelerator** designed to deliver up to **100X** faster performance for your existing |sklearn| code.
2524
The software acceleration is achieved with vector instructions, AI hardware-specific memory optimizations, threading, and optimizations for all upcoming Intel(R) platforms at launch time.
2625

2726
.. rubric:: Designed for Data Scientists and Framework Designers
2827

2928

30-
Use Intel(R) Extension for Scikit-learn, to:
29+
Use |intelex|, to:
3130

32-
* Speed up training and inference by up to 100x with the equivalent mathematical accuracy
33-
* Benefit from performance improvements across different x86-compatible CPUs or Intel(R) GPUs
34-
* Integrate the extension into your existing Scikit-learn applications without code modifications
31+
* Speed up training and inference by up to 100x with equivalent mathematical accuracy
32+
* Benefit from performance improvements across different x86-64 CPUs and Intel(R) GPUs
33+
* Integrate the extension into your existing |sklearn| applications without code modifications
3534
* Enable and disable the extension with a couple of lines of code or at the command line
3635

37-
Intel(R) Extension for Scikit-learn is also a part of `Intel(R) AI Tools <https://www.intel.com/content/www/us/en/developer/tools/oneapi/ai-analytics-toolkit.html>`_.
36+
|intelex| is also a part of `Intel(R) AI Tools <https://www.intel.com/content/www/us/en/developer/tools/oneapi/ai-analytics-toolkit.html>`_.
3837

3938

4039
.. image:: _static/scikit-learn-acceleration.PNG
@@ -65,11 +64,14 @@ Enable Intel(R) CPU Optimizations
6564
from sklearn.cluster import DBSCAN
6665

6766
X = np.array([[1., 2.], [2., 2.], [2., 3.],
68-
[8., 7.], [8., 8.], [25., 80.]], dtype=np.float32)
67+
[8., 7.], [8., 8.], [25., 80.]], dtype=np.float32)
6968
clustering = DBSCAN(eps=3, min_samples=2).fit(X)
7069

7170
Enable Intel(R) GPU optimizations
7271
*********************************
72+
73+
Note: executing on GPU has `additional system software requirements <https://www.intel.com/content/www/us/en/developer/articles/system-requirements/intel-oneapi-dpcpp-system-requirements.html>`__ - see :doc:`oneapi-gpu`.
74+
7375
::
7476

7577
import numpy as np
@@ -80,7 +82,7 @@ Enable Intel(R) GPU optimizations
8082
from sklearn.cluster import DBSCAN
8183

8284
X = np.array([[1., 2.], [2., 2.], [2., 3.],
83-
[8., 7.], [8., 8.], [25., 80.]], dtype=np.float32)
85+
[8., 7.], [8., 8.], [25., 80.]], dtype=np.float32)
8486
with config_context(target_offload="gpu:0"):
8587
clustering = DBSCAN(eps=3, min_samples=2).fit(X)
8688

@@ -101,7 +103,7 @@ Enable Intel(R) GPU optimizations
101103
:maxdepth: 2
102104

103105
algorithms.rst
104-
oneAPI and GPU support <oneapi-gpu.rst>
106+
oneapi-gpu.rst
105107
distributed-mode.rst
106108
non-scikit-algorithms.rst
107109
input-types.rst

0 commit comments

Comments
 (0)