-
Notifications
You must be signed in to change notification settings - Fork 222
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
similar(reinterpret(T, view(::CuArray, ...))) produces Array instead of CuArray #602
Comments
Alternatively, maybe this should be fixed upstream, so |
We already do this for `SubArray` and `PermutedDimsArray`, so I think this makes sense here. ref JuliaGPU/CUDA.jl#602
We already do this for `SubArray`, `PermutedDimsArray`, and `ReshapedArray`, so I think this makes sense here. This also adds tests for `similar(::ReshapedArray)`, since I didn't notice that was actually defined before. ref JuliaGPU/CUDA.jl#602
We already do this for `SubArray`, `PermutedDimsArray`, and `ReshapedArray`, so I think this makes sense here. This also adds tests for `similar(::ReshapedArray)`, since I didn't notice that was actually defined before. ref JuliaGPU/CUDA.jl#602
This should be fixed on Julia nightly, but would it be a good idea to try to fix this for |
We don't use ReinterpretArray anymore after #498, could you verify this works on master as expected? |
So this works with contiguous reinterpred views julia> similar(reinterpret(Int32, view(CUDA.rand(2,2), :, 1)))
2-element CuArray{Int32, 1}:
0
0
julia> similar(reinterpret(Int32, view(CUDA.rand(2,2), 1, :)))
2-element Vector{Int32}:
15
0 |
Awesome thanks! Works for me now. |
We already do this for `SubArray`, `PermutedDimsArray`, and `ReshapedArray`, so I think this makes sense here. This also adds tests for `similar(::ReshapedArray)`, since I didn't notice that was actually defined before. ref JuliaGPU/CUDA.jl#602
It seems like this falls back to the generic implementation for
AbstractArrays
inBase
, which always produces anArray
:I think returning a
CuArray
would make more sense here, so generic code can still run on the GPU.This is using CUDA 2.3.0 on Julia 1.5.3
The text was updated successfully, but these errors were encountered: