@@ -9,73 +9,213 @@ Getting Started
9
9
===============
10
10
11
11
12
- Installation
13
- ------------
12
+ Installing pre-built packages
13
+ -----------------------------
14
14
15
- Numba-dpex depends on following components:
15
+ ``numba-dpex `` along with its dependencies can be installed using ``conda ``.
16
+ It is recommended to use conda packages from the ``anaconda.org/intel `` channel
17
+ to get the latest production releases. Nighly builds of ``numba-dpex `` are
18
+ available on the ``dppy/label/dev `` conda channel.
16
19
17
- * numba 0.57.*
18
- * dpctl 0.14.*
19
- * dpnp 0.11.*
20
- * dpcpp-cpp-rt
21
- * dpcpp-llvm-spirv
22
- * spirv-tools
23
-
24
- It is recommended to use conda packages from the ``anaconda.org/intel `` channel.
20
+ .. code-block :: bash
25
21
26
- Create conda environment:
22
+ conda create -n numba-dpex-env numba-dpex dpnp dpctl dpcpp-llvm-spirv spirv-tools -c intel -c conda-forge
27
23
28
- .. code-block :: bash
24
+ Building from source
25
+ --------------------
29
26
30
- conda create -n numba-dpex-env numba-dpex dpnp -c ${ONEAPI_ROOT} /conda_channel
27
+ `` numba-dpex `` can be built from source using either `` conda-build `` or `` setuptools ``.
31
28
32
- Build and Install Conda Package
33
- -------------------------------
29
+ Steps to build using ``conda-build ``:
34
30
35
- Create and activate conda build environment:
31
+ 1. Create a conda environment
36
32
37
33
.. code-block :: bash
38
34
39
35
conda create -n build-env conda-build
40
36
conda activate build-env
41
37
38
+ 2. Build using the vendored conda recipe
39
+
42
40
.. code-block :: bash
43
41
44
42
conda build conda-recipe -c intel -c conda-forge
45
43
46
- Install conda package:
44
+ 3. Install the conda package
47
45
48
46
.. code-block :: bash
49
47
50
48
conda install numba-dpex
51
49
52
- Build and Install with setuptools
53
- ---------------------------------
50
+ Steps to build using ``setup.py ``:
54
51
55
52
.. code-block :: bash
56
53
57
- conda create -n numba-dpex-env dpctl dpnp numba spirv-tools dpcpp-llvm-spirv llvmdev cython pytest -c intel -c conda-forge
54
+ conda create -n numba-dpex-env dpctl dpnp numba spirv-tools dpcpp-llvm-spirv llvmdev pytest -c intel -c conda-forge
58
55
conda activate numba-dpex-env
59
56
57
+ Building inside Docker
58
+ ----------------------
60
59
61
- Testing
62
- -------
60
+ A Dockerfile is provided on the GitHub repository to easily build ``numba-dpex ``
61
+ as well as its direct dependencies: ``dpctl `` and ``dpnp ``. Users can either use
62
+ one of the pre-built images on the ``numba-dpex `` GitHub page or use the
63
+ bundled Dockerfile to build ``numba-dpex `` from source.
64
+
65
+ Building
66
+ ~~~~~~~~
67
+
68
+ Numba dpex ships with multistage Dockerfile, which means there are
69
+ different `targets <https://docs.docker.com/build/building/multi-stage/#stop-at-a-specific-build-stage >`_
70
+ available for build. The most useful ones:
63
71
64
- See folder ``numba_dpex/tests ``.
72
+ - runtime
73
+ - runtime-gpu
74
+ - numba-dpex-builder-runtime
75
+ - numba-dpex-builder-runtime-gpu
65
76
66
- To run the tests:
77
+ To build docker image
67
78
68
79
.. code-block :: bash
69
80
70
- python -m pytest --pyargs numba_dpex.tests
81
+ docker build --target runtime -t numba-dpex:runtime ./
71
82
72
- Examples
73
- --------
74
83
75
- See folder ``numba_dpex/examples ``.
84
+ To run docker image
85
+
86
+ .. code-block :: bash
87
+
88
+ docker run -it --rm numba-dpex:runtime
89
+
90
+ .. note ::
91
+
92
+ When trying to build a docker image with Intel GPU support, the Dockerfile
93
+ will attempt to use the GitHub API to get the latest Intel GPU drivers.
94
+ Users may run into an issue related to Github API call limits. The issue
95
+ can be bypassed by providing valid GitHub credentials using the
96
+ ``GITHUB_USER `` and ``GITHUB_PASSWORD ``
97
+ `build args <https://docs.docker.com/engine/reference/commandline/build/#build-arg >`_
98
+ to increase the call limit. A GitHub
99
+ `access token <https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token> `
100
+ can also be used instead of the password.
101
+
102
+ .. note ::
103
+
104
+ When building the docker image behind a firewall the proxy server settings
105
+ should be provided using the ``http_proxy `` and ``https_proxy `` build args.
106
+ These build args must be specified in lowercase.
107
+
108
+ The bundled Dockerfile supports different python versions that can be specified
109
+ via the ``PYTHON_VERSION `` build arg. By default, the docker image is based on
110
+ the official python image based on slim debian. The requested python version
111
+ must be from the available python docker images.
112
+
113
+ The ``BASE_IMAGE `` build arg can be used to build the docker image from a
114
+ custom image. Note that as the Dockerfile is based on debian any custom base
115
+ image should be debian-based, like debian or ubuntu.
116
+
117
+ The list of other build args are as follows. Please refer the Dockerfile to
118
+ see currently all available build args.
119
+
120
+ - ``PYTHON_VERSION ``
121
+ - ``CR_TAG ``
122
+ - ``IGC_TAG ``
123
+ - ``CM_TAG ``
124
+ - ``L0_TAG ``
125
+ - ``ONEAPI_VERSION ``
126
+ - ``DPCTL_GIT_BRANCH ``
127
+ - ``DPCTL_GIT_URL ``
128
+ - ``DPNP_GIT_BRANCH ``
129
+ - ``DPNP_GIT_URL ``
130
+ - ``NUMBA_DPEX_GIT_BRANCH ``
131
+ - ``NUMBA_DPEX_GIT_URL ``
132
+ - ``CMAKE_VERSION ``
133
+ - ``CMAKE_VERSION_BUILD ``
134
+ - ``INTEL_NUMPY_VERSION ``
135
+ - ``INTEL_NUMBA_VERSION ``
136
+ - ``CYTHON_VERSION ``
137
+ - ``SCIKIT_BUILD_VERSION ``
138
+ - ``http_proxy ``
139
+ - ``https_proxy ``
140
+ - ``GITHUB_USER ``
141
+ - ``GITHUB_PASSWORD ``
142
+ - ``BASE_IMAGE ``
143
+
144
+
145
+ Using the pre-built images
146
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
147
+
148
+ There are several pre-built docker images available:
149
+
150
+ - ``runtime `` package that provides a pre-built environment with ``numba-dpex ``
151
+ already installed. It is ideal to quickly setup and try
152
+ ``numba-dpex ``.
153
+
154
+ .. code-block :: text
155
+
156
+ ghcr.io/intelpython/numba-dpex/runtime:<numba_dpex_version>-py<python_version>[-gpu]
157
+
158
+ - ``builder `` package that has all required dependencies pre-installed and is
159
+ ideal for building ``numba-dpex `` from source.
160
+
161
+ .. code-block :: text
162
+
163
+ ghcr.io/intelpython/numba-dpex/builder:<numba_dpex_version>-py<python_version>[-gpu]
76
164
77
- To run the examples:
165
+ - ``stages `` package primarily meant for creating a new docker image that is
166
+ built on top of one of the pre-built images.
167
+
168
+ After setting up the docker image, to run ``numba-dpex `` the following snippet
169
+ can be used.
170
+
171
+ .. code-block :: bash
172
+
173
+ docker run --rm -it ghcr.io/intelpython/numba-dpex/runtime:0.20.0-py3.10 bash
174
+
175
+ It is advisable to verify the SYCL runtime and driver installation within the
176
+ container by either running,
177
+
178
+ .. code-block :: bash
179
+
180
+ sycl-ls
181
+
182
+ or,
183
+
184
+ .. code-block :: bash
185
+
186
+ python -m dpctl -f
187
+
188
+ .. note ::
189
+
190
+ To enable GPU device, the ``device `` argument should be used and one of the
191
+ ``*-gpu `` images should be used.
192
+
193
+ For passing GPU into container on linux use arguments ``--device=/dev/dri ``.
194
+ However if you are using WSL you need to pass
195
+ ``--device=/dev/dxg -v /usr/lib/wsl:/usr/lib/wsl `` instead.
196
+
197
+ For example, to run ``numba-dpex `` with GPU support on WSL:
78
198
79
199
.. code-block :: bash
80
200
81
- python numba_dpex/examples/sum.py
201
+ docker run --rm -it \
202
+ --device=/dev/dxg -v /usr/lib/wsl:/usr/lib/wsl \
203
+ ghcr.io/intelpython/numba-dpex/runtime:0.20.0-py3.10-gpu
204
+
205
+
206
+
207
+ Testing
208
+ -------
209
+
210
+ ``numba-dpex `` uses pytest for unit testing and the following example
211
+ shows a way to run the unit tests.
212
+
213
+ .. code-block :: bash
214
+
215
+ python -m pytest --pyargs numba_dpex.tests
216
+
217
+ Examples
218
+ --------
219
+
220
+ A set of examples on how to use ``numba-dpex `` can be found in
221
+ ``numba_dpex/examples ``.
0 commit comments