Skip to content

Commit 669809d

Browse files
committed
Switch to real NumPy from mock NumPy
Now that keyword arguments are supported for overloads, there is no need to use the kwarg-free mock NumPy functions, and the real ones can be used instead.
1 parent c997c71 commit 669809d

File tree

3 files changed

+11
-159
lines changed

3 files changed

+11
-159
lines changed

numba_cuda/numba/cuda/tests/nrt/mock_numpy.py

Lines changed: 0 additions & 146 deletions
This file was deleted.

numba_cuda/numba/cuda/tests/nrt/test_nrt.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import unittest
66
from numba.cuda.testing import CUDATestCase
77

8-
from numba.cuda.tests.nrt.mock_numpy import cuda_empty, cuda_ones, cuda_arange
98
from numba.tests.support import run_in_subprocess, override_config
109

1110
from numba import cuda
@@ -24,7 +23,7 @@ def f(x):
2423

2524
@cuda.jit
2625
def g():
27-
x = cuda_empty(10, np.int64)
26+
x = np.empty(10, np.int64)
2827
f(x)
2928

3029
g[1,1]()
@@ -37,7 +36,7 @@ def f(x):
3736

3837
@cuda.jit
3938
def g():
40-
x = cuda_empty(10, np.int64)
39+
x = np.empty(10, np.int64)
4140
f(x)
4241

4342
g[1,1]()
@@ -66,7 +65,7 @@ def f(x):
6665

6766
@cuda.jit
6867
def g(out_ary):
69-
x = cuda_empty(10, np.int64)
68+
x = np.empty(10, np.int64)
7069
x[5] = 1
7170
y = f(x)
7271
out_ary[0] = y[0]
@@ -97,11 +96,11 @@ def test_stats_env_var_explicit_on(self):
9796
src = """if 1:
9897
from numba import cuda
9998
from numba.cuda.runtime import rtsys
100-
from numba.cuda.tests.nrt.mock_numpy import cuda_arange
99+
import numpy as np
101100
102101
@cuda.jit
103102
def foo():
104-
x = cuda_arange(10)[0]
103+
x = np.arange(10)[0]
105104
106105
# initialize the NRT before use
107106
rtsys.initialize()
@@ -167,8 +166,8 @@ def test_stats_status_toggle(self):
167166

168167
@cuda.jit
169168
def foo():
170-
tmp = cuda_ones(3)
171-
arr = cuda_arange(5 * tmp[0]) # noqa: F841
169+
tmp = np.ones(3)
170+
arr = np.arange(5 * tmp[0]) # noqa: F841
172171
return None
173172

174173
with (

numba_cuda/numba/cuda/tests/nrt/test_nrt_refct.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from numba.cuda.runtime import rtsys
55
from numba.cuda.tests.support import EnableNRTStatsMixin
66
from numba.cuda.testing import CUDATestCase
7-
from numba.cuda.tests.nrt.mock_numpy import cuda_empty, cuda_empty_like
87

98
from numba import cuda
109

@@ -34,7 +33,7 @@ def test_no_return(self):
3433
@cuda.jit
3534
def kernel():
3635
for i in range(n):
37-
temp = cuda_empty(2, np.float64) # noqa: F841
36+
temp = np.empty(2) # noqa: F841
3837
return None
3938

4039
init_stats = rtsys.get_allocation_stats()
@@ -51,7 +50,7 @@ def test_escaping_var_init_in_loop(self):
5150
@cuda.jit
5251
def g(n):
5352

54-
x = cuda_empty((n, 2), np.float64)
53+
x = np.empty((n, 2))
5554

5655
for i in range(n):
5756
y = x[i]
@@ -73,13 +72,13 @@ def test_invalid_computation_of_lifetime(self):
7372
"""
7473
@cuda.jit
7574
def if_with_allocation_and_initialization(arr1, test1):
76-
tmp_arr = cuda_empty_like(arr1)
75+
tmp_arr = np.empty_like(arr1)
7776

7877
for i in range(tmp_arr.shape[0]):
7978
pass
8079

8180
if test1:
82-
cuda_empty_like(arr1)
81+
np.empty_like(arr1)
8382

8483
arr = np.random.random((5, 5)) # the values are not consumed
8584

0 commit comments

Comments
 (0)