I cannot get numpy or math to work at all with guvectorize and target 'cuda'

0 views
Skip to first unread message

Jesse Lomask

unread,
Nov 5, 2017, 9:04:35 AM11/5/17
to Numba Public Discussion - Public


Hi,

I am using windows 10.  

the code below works fine until i try to use np.mod.   Also, I cannot get any Numpy code to work inside guvectorize with 'cuda'.  Nor can I get any Math code to work inside a guvectorize with 'cuda'.   i know not every numpy command will work with numba but 'mod' should work.

below i am try to use np.mod    - which should be supported in nopython mode according to docs.

@guvectorize(['void(float32[:,:,:],float32[:,:,:])'],'(m,n,p)->(m,n,p)', target='cuda') 
def dtwDipTestGPU2(data,data2):
    [n1,n2,n3]=data.shape
    np.mod(10,3)
    for i3 in range(0,n3):
        for i2 in range(0,n2):
            for i1 in range(0,n1):
                data2[i1,i2,i3]=data[i1,i2,i3]*2



error:

numba.errors.UntypedAttributeError: Failed at nopython (nopython frontend)
Unknown attribute 'mod' of type Module(<module 'numpy' from 'C:\\Users\\jesse\\AppData\\Local\\Continuum\\Anaconda3\\envs\\python3_6_2\\lib\\site-packages\\numpy\\__init__.py'>)


any suggestions are appreciated
thanks
Jesse

Stanley Seibert

unread,
Nov 6, 2017, 11:23:26 AM11/6/17
to Numba Public Discussion - Public
Hi Jesse,

The CUDA target in Numba is more restrictive than CPU nopython mode.  In particular, it does not support using functions from the NumPy module.  These are the supported operations:


I think it would be a good idea for Numba to have GPU support for NumPy functions on scalar arguments, but that has not been implemented yet.  For your example, you would need to use either the Python modulus operator or the math.fmod() function.


--
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+unsubscribe@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/c501f3a2-3c6f-49d3-935c-864e34e4b243%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

lom...@southkentschool.org

unread,
Nov 6, 2017, 12:54:56 PM11/6/17
to Numba Public Discussion - Public
thanks for the information!  
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users...@continuum.io.
Reply all
Reply to author
Forward
0 new messages