3D FFT gets `DivideError: integer division error`
My MWE:
```jl
using Distributed
addprocs(8)
@everywhere using Dagger
using FFTW
N = 64
A = rand(ComplexF64,N,N,N);
DA = DArray(A);
fft(DA)
```
It throws error:
```jl
ERROR: DivideError: integer division error
Stacktrace:
[1] div
@ .\int.jl:295 [inlined]
[2] _cumlength(len::Int64, step::Int64)
@ Dagger E:\.julia\packages\Dagger\Jl5aj\src\array\alloc.jl:62
[3] map
@ .\tuple.jl:383 [inlined]
[4] map
@ .\tuple.jl:386 [inlined]
[5] partition
@ E:\.julia\packages\Dagger\Jl5aj\src\array\alloc.jl:69 [inlined]
[6] zeros(p::Blocks{3}, eltype::Type, dims::Tuple{Int64, Int64, Int64}; assignment::Symbol)
@ Dagger E:\.julia\packages\Dagger\Jl5aj\src\array\alloc.jl:153
[7] zeros
@ E:\.julia\packages\Dagger\Jl5aj\src\array\alloc.jl:151 [inlined]
[8] _fft!(output::DArray{…}, input::DArray{…}, dims::Tuple{…}; decomp::AbstractFFTsExt.Pencil)
@ AbstractFFTsExt E:\.julia\packages\Dagger\Jl5aj\ext\AbstractFFTsExt.jl:124
[9] fft(DA::DArray{ComplexF64, 3, Blocks{3}, typeof(cat)}, dims::Tuple{Int64, Int64, Int64}; decomp::AbstractFFTsExt.Pencil)
@ AbstractFFTsExt E:\.julia\packages\Dagger\Jl5aj\ext\AbstractFFTsExt.jl:62
[10] fft
@ E:\.julia\packages\Dagger\Jl5aj\ext\AbstractFFTsExt.jl:59 [inlined]
[11] fft(DA::DArray{ComplexF64, 3, Blocks{3}, typeof(cat)})
@ AbstractFFTsExt E:\.julia\packages\Dagger\Jl5aj\ext\AbstractFFTsExt.jl:59
[12] top-level scope
@ REPL[30]:1
```
I also tried to manually control the partitions, whereas the `DivideError` cannot be solved:
```jl
DA = DArray(A, Blocks(N,N,div(N,8)));
DA = DArray(A, Blocks(N,N,2));
DA = DArray(A, Blocks(N,N,1));
DA = DArray(A, Blocks(8,8,8));
# Or change N and rerun
N = 20
```
Couldn't figure out how does the error arise from:
https://github.com/JuliaParallel/Dagger.jl/blob/13ac2918978cf51e602ea9cf32ee8cd63d8e019c/src/array/alloc.jl#L68-L71
https://github.com/JuliaParallel/Dagger.jl/blob/13ac2918978cf51e602ea9cf32ee8cd63d8e019c/src/array/alloc.jl#L151-L155
2 条评论