Supported Atomic Operations¶
numba-dppy
supports some of the atomic operations supported in DPC++.
Those that are presently implemented are as follows:
Example¶
Here’s an example of how to use atomics add in DPPY:
def main():
@dppy.kernel
def atomic_add(a):
dppy.atomic.add(a, 0, 1)
global_size = 100
a = np.array([0])
with dpctl.device_context("opencl:gpu") as gpu_queue:
atomic_add[global_size, dppy.DEFAULT_LOCAL_SIZE](a)
# Expected 100, because global_size = 100
print(a)
Note
The numba_dppy.atomic.add
function is analogous to The
numba.cuda.atomic.add
provided by the numba.cuda
backend.
Full examples¶
numba_dppy/examples/atomic_op.py