guvectorize function that returns a scalar?

0 views
Skip to first unread message

Feng Shi

unread,
Mar 12, 2018, 8:15:40 AM3/12/18
to Numba Public Discussion - Public
Hi all, I was using python2.7 and guvectorize function to return a scalar and it works fine. Here is the dummy code

@guvectorize(['void(int64, float64[:], float64[:])'],  '(),(N) -> ()', target='cuda')
def p_neg_gpu(i,theta,res):
    res[0]=1.0

But now I switched to python3.6 and it does work anymore because of signature error:  res is declared as float64[:] but its size is () which is a scalar. So I am confused. Any thoughts? 

Some clarifications: One parameter for the function is an array so I can't use @vectorize (or can I?). 

Thank you!

Best,
Bill 

Siu Kwan Lam

unread,
Mar 12, 2018, 11:37:10 AM3/12/18
to numba...@continuum.io
I think there is a bug in the CUDA gufunc when dealing with scalar output.
I've opened https://github.com/numba/numba/issues/2812 to track this.

--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users...@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/cb5a3d06-6287-4291-9dfd-b70135ec23c7%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
--
Siu Kwan Lam
Software Engineer
Continuum Analytics
Reply all
Reply to author
Forward
0 new messages