Skip to content
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

Array.concatenate fails for axis!= 0 #506

Open
panchoop opened this issue Aug 2, 2021 · 1 comment
Open

Array.concatenate fails for axis!= 0 #506

panchoop opened this issue Aug 2, 2021 · 1 comment

Comments

@panchoop
Copy link

panchoop commented Aug 2, 2021

The function only works for axis = 0.

To replicate:

import pyopencl as cl
platform = cl.get_platforms()[0]
device = platform.get_devices()[0]
context = cl.create_some_context([device])
queue = cl.CommandQueue(context)

a = np.random.rand(2,2)
b = np.random.rand(2,2)

a_cl = clarray.to_device(queue, np.require(a, np.float64, 'C'))
b_cl = clarray.to_device(queue, np.require(b, np.float64, 'C'))

c_cl = clarray.concatenate( (a_cl, b_cl), axis=1)

Error: "cannot assign between arrays of differing strides"

The error appears to be originated when creating the buffer results, that is expected to contain the whole data.
Since it is initialized with shape (2, 2+2), its stride is different from both a, and b.
Then Array.setitem fails as it is no yet implemented to set items with different stride.

I am unsure if it is a bug. If it is not yet implemented, maybe it could be handy to raise an error for axis != 0 inside concatenate.

@inducer
Copy link
Owner

inducer commented Aug 3, 2021

That's a limitation of the current implementation. There are not currently plans to address this. I'd be open to considering a PR that adds a better error message.

cc @kaushikcfd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants