Skip to content

Commit b3d6cdc

Browse files
author
Diptorup Deb
authored
Merge pull request #1097 from IntelPython/docs/release-0.20-rev01
More revisions and additions to the documentation
2 parents 4d4fc12 + 174b4f7 commit b3d6cdc

35 files changed

+765
-392
lines changed

docs/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ help:
1818
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
1919
%: Makefile
2020
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21+
22+
clean:
23+
rm -rf "$(BUILDDIR)"

docs/backups/docker.rst

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
.. _docker:
21
.. include:: ./../ext_links.txt
32

43
Docker Support
54
==============
65

7-
Numba dpex now delivers docker support.
8-
Dockerfile is capable of building numba-dpex as well as direct dependencies for it:
9-
dpctl and dpnp.
10-
There are several prebuilt images available: for trying numba_dpex and
11-
for building numba-dpex.
6+
Numba dpex now delivers docker support. Dockerfile is capable of building
7+
numba-dpex as well as direct dependencies for it: dpctl and dpnp. There are
8+
several prebuilt images available: for trying numba_dpex and for building
9+
numba-dpex.
1210

1311
Building
1412
--------
1513

16-
Numba dpex ships with multistage Dockerfile, which means there are
17-
different `targets <https://docs.docker.com/build/building/multi-stage/#stop-at-a-specific-build-stage>`_ available for build. The most useful ones:
14+
Numba dpex ships with multistage Dockerfile, which means there are different
15+
`targets
16+
<https://docs.docker.com/build/building/multi-stage/#stop-at-a-specific-build-stage>`_
17+
available for build. The most useful ones:
1818

19-
- runtime
20-
- runtime-gpu
21-
- numba-dpex-builder-runtime
22-
- numba-dpex-builder-runtime-gpu
19+
- ``runtime``
20+
- ``runtime-gpu``
21+
- ``numba-dpex-builder-runtime``
22+
- ``numba-dpex-builder-runtime-gpu``
2323

2424
To build docker image
2525

@@ -36,28 +36,30 @@ To run docker image
3636
3737
.. note::
3838

39-
If you are building docker image with gpu support it will calls github api to get
40-
latest versions of intel gpu drivers. You may face Github API call limits. To avoid
41-
this, you can pass your github credentials to increase this limit. You can do it
42-
by providing
43-
`build args <https://docs.docker.com/engine/reference/commandline/build/#build-arg>`_
44-
``GITHUB_USER`` and ``GITHUB_PASSWORD``. You can use
45-
`access token <https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token>`
39+
If you are building docker image with gpu support it will calls github api
40+
to get latest versions of intel gpu drivers. You may face Github API call
41+
limits. To avoid this, you can pass your github credentials to increase this
42+
limit. You can do it by providing `build args
43+
<https://docs.docker.com/engine/reference/commandline/build/#build-arg>`_
44+
``GITHUB_USER`` and ``GITHUB_PASSWORD``. You can use `access token
45+
<https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token>`_
4646
instead of the password:
4747

4848
.. note::
4949

50-
In case you are building docker image behind firewall and your internet access
51-
requires proxy, you can provide proxy
52-
`build args <https://docs.docker.com/engine/reference/commandline/build/#build-arg>`_
53-
``http_proxy`` and ``https_proxy``. Please note, that these args must be lowercase.
50+
In case you are building docker image behind firewall and your internet
51+
access requires proxy, you can provide proxy `build args
52+
<https://docs.docker.com/engine/reference/commandline/build/#build-arg>`_
53+
``http_proxy`` and ``https_proxy``. Please note, that these args must be
54+
lowercase.
5455

55-
Dockerfile supports different python versions. To select the one you want, simply set
56-
``PYTHON_VERSION`` build arg. By default docker image is based on official python image
57-
based on slim debian, so the requested python version must be from the available python
58-
docker images. In case you want to build on images on custom image you have to pass
59-
``BASE_IMAGE`` environment variable. Be aware that Dockerfile is based on debian so any
60-
base image should be debian based, like debian or ubuntu.
56+
Dockerfile supports different python versions. To select the one you want,
57+
simply set ``PYTHON_VERSION`` build arg. By default docker image is based on
58+
official python image based on slim debian, so the requested python version must
59+
be from the available python docker images. In case you want to build on images
60+
on custom image you have to pass ``BASE_IMAGE`` environment variable. Be aware
61+
that Dockerfile is based on debian so any base image should be debian based,
62+
like debian or ubuntu.
6163

