bsc-quantic / Tenet.jl

Composable Tensor Network library in Julia
https://bsc-quantic.github.io/Tenet.jl/
Apache License 2.0
19 stars 1 forks source link

Specialize `contract` method for `Dagger.DArray` tensors #123

Closed Todorbsc closed 4 months ago

Todorbsc commented 10 months ago

When the tensors to be contracted are matrices, the generated tasks are executed in parallel, and the total number of tasks makes sense (first image). The problem arises when the tensors to be contracted are of higher order, as EinCode starts to perform permutations in the dimensions and reshapes to carry out the contraction, seemingly generating an endless number of tasks (second image, and it hasn't even reached the end of the contraction). In the case where the tensors were matrices, these operations are not necessary, and the contraction operation is merely the matrix product, yielding the expected result.

two_matrices_contraction_darrays

3-order_tensor_contraction_darrays

jofrevalles commented 10 months ago

Very interesting! This may due to what I found a while ago, Dagger.DArray does not currently support permutedims! https://github.com/JuliaParallel/Dagger.jl/issues/395