|
9 | 9 | <br/> |
10 | 10 |
|
11 | 11 |
|
12 | | -# What? |
13 | 12 |
|
14 | | -The data-parallel extension to Numba (Numba-dpex) adds data-parallel kernel |
15 | | -programming and auto-offload capabilities to [Numba](http://numba.pydata.org). |
16 | | -The extension uses the Intel® DPC++ runtime and supports various OpenCL and |
17 | | -Level Zero devices. Refer the [user |
18 | | -guide](https://intelpython.github.io/numba-dpex/) for more details. |
| 13 | +Data-parallel Extension for Numba* (numba-dpex) is a standalone extension for |
| 14 | +the [Numba](http://numba.pydata.org) Python JIT compiler. Numba-dpex provides |
| 15 | +a generic kernel programming API and an offload feature that extends Numba's |
| 16 | +auto-parallelizer to generate data-parallel kernels for `parfor` nodes. |
19 | 17 |
|
20 | | -# Installing |
| 18 | +Numba-dpex's kernel API has a design and API similar to Numba's `cuda.jit` |
| 19 | +module, but is based on the [SYCL](https://sycl.tech/) language. The |
| 20 | +code-generation for the kernel API currently supports |
| 21 | +[SPIR-V](https://www.khronos.org/spir/)-based |
| 22 | +[OpenCL](https://www.khronos.org/opencl/) and |
| 23 | +[oneAPI Level Zero](https://spec.oneapi.io/level-zero/latest/index.html) |
| 24 | +devices that are supported by Intel® DPC++ SYCL compiler runtime. Supported |
| 25 | +devices include Intel® CPUs, integrated GPUs and discrete GPUs. |
| 26 | + |
| 27 | +The offload functionality in numba-dpex is based on Numba's `parfor` |
| 28 | +loop-parallelizer. Our compiler extends Numba's `parfor` feature to generate |
| 29 | +kernels and offload them to devices supported by DPC++ SYCL compiler runtime. |
| 30 | +The offload functionality is supported via a new NumPy drop-in replacement |
| 31 | +library: [dpnp](https://github.com/IntelPython/dpnp) and NumPy-based expressions |
| 32 | +and `numba.prange` loops are not offloaded. |
| 33 | + |
| 34 | +Refer the [documentation](https://intelpython.github.io/numba-dpex) and examples |
| 35 | +to learn more. |
| 36 | + |
| 37 | +## Getting Started |
21 | 38 |
|
22 | 39 | Numba-dpex is part of the Intel® Distribution of Python (IDP) and Intel® |
23 | | -oneAPI BaseKit, and can be installed along with oneAPI. Additionally, we support |
24 | | -installing it from Anaconda cloud and PyPi. Please refer the instructions |
| 40 | +oneAPI AIKit, and can be installed along with oneAPI. Additionally, we support |
| 41 | +installing it from Anaconda cloud. Please refer the instructions |
25 | 42 | on our [documentation page](https://intelpython.github.io/numba-dpex/latest/user_guides/getting_started.html) |
26 | 43 | for more details. |
27 | 44 |
|
28 | | -# Getting started |
29 | | - |
30 | | -A good starting point is to run the test suite that includes the unit tests |
31 | | -inside the **numba_dpex/tests** module. To run the tests, invoke: |
| 45 | +Once the package is installed, a good starting point is to run the examples in |
| 46 | +the `numba_dpex/examples` directory. The test suite may also be invoked as |
| 47 | +follows: |
32 | 48 |
|
33 | 49 | ```bash |
34 | 50 | python -m pytest --pyargs numba_dpex.tests |
35 | 51 | ``` |
36 | | -or |
37 | | -```bash |
38 | | -pytest |
39 | | -``` |
40 | | -Once you run the tests and make sure your numba-dpex installation is up and |
41 | | -running, try out the examples inside the **numba_dpex/examples** folder. For |
42 | | -example, you can try the `vector addition` example as follows: |
43 | | -```bash |
44 | | -python numba_dpex/examples/sum.py |
45 | | -``` |
46 | | - |
47 | | -# Known Issue |
48 | | -Floor division operator `//` is not supported inside the `numba_dpex.kernel` |
49 | | -kernel programming API. The below code snippet will result in error reported in |
50 | | -this [Issue](https://github.com/IntelPython/numba-dpex/issues/571). |
51 | | - |
52 | | -``` |
53 | | -import numpy as np, numba_dpex |
54 | | -@numba_dpex.kernel |
55 | | -def div_kernel(dst, src, m): |
56 | | - i = numba_dpex.get_global_id(0) |
57 | | - dst[i] = src[i] // m |
58 | | -
|
59 | | -import dpctl |
60 | | -with dpctl.device_context(dpctl.SyclQueue()): |
61 | | - X = np.arange(10) |
62 | | - Y = np.arange(10) |
63 | | - div_kernel[10, numba_dpex.DEFAULT_LOCAL_SIZE](Y, X, 5) |
64 | | - D = X//5 |
65 | | - print(Y, D) |
66 | | -``` |
67 | | - |
68 | | -To bypass this issue, the `llvm-spirv` tool from the `dpcpp` conda package needs |
69 | | -to be used. |
70 | | - |
71 | | -For linux: `conda install dpcpp_linux-64` |
72 | | -For Windows: `conda install dpcpp_win-64` |
73 | | - |
74 | | -# Learn more? |
75 | | - |
76 | | -Detailed documentation including user guides are hosted on our |
77 | | -[documentation site](https://intelpython.github.io/numba-dpex). |
78 | | - |
79 | | -# Found a bug? |
80 | 52 |
|
81 | | -Please report issues and bugs directly on |
82 | | -[github](https://github.com/IntelPython/numba-dpex/issues). |
| 53 | +## Contributing |
83 | 54 |
|
84 | | -## Test Matrix: |
| 55 | +Please create an issue for feature requests and bug reports. You can also use |
| 56 | +the GitHub Discussions feature for general questions. |
85 | 57 |
|
86 | | -| # | OS | Distribution | Python | Architecture | Test type | IntelOneAPI | Build Commands | Dependencies | Backend | |
87 | | -| :---: | :-----: | :----------: | :------: | :-------------: | :-------: | :------------: | :------------: | :----------------: | :---------: | |
88 | | -| 1 | Linux | Ubuntu 20.04 | 3.7, 3.8 | Gen9 Integrated | CI | 2021.3, 2021.4 | (1) | Numba, NumPy, dpnp | OCL, L0-1.1 | |
89 | | -| 2 | Linux | Ubuntu 20.04 | 3.7, 3.8 | Gen12 Discrete | Manual | 2021.3, 2021.4 | (1) | Numba, NumPy, dpnp | OCL, L0-1.1 | |
90 | | -| 3 | Linux | Ubuntu 20.04 | 3.7, 3.8 | i7-10710U | CI | 2021.3, 2021.4 | (1) | Numba, NumPy, dpnp | OCL, L0-1.1 | |
91 | | -| 4 | Windows | 10 | 3.7, 3.8 | Gen9 Integrated | CI | 2021.3, 2021.4 | (1) | Numba, NumPy | OCL | |
92 | | -| 5 | Windows | 10 | 3.7, 3.8 | i7-10710 | CI | 2021.3, 2021.4 | (1) | Numba, NumPy | OCL | |
| 58 | +If you want to chat with the developers, join the |
| 59 | +[#Data-Parallel-Python_community](https://app.gitter.im/#/room/#Data-Parallel-Python_community:gitter.im) room on Gitter.im. |
93 | 60 |
|
94 | | -(1): `python setup.py install; pytest -q -ra --disable-warnings --pyargs numba_dpex -vv` |
| 61 | +Also refer our [CONTRIBUTING](https://github.com/IntelPython/numba-dpex/blob/main/CONTRIBUTING.md) page. |
0 commit comments