Skip to content

Commit e78dda4

Browse files
Merge pull request #44 from SciML/ChrisRackauckas-patch-1
Fix allowed indexing for CuArrays update
2 parents 1ee3cd2 + a1db84a commit e78dda4

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/ArrayInterface.jl

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -456,15 +456,7 @@ function __init__()
456456
end
457457

458458
@require CuArrays="3a865a2d-5b23-5a0f-bc46-62713ec82fae" begin
459-
fast_scalar_indexing(::Type{<:CuArrays.CuArray}) = false
460-
@inline allowed_getindex(x::CuArrays.CuArray,i...) = CuArrays._getindex(x,i...)
461-
@inline allowed_setindex!(x::CuArrays.CuArray,v,i...) = CuArrays._setindex!(x,v,i...)
462-
463-
function Base.setindex(x::CuArrays.CuArray,v,i::Int)
464-
_x = copy(x)
465-
allowed_setindex!(_x,v,i)
466-
_x
467-
end
459+
include("cuarrays.jl")
468460
end
469461

470462
@require BandedMatrices="aae01518-5342-5314-be14-df237901396f" begin

src/cuarrays.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
fast_scalar_indexing(::Type{<:CuArrays.CuArray}) = false
2+
@inline allowed_getindex(x::CuArrays.CuArray,i...) = CuArrays.@allowscalar(x[i...])
3+
@inline allowed_setindex!(x::CuArrays.CuArray,v,i...) = (CuArrays.@allowscalar(x[i...] = v))
4+
5+
function Base.setindex(x::CuArrays.CuArray,v,i::Int)
6+
_x = copy(x)
7+
allowed_setindex!(_x,v,i)
8+
_x
9+
end

0 commit comments

Comments
 (0)