https://github.com/juliaparallel/daggerarrays.jl
Experimental Distributed Arrays package
https://github.com/juliaparallel/daggerarrays.jl
Last synced: 3 months ago
JSON representation
Experimental Distributed Arrays package
- Host: GitHub
- URL: https://github.com/juliaparallel/daggerarrays.jl
- Owner: JuliaParallel
- Created: 2020-08-21T18:15:00.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-14T12:46:44.000Z (about 3 years ago)
- Last Synced: 2025-06-02T22:46:01.609Z (about 1 year ago)
- Language: Julia
- Homepage:
- Size: 25.4 KB
- Stars: 14
- Watchers: 16
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Experimental Distributed Arrays package
This is an attempt to use Tullio.jl to run tensor expressions on Dagger-based distributed arrays.
## Quick links
- You need [this branch](https://github.com/shashi/Tullio.jl/tree/s/lowered) of Tullio.jl
- [DArray struct](https://github.com/JuliaParallel/DaggerArrays.jl/blob/master/src/darray.jl#L15-L24) is how we represent a distributed array
- [`@dtullio` macro](https://github.com/JuliaParallel/DaggerArrays.jl/blob/master/src/tullio.jl#L127-L128) is in this file
## What works
```julia
julia> using DaggerArrays
julia> A = distribute(reshape(1:24, (4,6)), Blocks(2,3))
4×6 DArray{Int64, 2} with 2×2 chunks
julia> B = distribute(reshape(1:24, (6,4)), Blocks(3,2))
6×4 DArray{Int64, 2} with 2×2 chunks
julia> @dtullio C[i,k] := A[i,j] * B[j,k]
4×4 DArray{Any, 2} with 2×2 chunks
```
## What does not work (and should)
```julia
julia> @generated matmul(A, B) = :(@dtullio C[i,k] := A[i,j] * B[j,k])
matmul (generic function with 1 method)
julia> matmul(A,B)
ERROR: The function body AST defined by this @generated function is not pure. This likely means it contains a closure or comprehension.
Stacktrace:
[1] top-level scope at REPL[24]:1
[2] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.2/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288
```
This is required to implement dimension-independent operations
```julia
julia> A = distribute(reshape(1:24, (4,6)), Blocks(2,3))
4×6 DArray{Int64, 2} with 2×2 chunks
julia> B = distribute(reshape(1:24, (6,4)), Blocks(6,2))
6×4 DArray{Int64, 2} with 1×2 chunks
julia> @dtullio C[i,k] := A[i,j] * B[j,k]
ERROR: range of index j must agree
Stacktrace:
[1] top-level scope at /home/shashi/.julia/dev/Tullio/src/macro.jl:777
[2] top-level scope at /home/shashi/.julia/dev/DaggerArrays/src/tullio.jl:103
[3] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.2/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288
```
(Should auto-slice B to match the layout of A)