Skip to content

Commit

Permalink
Update atomic example to be more stable
Browse files Browse the repository at this point in the history
  • Loading branch information
ZzEeKkAa committed Jul 27, 2023
1 parent 32b0da3 commit 5eb17ca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions numba_dpex/examples/kernel/atomic_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
@ndpx.kernel
def atomic_reduction(a):
idx = ndpx.get_global_id(0)
ndpx.atomic.add(a, 0, a[idx])
ndpx.atomic.add(a, 0, a[idx + 1])


def main():
N = 10
a = np.arange(N)

# We are storing sum to the first element
a = np.arange(0, N + 1)

print("Using device ...")
print(a.device)
Expand Down

0 comments on commit 5eb17ca

Please sign in to comment.