Skip to content

Instantly share code, notes, and snippets.

@ilkerkesen
Created December 2, 2017 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilkerkesen/c921d41894b8667d8acc6e71803f04fe to your computer and use it in GitHub Desktop.
Save ilkerkesen/c921d41894b8667d8acc6e71803f04fe to your computer and use it in GitHub Desktop.
cuarrays - indexing
julia> include("indexing.jl")
summary(a) = "4×4×4 Array{Float64,3}"
summary(a[:, 2, 2]) = "4-element Array{Float64,1}"
summary(a[:, [2, 4], 2]) = "4×2 Array{Float64,2}"
summary(a[:, [2, 4], [1, 3]]) = "4×2×2 Array{Float64,3}"
summary(a[:, [2, 4], :]) = "4×2×4 Array{Float64,3}"
summary(a[:, 2:4, :]) = "4×3×4 Array{Float64,3}"
summary(a[:, 1:2:4, :]) = "4×2×4 Array{Float64,3}"
summary(a) = "4×4×4 CuArray{Float64,3}"
summary(a[:, 2, 2]) = "4-element CuArray{Float64,1}"
summary(a[:, [2, 4], 2]) = "4×2 CuArray{Float64,2}"
summary(a[:, [2, 4], [1, 3]]) = "4×2×2 CuArray{Float64,3}"
ERROR: LoadError: CUDA error: an illegal memory access was encountered (code #700, ERROR_ILLEGAL_ADDRESS)
Stacktrace:
[1] macro expansion at /KUFS/scratch/ikesen16/.julia/newnode/v0.6/CUDAdrv/src/base.jl:130 [inlined]
[2] upload(::CUDAdrv.OwnedPtr{Int64}, ::Ptr{Int64}, ::Int64) at /KUFS/scratch/ikesen16/.julia/newnode/v0.6/CUDAdrv/src/memory.jl:131
[3] copy!(::CuArray{Int64,1}, ::Array{Int64,1}) at /KUFS/scratch/ikesen16/.julia/newnode/v0.6/CuArrays/src/array.jl:49
[4] convert(::Type{CuArray{Int64,1}}, ::Array{Int64,1}) at /KUFS/scratch/ikesen16/.julia/newnode/v0.6/CuArrays/src/array.jl:70
[5] to_index(::Array{Int64,1}) at /KUFS/scratch/ikesen16/.julia/newnode/v0.6/CuArrays/src/indexing.jl:46
[6] broadcast(::Function, ::Tuple{Base.Slice{Base.OneTo{Int64}},Array{Int64,1},Base.Slice{Base.OneTo{Int64}}}) at ./broadcast.jl:17
[7] _unsafe_getindex!(::CuArray{Float64,3}, ::CuArray{Float64,3}, ::Base.Slice{Base.OneTo{Int64}}, ::Array{Int64,1}, ::Vararg{Union{AbstractArray, Real},N} where N) at /KUFS/scratch/ikesen16/.julia/newnode/v0.6/CuArrays/src/indexing.jl:62
[8] macro expansion at ./multidimensional.jl:460 [inlined]
[9] _unsafe_getindex(::IndexLinear, ::CuArray{Float64,3}, ::Base.Slice{Base.OneTo{Int64}}, ::Array{Int64,1}, ::Base.Slice{Base.OneTo{Int64}}) at ./multidimensional.jl:453
[10] macro expansion at ./multidimensional.jl:442 [inlined]
[11] _getindex at ./multidimensional.jl:438 [inlined]
[12] getindex(::CuArray{Float64,3}, ::Colon, ::Array{Int64,1}, ::Colon) at ./abstractarray.jl:882
[13] include_from_node1(::String) at ./loading.jl:569
[14] include(::String) at ./sysimg.jl:14
while loading /KUFS/scratch/ikesen16/indexing.jl, in expression starting on line 243
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment