Welcome to numba-dppy’s documentation!¶
numba-dppy
is a standalone extension to the Numba JIT compiler that adds SYCL programming capabilities to Numba.
numba-dppy
uses dpctl to support
SYCL features and currently Intel’s DPC++ is the only SYCL runtime supported by
numba-dppy
.
There are two ways to program SYCL devices using numba-dppy
:
An explicit kernel programming mode.
import numpy as np import numba_dppy, numba_dppy as dppy import dpctl @dppy.kernel def sum(a, b, c): i = dppy.get_global_id(0) c[i] = a[i] + b[i] a = np.array(np.random.random(20), dtype=np.float32) b = np.array(np.random.random(20), dtype=np.float32) c = np.ones_like(a) with dpctl.device_context("opencl:gpu"): sum[20, dppy.DEFAULT_LOCAL_SIZE](a, b, c)An automatic offload mode for NumPy data-parallel expressions and Numba parallel loops.
from numba import njit import numpy as np import dpctl @njit def f1(a, b): c = a + b return c global_size = 64 local_size = 32 N = global_size * local_size a = np.ones(N, dtype=np.float32) b = np.ones(N, dtype=np.float32) with dpctl.device_context("opencl:gpu:0"): c = f1(a, b)
About¶
numba-dppy
is developed by Intel and is part of the Intel Distribution for
Python.
Contributing¶
Refer the contributing guide
for information on coding style and standards used in numba-dppy
.