Array.concatenate fails for axis!= 0
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 247
- Avg merge
- 7h 2m
- Merged PRs (30d)
- 6
Description
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"](https://github.com/inducer/pyopencl/blob/dfc4e840cfa4b371a90c624e44bee5399b057681/pyopencl/array.py#L2117-L2118)
The error appears to be originated when [creating the buffer `results`,](https://github.com/inducer/pyopencl/blob/dfc4e840cfa4b371a90c624e44bee5399b057681/pyopencl/array.py#L2638) 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.