Numba: Passing tuples of arrays does not work for `parallel=True` with `numba>0.34`

Created on 14 Dec 2017  路  4Comments  路  Source: numba/numba

It seems that passing a tuple of (homogenous) arrays does not work with recent versions of numba. The reproducer below works with numba0.34 but fails with numba0.35 and numba0.36.

import numpy as np
from numba import njit, prange

M = 4
N = 1000
L = tuple( np.random.rand(N) for _ in range(M) )

@njit
def jitted_sum( x, L ):
    S = 0
    for j in range(N):
        for i in range(M):
            x[j] += L[i][j]

@njit(parallel=True)
def parallel_jitted_sum( x, L ):
    S = 0
    for j in prange(N):
        for i in range(M):
            x[j] += L[i][j]

x = np.zeros(N)
jitted_sum(x, L)
assert np.all( x == sum(L) )

x = np.zeros(N)
parallel_jitted_sum(x, L)
assert np.all( x == sum(L) )
bug duplicate

Most helpful comment

Hi, my collaborators and I recently came across a case where having tuples with prange would be very useful.
I was wondering whether there are plans to address this issue in the near future.

Thanks!

All 4 comments

Duplicate of #2625?

@DrTodd13 @sklam Looks like the gufunc wrapper generation fails because a tuple is passed. Is there anything the parfor lowerer could be doing wrong or is it gufunc's limitation?

@ehsantn , it's a gufunc limitation. Gufunc can only accept array inputs. This is one of the things I wanted to address in the gufunc rewrite.

Hi, my collaborators and I recently came across a case where having tuples with prange would be very useful.
I was wondering whether there are plans to address this issue in the near future.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings