Skip to content

Commit

Permalink
Update unit test to use correct kernel launch API.
Browse files Browse the repository at this point in the history
  • Loading branch information
Diptorup Deb authored and ZzEeKkAa committed Dec 26, 2023
1 parent e5d53f7 commit b539970
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion numba_dpex/tests/kernel_tests/test_atomic_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_kernel_atomic_local(input_arrays, return_list_of_op):
op_type, expected = return_list_of_op
f = get_func_local(op_type, dtype)
kernel = dpex.kernel(f)
kernel[dpex.Range(N), dpex.Range(N)](a)
kernel[dpex.NdRange(dpex.Range(N), dpex.Range(N))](a)
assert a[0] == expected


Expand Down
10 changes: 4 additions & 6 deletions numba_dpex/tests/kernel_tests/test_barrier.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
#
# SPDX-License-Identifier: Apache-2.0

import dpctl
import dpctl.tensor as dpt
import numpy as np
import pytest

import numba_dpex as dpex
from numba_dpex import float32, usm_ndarray, void
from numba_dpex import NdRange, Range, float32, usm_ndarray, void

f32arrty = usm_ndarray(ndim=1, dtype=float32, layout="C")

Expand All @@ -27,7 +25,7 @@ def twice(A):
orig = dpt.asnumpy(arr)
global_size = (N,)
local_size = (N // 2,)
twice[global_size, local_size](arr)
twice[NdRange(global_size, local_size)](arr)
after = dpt.asnumpy(arr)
# The computation is correct?
np.testing.assert_allclose(orig * 2, after)
Expand All @@ -45,7 +43,7 @@ def twice(A):
N = 256
arr = dpt.arange(N, dtype=dpt.float32)
orig = dpt.asnumpy(arr)
twice[N](arr)
twice[Range(N)](arr)
after = dpt.asnumpy(arr)
# The computation is correct?
np.testing.assert_allclose(orig * 2, after)
Expand All @@ -68,7 +66,7 @@ def reverse_array(A):

arr = dpt.arange(blocksize, dtype=dpt.float32)
orig = dpt.asnumpy(arr)
reverse_array[(blocksize,), (blocksize,)](arr)
reverse_array[NdRange(Range(blocksize), Range(blocksize))](arr)
after = dpt.asnumpy(arr)
expected = orig[::-1] + orig
np.testing.assert_allclose(expected, after)
3 changes: 1 addition & 2 deletions numba_dpex/tests/kernel_tests/test_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import dpctl.tensor as dpt
import numpy as np
import pytest

import numba_dpex as dpex
from numba_dpex.core.caching import LRUCache
Expand Down Expand Up @@ -130,7 +129,7 @@ def data_parallel_sum(x, y, z):

d = JitKernel(data_parallel_sum)

d_launcher = d[100]
d_launcher = d[dpex.Range(100)]

N = 10
for i in range(N):
Expand Down

0 comments on commit b539970

Please sign in to comment.