-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Diptorup Deb
committed
Nov 3, 2023
1 parent
2930c6e
commit c2bed32
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import dpctl | ||
import dpnp | ||
|
||
import numba_dpex.experimental as nd_exp | ||
from numba_dpex import Range, dpjit | ||
|
||
|
||
@nd_exp.kernel | ||
def test_atomic_ref(a, b): | ||
# i = get_global_id(0) | ||
v = nd_exp.AtomicRef( | ||
b, | ||
nd_exp.MemoryOrder.relaxed, | ||
nd_exp.MemoryScope.device, | ||
nd_exp.AddressSpace.GLOBAL, | ||
) | ||
v.fetch_add(a[0]) # a[i] | ||
|
||
|
||
q = dpctl.SyclQueue() | ||
a = dpnp.ones(10, sycl_queue=q, dtype=dpnp.int64) | ||
b = dpnp.array(0, sycl_queue=q, dtype=dpnp.int64) | ||
|
||
nd_exp.call_kernel(test_atomic_ref, Range(10), a, b) | ||
print(b) |