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

Algebra with UniformScaling Uses Generic Fallback Scalar Indexing #85

Closed
ChrisRackauckas opened this issue May 1, 2020 · 3 comments
Closed
Labels
cuda array Stuff about CuArray. enhancement New feature or request

Comments

@ChrisRackauckas
Copy link
Member

using CuArrays, LinearAlgebra
CuArrays.allowscalar(false)
cu(rand(3,3)) + I
scalar getindex is disallowed
error(::String) at error.jl:33
assertscalar(::String) at indexing.jl:41
getindex at indexing.jl:96 [inlined]
_getindex at abstractarray.jl:1003 [inlined]
getindex at abstractarray.jl:980 [inlined]
+(::CuArray{Float32,2,Nothing}, ::UniformScaling{Bool}) at uniformscaling.jl:167
top-level scope at test.jl:18
@ChrisRackauckas
Copy link
Member Author

It seems like broadcast is having issues too? I was trying:

using CuArrays, LinearAlgebra
A = cu(rand(3,3))
idxs = 1:3
@. setindex!((A,),getindex((A,),idxs,idxs)+getindex((I,),idxs,idxs),idxs,idxs)
scalar getindex is disallowed
error(::String) at error.jl:33
assertscalar(::String) at indexing.jl:41
getindex at indexing.jl:96 [inlined]
_getindex at abstractarray.jl:1003 [inlined]
getindex at abstractarray.jl:980 [inlined]
_broadcast_getindex_evalf at broadcast.jl:631 [inlined]
_broadcast_getindex at broadcast.jl:604 [inlined]
_getindex at broadcast.jl:627 [inlined]
_broadcast_getindex at broadcast.jl:603 [inlined]
_getindex at broadcast.jl:627 [inlined]
_getindex at broadcast.jl:627 [inlined]
_broadcast_getindex at broadcast.jl:603 [inlined]
getindex at broadcast.jl:564 [inlined]
macro expansion at broadcast.jl:910 [inlined]
macro expansion at simdloop.jl:77 [inlined]
copyto! at broadcast.jl:909 [inlined]
copyto! at broadcast.jl:864 [inlined]
copy at broadcast.jl:840 [inlined]
materialize(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(setindex!),Tuple{Tuple{CuArray{Float32,2,Nothing}},Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(+),Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(getindex),Tuple{Tuple{CuArray{Float32,2,Nothing}},UnitRange{Int64},UnitRange{Int64}}},Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(getindex),Tuple{Tuple{UniformScaling{Bool}},UnitRange{Int64},UnitRange{Int64}}}}},UnitRange{Int64},UnitRange{Int64}}}) at broadcast.jl:820
top-level scope at simple_gpu.jl:47

@ChrisRackauckas
Copy link
Member Author

ChrisRackauckas commented May 1, 2020

Base.:+(A::CuArray,I::UniformScaling) = A + CuArray(I,size(A,1),size(A,2))

works but seems wasteful.

@maleadt maleadt transferred this issue from JuliaGPU/CuArrays.jl May 27, 2020
@maleadt maleadt added cuda array Stuff about CuArray. enhancement New feature or request labels May 27, 2020
@maleadt
Copy link
Member

maleadt commented Apr 27, 2024

This works now.

@maleadt maleadt closed this as completed Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuda array Stuff about CuArray. enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants