Skip to content

Commit b11bf0c

Browse files
Rewrite of installation guide to consolidate it into one page.
1 parent e967319 commit b11bf0c

File tree

4 files changed

+199
-1
lines changed

4 files changed

+199
-1
lines changed

docs/doc_sources/beginners_guides/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Introduction to array library
2828
.. toctree::
2929
:hidden:
3030

31-
_installation
31+
installation
3232
_parallelisms
3333
_why_dpctl
3434
_enumerating_devices
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
.. _dpctl_installation:
2+
3+
####################
4+
Installing ``dpctl``
5+
####################
6+
7+
License
8+
=======
9+
10+
:py:mod:`dpctl` is licensed under Apache License 2.0 that can be found in
11+
`LICENSE <dpctl_license_>`_ file.
12+
All usage and contributions to the project are subject to the terms and
13+
conditions of this license.
14+
15+
.. _dpctl_license: https://github.com/IntelPython/dpctl/blob/master/LICENSE
16+
17+
Installation using conda
18+
========================
19+
20+
Binary builds of :py:mod:`dpctl` are available for the `conda package manager <conda_docs_>`_
21+
ecosystem.
22+
23+
.. _conda_docs: https://docs.conda.io/projects/conda/en/stable/
24+
25+
Released versions of the package can be installed from Intel channel, as
26+
indicated by ``--channel intel`` option:
27+
28+
.. code-block:: bash
29+
:caption: Getting latest released version of ``dpctl`` using conda
30+
31+
conda create --name dpctl_env --channel intel dpctl
32+
33+
Development builds of ``dpctl`` can be accessed from ``dppy/label/dev`` channel:
34+
35+
.. code-block:: bash
36+
:caption: Getting latest development version
37+
38+
conda create -n dpctl_nightly -c dppy/label/dev -c intel dpctl
39+
40+
.. note::
41+
In case :py:mod:`dpctl` is not available for the Python version of interest,
42+
please check `Building from source`_ section.
43+
44+
45+
Installation using pip
46+
======================
47+
48+
Binary wheels are published with Python Package Index (https://pypi.org/project/dpctl/).
49+
50+
.. code-block:: bash
51+
:caption: Getting latest released version of ``dpctl`` using ``pip``
52+
53+
python -m pip install dpctl
54+
55+
Binary wheels of ``dpctl`` and its dependencies are also published on
56+
http://anaconda.org/intel. To install from this non-default package index,
57+
use
58+
59+
.. code-block:: bash
60+
61+
python -m pip install --index-url https://pypi.anaconda.org/intel/simple dpctl
62+
63+
.. note::
64+
Installation using ``pip`` on Linux currently (as of April 2024) requires
65+
that host operating system had ``libstdc++.so`` library version 6.0.29
66+
or later. Check the version you have by executing
67+
``find /lib/x86_64-linux-gnu/ -name "libstdc++*"``
68+
69+
.. note::
70+
In case :py:mod:`dpctl` is not available for the Python version of interest,
71+
please check `Building from source`_ section.
72+
73+
74+
Installation via Intel(R) Distribution for Python
75+
=================================================
76+
77+
`Intel(R) Distribution for Python* <idp_page_>`_ is distributed as a conda-based installer
78+
and includes :py:mod:`dpctl` along with its dependencies and sister projects :py:mod:`dpnp`
79+
and :py:mod:`numba_dpex`.
80+
81+
.. _idp_page: https://www.intel.com/content/www/us/en/developer/tools/oneapi/distribution-for-python.html
82+
83+
Once the installed environment is activated, ``dpctl`` should be ready to use.
84+
85+
System requirements
86+
===================
87+
88+
Since :py:mod:`dpctl` is compiled using Intel(R) oneAPI DPC++ compiler,
89+
the `compiler's system requirements for runtime <dpcpp_system_reqs_>`_ must be met.
90+
91+
In order for DPC++ runtime to recognize supported hardware appropriate drivers must be installed.
92+
Directions to install drivers for Intel GPU devices are available at https://dgpu-docs.intel.com/
93+
94+
.. _dpcpp_system_reqs: https://www.intel.com/content/www/us/en/developer/articles/system-requirements/intel-oneapi-dpcpp-system-requirements.html
95+
96+
Once ``dpctl`` is installed, use ``python -m dpctl --full-list`` to list recognized devices.
97+
98+
For ``dpctl`` to target Intel GPU devices, appropriate drivers should be installed systemwide.
99+
Please refer to `GPU installation guide <gpu_stack_installation_guide_>`_ for detailed
100+
instructions on how to install required drivers on Linux.
101+
102+
.. _gpu_stack_installation_guide: https://dgpu-docs.intel.com/
103+
104+
.. note::
105+
Instructions for setting up GPU drivers in Windows Subsytem for Linux is forthcoming.
106+
107+
Building from source
108+
====================
109+
110+
There are several reasons to want to build ``dpctl`` from source:
111+
112+
1. To use it with Python version for which binary artifacts are not available
113+
2. To be able to use DPC++ runtime libraries from local installation of DPC++ compiler and
114+
avoid installing them into Python environment
115+
3. To build for custom SYCL targets, such as ``nvptx64-nvidia-cuda`` or ``"amdgcn-amd-amdhsa"``.
116+
117+
Building locally for use with oneAPI DPC++ installation
118+
-------------------------------------------------------
119+
120+
Working with :py:mod:`dpctl` in this mode assumes that the DPC++ compiler is activated, and that
121+
Python environment has all build and runtime dependencies of ``dpctl`` installed.
122+
123+
One way to create such environment is as follows:
124+
125+
.. code-block:: bash
126+
:caption: Creation of environment to build ``dpctl`` locally
127+
128+
conda create -n dev_dpctl -c conda-forge python=3.12 pip
129+
conda activate dev_dpctl
130+
pip install --no-cache-dir numpy cython scikit-build cmake ninja pytest
131+
132+
Using such environment and with DPC++ compiler activated, build the project using
133+
134+
.. code-block:: bash
135+
136+
python scripts/build_locally.py --verbose
137+
138+
.. note::
139+
Coming back to use this local build of ``dpctl`` remember to activate DPC++.
140+
141+
Building for custom SYCL targets
142+
--------------------------------
143+
144+
Project :py:mod:`dpctl` is written using generic SYCL and supports building for
145+
multiple SYCL targets, subject to limitations of `CodePlay <https://codeplay.com/>`_
146+
plugins implementing SYCL programming model for classes of devices.
147+
148+
Building ``dpctl`` for these targets requires that these CodePlay plugins be
149+
installed into DPC++ installation layout of compatible version.
150+
The following plugins from CodePlay are supported:
151+
152+
- `oneAPI for NVIDIA(R) GPUs <codeplay_nv_plugin_>`_
153+
- `oneAPI for AMD GPUs <codeplay_amd_plugin_>`_
154+
155+
.. _codeplay_nv_plugin: https://developer.codeplay.com/products/oneapi/nvidia/
156+
.. _codeplay_amd_plugin: https://developer.codeplay.com/products/oneapi/amd/
157+
158+
Build ``dpctl`` as follows:
159+
160+
.. code-block:: bash
161+
162+
python scripts/build_locally.py --verbose --cmake-opts="-DDPCTL_TARGET_CUDA=ON"
163+
164+
165+
Running Examples and Tests
166+
==========================
167+
168+
Running the Examples
169+
--------------------
170+
171+
After setting up dpctl, you can test the Python examples as follows:
172+
173+
.. code-block:: bash
174+
175+
for script in `ls examples/python/`
176+
do
177+
echo "executing ${script}"
178+
python examples/python/${script}
179+
done
180+
181+
The :py:mod:`dpctl` repository also provides a set of `examples <examples_sources_>`_
182+
of building Cython and pybind11 extensions with the DPC++ compiler that interoperate
183+
with :py:mod:`dpctl`.
184+
185+
.. _examples_sources: https://github.com/IntelPython/dpctl/tree/master/examples/
186+
187+
Please refer to the ``README.md`` file in respective folders for instructions on how to build
188+
each example Python project and how to execute its test suite.
189+
190+
Running the Python Tests
191+
------------------------
192+
193+
You can execute Python test suite of :py:mod:`dpctl` as follow:
194+
195+
.. code-block:: bash
196+
197+
pytest --pyargs dpctl

docs/doc_sources/conf.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ extlinks = urlgen.create_extlinks()
112112
intersphinx_mapping = {
113113
"python": ("https://docs.python.org/3/", None),
114114
"numpy": ("https://docs.scipy.org/doc/numpy/", None),
115+
"dpnp": ("https://intelpython.github.io/dpnp/", None),
115116
"numba_dpex": ("https://intelpython.github.io/numba-dpex/latest/", None),
116117
"cython": ("https://docs.cython.org/en/latest/", None),
117118
}

0 commit comments

Comments
 (0)