Overview of Tullio.jl
masterTullio.jl is a flexible einsum macro for Julia that understands various array operations written in index notation. It supports matrix multiplication, permutations, convolutions, stencils, scatter/gather, and broadcasting.
Key features include:
- Automatic Loop Generation: Writes optimized nested loops based on index notation.
- Performance Optimizations: Uses multi-threading (via
Threads.@spawn) and recursive tiling for large arrays. - Package Integration:
- Uses
LoopVectorization.jl(@avx) for high-speed execution (disable withavx=false). - Uses
KernelAbstractions.jl(@kernel) for GPU support (disable withcuda=false).
- Uses
- Automatic Differentiation: Provides gradients for use with
Tracker.jlor viaChainRules.jl(forZygote.jl,Yota.jl, etc.).- Default: Symbolic derivative of the RHS (works for reductions over
+,min, ormax). grad=Dual: UsesForwardDiff.jlfor more complex expressions (only for+reductions).
- Default: Symbolic derivative of the RHS (works for reductions over
@tullio M[x,y,c] := N[x+i, y+j,c] * K[i,j] # sum over i,j, and create M
@tullio S[x] = P[x,y] * log(Q[x,y] / R[y]) # sum over y, and write into S
@tullio A[i,j] += B[i,k,l] * C[l,j] * D[k,j] # sum over k,l, and add to values in A
@tullio (*) Z[j] := X[ind[k],j] * exp(-Y[k]) # product over k