Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

copy! methods for views with linear indices #76

Closed
samuelpowell opened this issue Jan 4, 2018 · 1 comment
Closed

copy! methods for views with linear indices #76

samuelpowell opened this issue Jan 4, 2018 · 1 comment

Comments

@samuelpowell
Copy link
Contributor

I have an application in which an (expensive) linear operator is implemented on the GPU. Methods such as GMRES from IterativeSolvers attempt to apply the operator to a RHS which is a view of another larger array. Since there are no copy! methods for views, a naive implementation fails.

In the case of GMRES (and one would imagine most performance critical applications), the views will be an appropriate sized column of a matrix, thus the memory is linear and the copy operation could presumably be performed without too much pain.

I am not that familiar with the SubArray architecture - would it be to implement a copy! method which accepts a view, so long as the indices are linear and the dimensions correct?

@samuelpowell
Copy link
Contributor Author

Having looked a little at the documentation, perhaps it would be possible simply to add a new method with signature

function Base.$copyfun(dst::CuArray{T}, src::SubArray{T,N,A,I,true}) where T

which checks for unit stride, and then continues in the same vein as the standard copy methods. It appears in that in this case passing a pointer and length to the CUDA memcpy function should suffice.

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

No branches or pull requests

1 participant