DPNP – A NumPy-compatible library for SYCL-based devices

DPNP is a NumPy-like library accelerated with SYCL on Intel devices. It provides Python interfaces for many NumPy functions, and includes a subset of methods of dpnp.ndarray. Under the hood it is based on native C++ and oneMKL based kernels.

Being drop-in replacement for Numpy its usage is very similar to Numpy:

>>> import dpnp as np

The dpnp.ndarray class is a compatible alternative of numpy.ndarray.

>>> x = np.array([1, 2, 3])

x in the above example is an instance of dpnp.ndarray that is created identically to NumPy’s one. The key difference of dpnp.ndarray from numpy.ndarray is that the memory is allocated on Intel GPU when setting up DPNP_QUEUE_GPU=1 in the environment.

Most of the array manipulations are also done in the way similar to NumPy such as:

>>> s = np.sum(x)

Please see the API Reference for the complete list of supported NumPy APIs along with their limitations.