⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@ameligrana
Copy link
Contributor

No description provided.

@aplavin
Copy link
Member

aplavin commented Jan 4, 2026

Does all the code in that example works with CUDA.jl as-is?

@ameligrana
Copy link
Contributor Author

yes, it does in 1.10, it doesn't in 1.12 but it is a bug in julia

@ameligrana
Copy link
Contributor Author

in 1.12 it doesn't because a show method throws

@ameligrana
Copy link
Contributor Author

julia> # move to GPU
       dd = replace_storage(CuArray, d)
100-element StructArray(::CuArray{Float64, 1, CUDA.DeviceMemory}, ::CuArray{Float64, 1, CUDA.DeviceMemory}) with eltype @NamedTuple{a::Float64, b::Float64}:
Error showing value of type StructVector{@NamedTuple{a::Float64, b::Float64}, @NamedTuple{a::CuArray{Float64, 1, CUDA.DeviceMemory}, b::CuArray{Float64, 1, CUDA.DeviceMemory}}, Int64}:

SYSTEM (REPL): showing an error caused an error
ERROR: 1-element ExceptionStack:
Scalar indexing is disallowed.
Invocation of getindex resulted in scalar indexing of a GPU array.
This is typically caused by calling an iterating implementation of a method.
Such implementations *do not* execute on the GPU, but very slowly on the CPU,
and therefore should be avoided.

If you want to allow scalar iteration, use `allowscalar` or `@allowscalar`
to enable scalar iteration globally or for the operations in question.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:44
  [2] errorscalar(op::String)
    @ GPUArraysCore ~/.julia/packages/GPUArraysCore/aNaXo/src/GPUArraysCore.jl:151
  [3] _assertscalar(op::String, behavior::GPUArraysCore.ScalarIndexing)
    @ GPUArraysCore ~/.julia/packages/GPUArraysCore/aNaXo/src/GPUArraysCore.jl:124
  [4] assertscalar(op::String)
    @ GPUArraysCore ~/.julia/packages/GPUArraysCore/aNaXo/src/GPUArraysCore.jl:112
  [5] getindex
    @ ~/.julia/packages/GPUArrays/ouBUA/src/host/indexing.jl:50 [inlined]
  [6] macro expansion
    @ ./none:-1 [inlined]
  [7] get_ith
    @ ./none:0 [inlined]
  [8] _getindex
    @ ~/.julia/dev/StructArrays/src/structarray.jl:350 [inlined]
  [9] getindex
    @ ~/.julia/dev/StructArrays/src/structarray.jl:345 [inlined]
 [10] isassigned
    @ ./multidimensional.jl:1653 [inlined]
 [11] isassigned(::StructVector{@NamedTuple{…}, @NamedTuple{…}, Int64}, ::Int64, ::Int64)
    @ Base ./multidimensional.jl:1648
 [12] alignment(io::IOContext{…}, X::AbstractVecOrMat, rows::Vector{…}, cols::Vector{…}, cols_if_complete::Int64, cols_otherwise::Int64, sep::Int64, ncols::Int64)
    @ Base ./arrayshow.jl:68
 [13] _print_matrix(io::IOContext{…}, X::AbstractVecOrMat, pre::String, sep::String, post::String, hdots::String, vdots::String, ddots::String, hmod::Int64, vmod::Int64, rowsA::UnitRange{…}, colsA::UnitRange{…})
    @ Base ./arrayshow.jl:207
 [14] print_matrix(io::IOContext{…}, X::StructVector{…}, pre::String, sep::String, post::String, hdots::String, vdots::String, ddots::String, hmod::Int64, vmod::Int64)
    @ Base ./arrayshow.jl:171
 [15] print_matrix
    @ ./arrayshow.jl:171 [inlined]
 [16] print_array
    @ ./arrayshow.jl:358 [inlined]
 [17] show(io::IOContext{…}, ::MIME{…}, X::StructVector{…})
    @ Base ./arrayshow.jl:399
 [18] show_repl(io::IO, mime::MIME{Symbol("text/plain")}, x::Any)
    @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:548
 [19] show_limited(io::IO, mime::MIME, x::Any)
    @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:517
 [20] (::REPL.var"#display##0#display##1"{REPL.REPLDisplay{}, MIME{}, Base.RefValue{}})(io::Any)
    @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:540
 [21] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:833
 [22] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
    @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:526
 [23] display
    @ ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:546 [inlined]
 [24] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:340
 [25] (::REPL.var"#print_response##2#print_response##3")()
    @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:590
 [26] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
    @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:445
 [27] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
    @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:427
 [28] start_repl_backend
    @ ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:424 [inlined]
 [29] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool, backend::Any)
    @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:653
 [30] run_repl(repl::REPL.AbstractREPL, consumer::Any)
    @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:639
 [31] run_std_repl(REPL::Module, quiet::Bool, banner::Symbol, history_file::Bool)
    @ Base ./client.jl:478
 [32] run_main_repl(interactive::Bool, quiet::Bool, banner::Symbol, history_file::Bool)
    @ Base ./client.jl:499
 [33] repl_main
    @ ./client.jl:586 [inlined]
 [34] _start()
    @ Base ./client.jl:561
Stacktrace:
 [1] print_response(errio::IO, response::Any, backend::Union{…}, show_value::Bool, have_color::Bool, specialdisplay::Union{…})
   @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:599
 [2] (::REPL.var"#print_response##0#print_response##1"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
   @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:558
 [3] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
   @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:833
 [4] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
   @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:556
 [5] (::REPL.var"#do_respond#73"{})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
   @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:1192
 [6] run_interface(terminal::Base.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
   @ REPL.LineEdit ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2854
 [7] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
   @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:1663
 [8] (::REPL.var"#61#62"{REPL.LineEditREPL, REPL.REPLBackendRef})()
   @ REPL ~/.julia/juliaup/julia-1.12.3+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:650
Some type information was truncated. Use `show(err)` to see complete types.

@aplavin
Copy link
Member

aplavin commented Jan 5, 2026

Thanks! Makes total sense then.

@aplavin aplavin merged commit f504f68 into JuliaArrays:master Jan 5, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants