Issue 3164 still not working

  1. I am using numba version used: 0.52.0+0.g18825058a.dirty and I still cannot find a way to use vectorise on a non-scalar data type (list, tuple , dict) . Below I removed some unused code
  2. I also tried directly the example from PR 3463 (thought that tuple passing in cuda.jit could work also on vectorize) with numba 0.52 but it is not working.

import numpy as np
import numba
from numba import vectorize, int32, float32
import pdb
import math
from timeit import default_timer as timer
import pkg_resources

print('numba version used: ’ + str(pkg_resources.get_distribution(“numba”).version))

def v_b1(in_1D, in_nD):

out = 0
for t in in_nD:
    out += t

out = in_1D + out

return out

v_int = v_b1

v_cpu = numba.vectorize([‘float32(float32, int32)’], target = ‘cpu’)(v_int)
v_parallel = numba.vectorize([‘float32(float32, int32)’], target = ‘parallel’)(v_int)
v_cuda = numba.vectorize([‘float32(float32, int32)’], target = ‘cuda’)(v_int)

N = 1000

print('for function ’ + str(v_int.name) + ’ is CUDA available? ’ + str(numba.cuda.is_available()))
if numba.cuda.is_available():
print (numba.cuda.detect())

if numba.cuda.is_available() == False:
avail = [v_cpu]
else:
avail = [v_cuda]
avail = [v_cpu]

A_in_1D = np.random.uniform(-3, 3, size=N).astype(np.float32)
A_in_1D = A_in_1D[:,np.newaxis]

B_nparray_2D = np.ones((N,3)).astype(np.int32)

B_list_dic = [{x:x+1, x+1:x+2, x+2:x+3} for x in range(N)]

B_list_list = []
for n in range(N):
B_list_list.append([n, n+1, n+2])

#B_list_str = [str(x)+’/’+str(x+1)+’/’+str(x+2) for x in range(N)]
B_list_str = [str(‘1’) for x in range(N)]

B_list_tuple = []
for n in range(N):
B_list_tuple.append((n, n+1, n+2))

B_list_nparray = [0] * N
for n in range(N):
B_list_nparray[n] = np.ones(3).astype(np.int32) + n

B_nparray_tuple_2D = np.ones((1000,1), dtype=(‘i4’,3))
B_nparray_tuple_1D = np.ones(1000, dtype=(‘i4’,3))

A_in_nD = B_list_list #0.42
#A_in_nD = B_list_nparray #0.42
#A_in_nD = B_nparray_2D #0.42
#A_in_nD = B_list_tuple #0.42
#A_in_nD = B_list_dic #0.52 not working
#A_in_nD = B_list_str #0.52 not working
#A_in_nD = B_nparray_tuple_2D #0.42
#A_in_nD = B_nparray_tuple_1D #0.42

for c in [1, 8, 64, 512]:
print©
for f in avail:
start = timer()
A_out = f(A_in_1D, A_in_nD)
elapsed_time = timer() - start
print(“Time: {}”.format(elapsed_time))