-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Higher than 1-D arrays in dot #468
Comments
The message is most certainly an mistake somewhere. Possibly a reuse of the message from another failure (which is an issue still present on 0.6.5 that should be fixed with 0.6.6). Can you try with the current master and see if you get the same problem? |
Sure, retried with 0.6.8, which I built locally. Am getting an error related to dimensionality instead. Looks like 2-D arrays are not supported by In [1]: import pygpu
In [2]: import pygpu.blas
In [3]: import numpy
In [4]: import numpy as np
In [5]: c = pygpu.init("opencl0:1")
In [6]: a = pygpu.gpuarray.zeros((10, 11), dtype=np.float32, context=c, cls=pygpu.ndgpuarray)
In [7]: pygpu.blas.gemm(1, a, a.T, 0)
Out[7]:
gpuarray.array([[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]], dtype=float32)
In [8]: pygpu.blas.dot(a, a.T)
---------------------------------------------------------------------------
GpuArrayException Traceback (most recent call last)
<ipython-input-8-ee1cc1b223fb> in <module>()
----> 1 pygpu.blas.dot(a, a.T)
pygpu/blas.pyx in pygpu.blas.dot (pygpu/blas.c:2568)()
pygpu/blas.pyx in pygpu.blas.pygpu_blas_rdot (pygpu/blas.c:1731)()
GpuArrayException: ('Wrong number of dimensions: X->nd = 2 (expected 1), Y->nd = 2 (expected 1), Z->nd = 0 (expected 0)', 2) |
This is the blas dot. not the numpy dot. the blas dot only handle 1d.
I think we should do a pygpu.dot() to be like numpy.dot(). Does one already
exist? @abergeron, would you put it elsewhere?
…On Tue, Jun 27, 2017 at 4:40 PM jakirkham ***@***.***> wrote:
Sure, retried with 0.6.8, which I built locally. Am getting an error
related to dimensionality instead. Looks like 2-D arrays are not supported
by dot. Is this expected? If so, what are your thoughts on expanding dot
to N-D arrays of rank greater than 1?
In [1]: import pygpu
In [2]: import pygpu.blas
In [3]: import numpy
In [4]: import numpy as np
In [5]: c = pygpu.init("opencl0:1")
In [6]: a = pygpu.gpuarray.zeros((10, 11), dtype=np.float32, context=c, cls=pygpu.ndgpuarray)
In [7]: pygpu.blas.gemm(1, a, a.T, 0)
Out[7]:
gpuarray.array([[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]], dtype=float32)
In [8]: pygpu.blas.dot(a, a.T)---------------------------------------------------------------------------
GpuArrayException Traceback (most recent call last)<ipython-input-8-ee1cc1b223fb> in <module>()----> 1 pygpu.blas.dot(a, a.T)
pygpu/blas.pyx in pygpu.blas.dot (pygpu/blas.c:2568)()
pygpu/blas.pyx in pygpu.blas.pygpu_blas_rdot (pygpu/blas.c:1731)()
GpuArrayException: ('Wrong number of dimensions: X->nd = 2 (expected 1), Y->nd = 2 (expected 1), Z->nd = 0 (expected 0)', 2)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#468 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AALC-2DQEcNtTisBtQu85O3dsgktUd7Mks5sIWi1gaJpZM4OGAcZ>
.
|
There isn't a pygpu.dot() akin to numpy yet. I welcome patches. Otherwise, you're right this it the blas dot, not the numpy dot. |
Trying to use
dot
frompygpu
with OpenCL. However it seems to throw an error due to the lack of collective operations. Am able to work around this using BLAS functions (e.g.gemm
). After looking around in the code was able to find the error and the C function involved, but not exactly how we got to it.Have a few questions. How are collective operations involved here (higher dimensions?)? Would it make sense to special case some ranks of arrays to avoid collective operations and go straight to BLAS operations? If I'm misunderstanding things here, please feel free to correct me.
The text was updated successfully, but these errors were encountered: