Skip to content

Commit 218df52

Browse files
author
Diptorup Deb
committed
Test case to verify NumPy args are no longer supported.
1 parent 86d5d4e commit 218df52

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# SPDX-FileCopyrightText: 2020 - 2023 Intel Corporation
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
import numpy
6+
import pytest
7+
8+
import numba_dpex as dpex
9+
from numba_dpex.core.exceptions import UnsupportedKernelArgumentError
10+
11+
N = 1024
12+
13+
14+
@dpex.kernel
15+
def vecadd_kernel(a, b, c):
16+
i = dpex.get_global_id(0)
17+
c[i] = a[i] + b[i]
18+
19+
20+
def test_passing_numpy_arrays_as_kernel_args():
21+
"""
22+
Negative test to verify that NumPy arrays cannot be passed to a kernel.
23+
"""
24+
a = numpy.ones(N)
25+
b = numpy.ones(N)
26+
c = numpy.zeros(N)
27+
28+
with pytest.raises(UnsupportedKernelArgumentError):
29+
vecadd_kernel[dpex.Range(N)](a, b, c)

0 commit comments

Comments
 (0)