-
Notifications
You must be signed in to change notification settings - Fork 256
Open
Labels
enhancementNew feature or requestNew feature or request
Description
MWE:
julia> using CUDA
julia> A = CUDA.zeros(128);
julia> CUDA.rand!(A, 1:64)
ERROR: Scalar indexing is disallowed.
Invocation of setindex! 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] setindex!
@ ~/.julia/dev/GPUArrays/src/host/indexing.jl:58 [inlined]
[6] rand!(rng::Random.TaskLocalRNG, A::CuArray{Float32, 1, CUDA.DeviceMemory}, sp::Random.SamplerRangeNDL{UInt64, Int64})
@ Random ~/.julia/juliaup/julia-1.11.7+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/Random.jl:273
[7] rand!
@ ~/.julia/juliaup/julia-1.11.7+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/Random.jl:268 [inlined]
[8] rand!(A::CuArray{Float32, 1, CUDA.DeviceMemory}, X::UnitRange{Int64})
@ Random ~/.julia/juliaup/julia-1.11.7+0.x64.linux.gnu/share/julia/stdlib/v1.11/Random/src/Random.jl:265
[9] top-level scope
@ REPL[2]:1Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request