Open mofeing opened 1 year ago
Great! Could you write some integration tests where you try contract
, permutedims
, ...?
Next steps: which factorizations are implemented? Does eigendecomposition work? SVD? QR?
I have created integration tests for BlockArray
, covering functions such as contract
, permutedims
, and basic manipulation of the tensors. You can find the tests in this Pull Request.
Unfortunately, I found that svd
decomposition is currently not supported for BlockArray
s. Here's a relevant GitHub issue discussing the lack of SVD
support in BlockArrays.jl
: https://github.com/JuliaArrays/BlockArrays.jl/issues/131
I will look at other block-array libraries to see if they have such implementations.
Unfortunately, I found that
svd
decomposition is currently not supported forBlockArray
s. Here's a relevant GitHub issue discussing the lack ofSVD
support inBlockArrays.jl
: JuliaArrays/BlockArrays.jl#131 I will look at other block-array libraries to see if they have such implementations.
Okay, this is what I expected. Don't worry, distributed contraction has higher priority right now.
Have you tested eigendecomposition? And QR?
Have you tested eigendecomposition? And QR?
Not yet since we don't have these implementations in Tensors
right now, but if you want I can try to implement these and test the integrations.
Nah, just try it with a BlockMatrix
.
I tried it, and these two are not yet implemented as well. I added the tests commented in the PR.
I've been evaluating the Dagger.jl
library, specifically its Dagger.DArray
implementation, in the context of our tensor computations. My findings have revealed several significant limitations:
permutedims
function: While the transpose
function works as expected with DArray
, the permutedims
function does not. This issue is not documented in the library's repository, which suggests it may be worth raising as a new issue for the developers to address.
julia> darray = distribute(rand(4, 4), Blocks(2, 2))
DArray{Any, 2, typeof(cat)}(4, 4)
julia> transpose(darray) # works fine Dagger.Transpose{Any, 2}(4, 4)
julia> transpose(darray) |> compute |> collect 4×4 Matrix{Float64}: 0.167282 0.111796 0.139091 0.76079 0.970018 0.962297 0.0806159 0.750641 0.44158 0.213501 0.929178 0.0804493 0.980127 0.0202904 0.873157 0.249399
julia> permutedims(darray, (2, 1)) 4×4 Matrix{Any}: Dagger.GetIndex{Any, 2}(1, 0, 1, 0) Dagger.GetIndex{Any, 2}(1, 0, 1, 0) Dagger.GetIndex{Any, 2}(1, 0, 1, 0) Dagger.GetIndex{Any, 2}(1, 0, 1, 0) Dagger.GetIndex{Any, 2}(1, 0, 1, 0) Dagger.GetIndex{Any, 2}(1, 0, 1, 0) Dagger.GetIndex{Any, 2}(1, 0, 1, 0) Dagger.GetIndex{Any, 2}(1, 0, 1, 0) Dagger.GetIndex{Any, 2}(1, 0, 1, 0) Dagger.GetIndex{Any, 2}(1, 0, 1, 0) Dagger.GetIndex{Any, 2}(1, 0, 1, 0) Dagger.GetIndex{Any, 2}(1, 0, 1, 0) Dagger.GetIndex{Any, 2}(1, 0, 1, 0) Dagger.GetIndex{Any, 2}(1, 0, 1, 0) Dagger.GetIndex{Any, 2}(1, 0, 1, 0) Dagger.GetIndex{Any, 2}(1, 0, 1, 0)
julia> permutedims(darray, (2, 1)) |> compute ERROR: MethodError: no method matching compute(::Context, ::Matrix{Any}; options=nothing) Closest candidates are: compute(::Context, ::DArray; persist, options) at ~/.julia/packages/Dagger/vNUsP/src/array/darray.jl:231 compute(::Context, ::Thunk; options) at ~/.julia/packages/Dagger/vNUsP/src/compute.jl:27 compute(::Any; options) at ~/.julia/packages/Dagger/vNUsP/src/compute.jl:5 ...
2. Incompatibility between `Dagger.DArray` and regular arrays: The library does not support operations between regular arrays and `Dagger.DArray`. For instance, attempting to multiply a `DArray `with a regular array results in an error:
```julia
julia> darray = distribute(rand(4, 4), Blocks(2, 2))
DArray{Any, 2, typeof(cat)}(4, 4)
julia> array = rand(4, 4)
4×4 Matrix{Float64}:
0.503586 0.981538 0.631702 0.722101
0.370623 0.485568 0.618103 0.239512
0.69361 0.9219 0.68611 0.238639
0.825931 0.29894 0.685966 0.0812979
julia> darray * array
ERROR: MethodError: no method matching *(::Dagger.Chunk{Float64, MemPool.DRef, Dagger.ThreadProc, AnyScope}, ::Float64)
Closest candidates are:
*(::Any, ::Any, ::Any, ::Any...) at operators.jl:591
*(::T, ::T) where T<:Union{Float16, Float32, Float64} at float.jl:385
*(::StridedArray{P}, ::Real) where P<:Dates.Period at /opt/julia-1.8.2/share/julia/stdlib/v1.8/Dates/src/deprecated.jl:44
...
LinearAlgebra
functions: Similar to BlockArray
, Dagger.DArray
does not support key LinearAlgebra
functions such as qr
, svd
, and eigen
.In summary, although BlockArrays
seems a more developed option compared to Dagger.DArray
, the task-oriented computational model of Dagger
has the potential to provide superior capabilities for our parallel and distributed computations.
@mofeing Do you want me to write an integration test for this one?
@jofrevalles maybe this message should go in #7?
@jofrevalles maybe this message should go in #7?
Well, here we use Dagger.DArray
which has a block representation. But sure these two issues are related.
I tested
Tensor
withBlockArray
indata
field and the results work as expected: