You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cumsum(DA; dims) throws a ConcurrencyViolationError #770
julia>using Dagger
julia> DA =distribute(rand(4, 4), Blocks(2, 2));
julia>cumsum(DA, dims=1)
ERROR:ConcurrencyViolationError("Cannot resolve aliasing for object of type Any (element of Matrix{Any}), execution may become sequential")
julia>cumsum(distribute(rand(4), Blocks(2)))
4-element DVector{Any} with 2 partitions of size 2:0.02068310.4371841.145581.77878
cumprod and accumulate behave the same. The vector case returns the right values, but with an Any eltype.
Cause
There is no accumulate method for a DArray, so Base's generic _accumulate! runs element by element. Base allocates the output as a DMatrix{Any}. Reading A[i, I] with I::CartesianIndex reaches getindex(A::DArray, idx...), which returns a 0-dimensional DArray and not a scalar:
julia> DA[1, 2]
0.5772936968348066
julia> DA[1, CartesianIndex(2)]
0-dimensional DArray{Float64, 0} with 1 partitions of size 1:0.577294
Writing that into the output is then a copyto! between two DArrays under spawn_datadeps, which cannot work out the aliasing of a Matrix{Any}.
I can write a partition wise cumsum/cumprod (accumulate inside each partition, then carry the last slice forward along dims) if that is something you want.
Dagger master (02381759, 0.22.6)
Julia 1.12.7, Linux x86_64
Activity
jpsamaroo commentedon Oct 12, 2026
I'd love that, if you wouldn't mind!