6264
Build arguments that could be useful:
6365

@@ -90,8 +92,8 @@ Refer to Dockerfile to see all available
9092
Running prebuilt images
9193
-----------------------
9294

93-
An easy way you can try ``numba_dpex`` is by using prebuilt images.
94-
There are several prebuilt images available:
95+
An easy way you can try ``numba_dpex`` is by using prebuilt images. There are
96+
several prebuilt images available:
9597

9698
- ``runtime`` package that provides runtime experience
9799
.. code-block:: text
@@ -103,7 +105,8 @@ There are several prebuilt images available:
103105
104106
ghcr.io/intelpython/numba-dpex/builder:<numba_dpex_version>-py<python_version>[-gpu]
105107
106-
- you can also see ``stages`` package, but it is used mostly for building stages.
108+
- you can also see ``stages`` package, but it is used mostly for building
109+
stages.
107110
You can use them to build your own docker that is built on top of one of them.
108111

109112
To try out numba dpex simply run:
@@ -126,13 +129,15 @@ or
126129
127130
.. note::
128131

129-
If you want to enable GPU you need to pass it within container and use ``*-gpu`` tag.
132+
If you want to enable GPU you need to pass it within container and use
133+
``*-gpu`` tag.
130134

131135
For passing GPU into container on linux use arguments ``--device=/dev/dri``.
132-
However if you are using WSL you need to pass
133-
``--device=/dev/dxg -v /usr/lib/wsl:/usr/lib/wsl`` instead.
136+
However if you are using WSL you need to pass ``--device=/dev/dxg -v
137+
/usr/lib/wsl:/usr/lib/wsl`` instead.
134138

135-
So, for example, if you want to run numba dpex container with GPU support on WSL:
139+
So, for example, if you want to run numba dpex container with GPU support on
140+
WSL:
136141

137142
.. code-block:: bash
138143
File renamed without changes.
File renamed without changes.

docs/make.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,8 @@ goto end
3131
:help
3232
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
3333

34+
:clean
35+
rd /s %BUILDDIR%
36+
3437
:end
3538
popd

docs/source/api_reference/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44

55
API Reference
66
=============
7+
8+
Coming soon

docs/source/ext_links.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@
2424
.. _Data Parallel Extensions for Python*: https://intelpython.github.io/DPEP/main/
2525
.. _Intel VTune Profiler: https://www.intel.com/content/www/us/en/developer/tools/oneapi/vtune-profiler.html
2626
.. _Intel Advisor: https://www.intel.com/content/www/us/en/developer/tools/oneapi/advisor.html
27+
.. _oneMKL: https://www.intel.com/content/www/us/en/docs/oneapi/programming-guide/2023-2/intel-oneapi-math-kernel-library-onemkl.html

docs/source/getting_started.rst

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,40 @@ Getting Started
99
===============
1010

1111

12-
Installing pre-built packages
13-
-----------------------------
12+
Installing pre-built conda packages
13+
-----------------------------------
1414

1515
``numba-dpex`` along with its dependencies can be installed using ``conda``.
1616
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.
17+
to get the latest production releases.
1918

2019
.. code-block:: bash
2120
22-
conda create -n numba-dpex-env numba-dpex dpnp dpctl dpcpp-llvm-spirv spirv-tools -c intel -c conda-forge
21+
conda create -n numba-dpex-env \
22+
numba-dpex dpnp dpctl dpcpp-llvm-spirv spirv-tools \
23+
-c intel -c conda-forge
24+
25+
To try out the bleeding edge, the latest packages built from tip of the main
26+
source trunk can be installed from the ``dppy/label/dev`` conda channel.
27+
28+
.. code-block:: bash
29+
30+
conda create -n numba-dpex-env \
31+
numba-dpex dpnp dpctl dpcpp-llvm-spirv spirv-tools \
32+
-c dppy/label/dev -c intel -c conda-forge
33+
34+
2335
2436
Building from source
2537
--------------------
2638

27-
``numba-dpex`` can be built from source using either ``conda-build`` or ``setuptools``.
39+
``numba-dpex`` can be built from source using either ``conda-build`` or
40+
``setuptools``.
2841

2942
Steps to build using ``conda-build``:
3043

31-
1. Create a conda environment
44+
1. Ensure ``conda-build`` is installed in the ``base`` conda environment or
45+
create a new conda environment with ``conda-build`` installed.
3246

3347
.. code-block:: bash
3448
@@ -45,22 +59,34 @@ Steps to build using ``conda-build``:
4559

4660
.. code-block:: bash
4761
48-
conda install numba-dpex
62+
conda install -c local numba-dpex
4963
5064
Steps to build using ``setup.py``:
5165

66+
As before, a conda environment with all necessary dependencies is the suggested
67+
first step.
68+
5269
.. code-block:: bash
5370
54-
conda create -n numba-dpex-env dpctl dpnp numba spirv-tools dpcpp-llvm-spirv llvmdev pytest -c intel -c conda-forge
71+
# Create a conda environment that hass needed dependencies installed
72+
conda create -n numba-dpex-env \
73+
dpctl dpnp numba spirv-tools dpcpp-llvm-spirv llvmdev pytest \
74+
-c intel -c conda-forge
75+
# Activate the environment
5576
conda activate numba-dpex-env
77+
# Clone the numba-dpex repository
78+
git clone https://github.com/IntelPython/numba-dpex.git
79+
cd numba-dpex
80+
python setup.py develop
5681
5782
Building inside Docker
5883
----------------------
5984

60-
A Dockerfile is provided on the GitHub repository to easily build ``numba-dpex``
85+
A Dockerfile is provided on the GitHub repository to build ``numba-dpex``
6186
as well as its direct dependencies: ``dpctl`` and ``dpnp``. Users can either use
6287
one of the pre-built images on the ``numba-dpex`` GitHub page or use the
63-
bundled Dockerfile to build ``numba-dpex`` from source.
88+
bundled Dockerfile to build ``numba-dpex`` from source. Using the Dockerfile
89+
also ensures that all device drivers and runtime libraries are pre-installed.
6490

6591
Building
6692
~~~~~~~~
@@ -69,10 +95,10 @@ Numba dpex ships with multistage Dockerfile, which means there are
6995
different `targets <https://docs.docker.com/build/building/multi-stage/#stop-at-a-specific-build-stage>`_
7096
available for build. The most useful ones:
7197

72-
- runtime
73-
- runtime-gpu
74-
- numba-dpex-builder-runtime
75-
- numba-dpex-builder-runtime-gpu
98+
- ``runtime``
99+
- ``runtime-gpu``
100+
- ``numba-dpex-builder-runtime``
101+
- ``numba-dpex-builder-runtime-gpu``
76102

77103
To build docker image
78104

@@ -96,7 +122,7 @@ To run docker image
96122
``GITHUB_USER`` and ``GITHUB_PASSWORD``
97123
`build args <https://docs.docker.com/engine/reference/commandline/build/#build-arg>`_
98124
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>`
125+
`access token <https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token>`_
100126
can also be used instead of the password.
101127

102128
.. note::

docs/source/overview.rst

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ implementation of `NumPy*`_'s API using the `SYCL*`_ language.
1515
.. the same time automatically running such code parallelly on various types of
1616
.. architecture.
1717
18-
``numba-dpex`` is developed as part of `Intel AI Analytics Toolkit`_ and
19-
is distributed with the `Intel Distribution for Python*`_. The extension is
20-
available on Anaconda cloud and as a Docker image on GitHub. Please refer the
21-
:doc:`getting_started` page to learn more.
18+
``numba-dpex`` is an open-source project and can be installed as part of `Intel
19+
AI Analytics Toolkit`_ or the `Intel Distribution for Python*`_. The package is
20+
also available on Anaconda cloud and as a Docker image on GitHub. Please refer
21+
the :doc:`getting_started` page to learn more.
2222

2323
Main Features
2424
-------------
2525

2626
Portable Kernel Programming
2727
~~~~~~~~~~~~~~~~~~~~~~~~~~~
2828

29-
The ``numba-dpex`` kernel API has a design and API similar to Numba's
29+
The ``numba-dpex`` kernel programming API has a design similar to Numba's
3030
``cuda.jit`` sub-module. The API is modeled after the `SYCL*`_ language and uses
3131
the `DPC++`_ SYCL runtime. Currently, compilation of kernels is supported for
3232
SPIR-V-based OpenCL and `oneAPI Level Zero`_ devices CPU and GPU devices. In the
33-
future, the API can be extended to other architectures that are supported by
34-
DPC++.
33+
future, compilation support for other types of hardware that are supported by
34+
DPC++ will be added.
3535

3636
The following example illustrates a vector addition kernel written with
3737
``numba-dpex`` kernel API.
@@ -56,31 +56,33 @@ The following example illustrates a vector addition kernel written with
5656
print(c)
5757
5858
In the above example, three arrays are allocated on a default ``gpu`` device
59-
using the ``dpnp`` library. These arrays are then passed as input arguments to
60-
the kernel function. The compilation target and the subsequent execution of the
61-
kernel is determined completely by the input arguments and follow the
59+
using the ``dpnp`` library. The arrays are then passed as input arguments to the
60+
kernel function. The compilation target and the subsequent execution of the
61+
kernel is determined by the input arguments and follow the
6262
"compute-follows-data" programming model as specified in the `Python* Array API
6363
Standard`_. To change the execution target to a CPU, the device keyword needs to
6464
be changed to ``cpu`` when allocating the ``dpnp`` arrays. It is also possible
6565
to leave the ``device`` keyword undefined and let the ``dpnp`` library select a
6666
default device based on environment flag settings. Refer the
6767
:doc:`user_guide/kernel_programming/index` for further details.
6868

69-
``dpnp`` compilation support
70-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71-
72-
``numba-dpex`` extends Numba's type system and compilation pipeline to compile
73-
``dpnp`` functions and expressions in the same way as NumPy. Unlike Numba's
74-
NumPy compilation that is serial by default, ``numba-dpex`` always compiles
75-
``dpnp`` expressions into data-parallel kernels and executes them in parallel.
76-
The ``dpnp`` compilation feature is provided using a decorator ``dpjit`` that
77-
behaves identically to ``numba.njit(parallel=True)`` with the addition of
78-
``dpnp`` compilation and kernel offloading. Offloading by ``numba-dpex`` is not
79-
just restricted to CPUs and supports all devices that are presently supported by
80-
the kernel API. ``dpjit`` allows using NumPy and ``dpnp`` expressions in the
81-
same function. All NumPy compilation and parallelization is done via the default
82-
Numba code-generation pipeline, whereas ``dpnp`` expressions are compiled using
83-
the ``numba-dpex`` pipeline.
69+
``dpjit`` decorator
70+
~~~~~~~~~~~~~~~~~~~
71+
72+
The ``numba-dpex`` package provides a new decorator ``dpjit`` that extends
73+
Numba's ``njit`` decorator. The new decorator is equivalent to
74+
``numba.njit(parallel=True)``, but additionally supports compiling ``dpnp``
75+
functions, ``prange`` loops, and array expressions that use ``dpnp.ndarray``
76+
objects.
77+
78+
Unlike Numba's NumPy parallelization that only supports CPUs, ``dpnp``
79+
expressions are first converted to data-parallel kernels and can then be
80+
`offloaded` to different types of devices. As ``dpnp`` implements the same API
81+
as NumPy*, an existing ``numba.njit`` decorated function that uses
82+
``numpy.ndarray`` may be refactored to use ``dpnp.ndarray`` and decorated with
83+
``dpjit``. Such a refactoring can allow the parallel regions to be offloaded
84+
to a supported GPU device, providing users an additional option to execute their
85+
code parallelly.
8486

8587
The vector addition example depicted using the kernel API can also be
8688
expressed in several different ways using ``dpjit``.

0 commit comments

Comments
 (0)