Closed
Description
julia> x = Reactant.to_rarray(ones(10))
2025-03-13 22:42:56.375804: I external/xla/xla/service/service.cc:152] XLA service 0xc4a4510 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2025-03-13 22:42:56.375897: I external/xla/xla/service/service.cc:160] StreamExecutor device (0): NVIDIA GeForce RTX 3090, Compute Capability 8.6
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1741920176.377112 56835 se_gpu_pjrt_client.cc:951] Using BFC allocator.
I0000 00:00:1741920176.377291 56835 gpu_helpers.cc:136] XLA backend allocating 18988744704 bytes on device 0 for BFCAllocator.
I0000 00:00:1741920176.377471 56835 gpu_helpers.cc:177] XLA backend will use up to 6329581568 bytes on device 0 for CollectiveBFCAllocator.
I0000 00:00:1741920176.396166 56835 cuda_dnn.cc:529] Loaded cuDNN version 90400
10-element ConcretePJRTArray{Float64,1}:
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
julia> y = Reactant.to_rarray(ones(10))
10-element ConcretePJRTArray{Float64,1}:
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
julia> x .= y ./ 2
ERROR: Scalar indexing is disallowed.
Invocation of getindex(::ConcretePJRTArray, ::Vararg{Int, N}) 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:35
[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(a::ConcretePJRTArray{Float64, 1, 1, Reactant.Sharding.ShardInfo{Reactant.Sharding.NoSharding, Nothing}}, args::Int64)
@ Reactant ~/git/Reactant.jl/src/ConcreteRArray.jl:245
[6] _broadcast_getindex
@ ./broadcast.jl:675 [inlined]
[7] _getindex
@ ./broadcast.jl:705 [inlined]
[8] _broadcast_getindex
@ ./broadcast.jl:681 [inlined]
[9] getindex
@ ./broadcast.jl:636 [inlined]
[10] macro expansion
@ ./broadcast.jl:1004 [inlined]
[11] macro expansion
@ ./simdloop.jl:77 [inlined]
[12] copyto!
@ ./broadcast.jl:1003 [inlined]
[13] copyto!
@ ./broadcast.jl:956 [inlined]
[14] materialize!
@ ./broadcast.jl:914 [inlined]
[15] materialize!(dest::ConcretePJRTArray{Float64, 1, 1, Reactant.Sharding.ShardInfo{…}}, bc::Base.Broadcast.Broadcasted{Base.Broadcast.ArrayStyle{…}, Nothing, typeof(/), Tuple{…}})
@ Base.Broadcast ./broadcast.jl:911
[16] top-level scope
@ REPL[5]:1
Some type information was truncated. Use `show(err)` to see complete types.
Metadata
Metadata
Assignees
Labels
No labels