IntelPython / numba-dpex

Data Parallel Extension for Numba
https://intelpython.github.io/numba-dpex/
Apache License 2.0
77 stars 33 forks source link
intel-xpu numba python sycl

Code style: black Coverage Status pre-commit Join the chat at https://matrix.to/#/#Data-Parallel-Python_community:gitter.im Coverity Scan Build Status OpenSSF Scorecard

oneAPI logo





Data Parallel Extension for Numba (numba-dpex) is an open-source standalone extension for the Numba Python JIT compiler. Numba-dpex provides a [SYCL](https://sycl.tech/)-like API for kernel programming Python. SYCL* is an open standard developed by the Unified Acceleration Foundation as a vendor-agnostic way of programming different types of data-parallel hardware such as multi-core CPUs, GPUs, and FPGAs. Numba-dpex's kernel-programming API brings the same programming model and a similar API to Python. The API allows expressing portable data-parallel kernels in Python and then JIT compiling them for different hardware targets. JIT compilation is supported for hardware that use the SPIR-V intermediate representation format that includes OpenCL CPU (Intel, AMD) devices, OpenCL GPU (Intel integrated and discrete GPUs) devices, and oneAPI Level Zero GPU (Intel integrated and discrete GPUs) devices.

The kernel programming API does not yet support every SYCL feature. Refer to the [SYCL and numba-dpex feature comparison](https://intelpython.github.io/numba-dpex/latest/supported_sycl_features.html) page to get a summary of supported features. Numba-dpex only implements SYCL*'s kernel programming API, all SYCL runtime Python bindings are provided by the dpctl package.

Along with the kernel programming API, numba-dpex extends Numba's auto-parallelizer to bring device offload capabilities to prange loops and NumPy-like vector expressions. The offload functionality is supported via the NumPy drop-in replacement library: dpnp. Note that dpnp and NumPy-based expressions can be used together in the same function, with dpnp expressions getting offloaded by numba-dpex and NumPy expressions getting parallelized by Numba.

Refer the documentation and examples to learn more.

Getting Started

Numba-dpex is part of the Intel® Distribution of Python (IDP) and Intel® oneAPI AIKit, and can be installed along with oneAPI. Additionally, we support installing it from Anaconda cloud. Please refer the instructions on our documentation page for more details.

Once the package is installed, a good starting point is to run the examples in the numba_dpex/examples directory. The test suite may also be invoked as follows:

python -m pytest --pyargs numba_dpex.tests

Conda

To install numba_dpex from the Intel(R) channel on Anaconda cloud, use the following command:

conda install numba-dpex -c conda-forge

Pip

The numba_dpex can be installed using pip obtaining wheel packages either from PyPi.

python -m pip install numba-dpex

Contributing

Please create an issue for feature requests and bug reports. You can also use the GitHub Discussions feature for general questions.

If you want to chat with the developers, join the #Data-Parallel-Python_community room on Gitter.im.

Also refer our CONTRIBUTING page.