Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more arg tuple literal fixes
  • Loading branch information
DrTodd13 committed Oct 6, 2021
commit ed34eb56c6cf1aa6d8873eaf6c17852cf62fbee8
38 changes: 11 additions & 27 deletions numba/tests/test_parfors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1864,7 +1864,7 @@ def test_impl(x, sz):
x[i] = 1
return x
sz = (10, 5)
self.check(test_impl, np.empty(sz), (10,3))
self.check(test_impl, np.zeros(sz), (10, 3))

def test_tuple_for_pndindex(self):
def test_impl(x):
Expand All @@ -1873,50 +1873,34 @@ def test_impl(x):
x[i] = 1
return x
sz = (10, 5)
self.check(test_impl, np.empty(sz))

def test_tuple_for_pndindex_with_literally(self):
def test_impl(x):
sz = (10, numba.literally(5))
for i in numba.pndindex(sz):
x[i] = 1
return x
sz = (10,5)
self.check(test_impl, np.empty(sz))
self.check(test_impl, np.zeros(sz))

def test_tuple_arg_literal(self):
@njit(parallel=True)
def test_impl(x, sz):
def test_impl(x, first):
sz = (first, 5)
for i in numba.pndindex(sz):
x[i] = 1
return x

def test_driver(impl_arg, first):
sz = (first, 5)
return impl_arg(np.empty(sz), sz)

self.check(test_driver, test_impl, 10)
sz = (10, 5)
self.check(test_impl, np.zeros(sz), 10)

def test_tuple_arg_1d(self):
def test_impl(x, sz):
for i in numba.pndindex(sz):
x[i] = 1
return x
sz = (10,)
self.check(test_impl, np.empty(sz), sz)
self.check(test_impl, np.zeros(sz), sz)

def test_tuple_arg_1d_literal(self):
@njit(parallel=True)
def test_impl(x, sz):
def test_impl(x):
sz = (10,)
for i in numba.pndindex(sz):
x[i] = 1
return x
sz = (10,)
self.check(test_impl, np.zeros(sz))

Comment thread
stuartarchibald marked this conversation as resolved.
Resolved
def test_driver(impl_arg):
sz = (10,)
return impl_arg(np.empty(sz), sz)

self.check(test_driver, test_impl)

@skip_parfors_unsupported
class TestParforsLeaks(MemoryLeakMixin, TestParforsBase):
Expand Down