You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using strides causes memory allocations to balloon in size. It looks like as_strided() is not creating a view of the array the same way that Numpy does.
@kkotyk, Cupy's ndarray has __cuda_array_interface__ attribute that similar to numpy ndarray's __array_interface__. To avoid memory allocation as cupy's as_strided doese, as what numpy's as_strided did, make a DummyArray which has a __cuda_array_interface__, set desired strides and shape which make the sliding window view into this __cuda_array_interface__. As cp.asarray hornor strides and shape in the __cuda_array_interface__, so the new ndarray returned by cp.asarray(DummyArray(this_cuda_interface, base=original_array)) is almost the final real sliding window view that you can use in some cases(In other cases, for example, print this view lead to memory allocation ).
Using strides causes memory allocations to balloon in size. It looks like as_strided() is not creating a view of the array the same way that Numpy does.
The output of this example shows:
So it appears that when using as_strided, Cupy using the original array as a base. Does anyone have a suggestion on how to deal with this?
The text was updated successfully, but these errors were encountered: