Parameter tuning for the nonuniform FFT and applications
Parameter tuning for the nonuniform FFT and applications
Franziska Nestler Chemnitz University of Technology
Faculty of Mathematics
Mecklenburg Workshop
Approximation Methods and Fast Algorithms September 10 – 14, 2018, Hasenwinkel
Parameter tuning for the nonuniform FFT and applications Overview
Overview
1 Parameter tuning for the NFFT
• Introduction to NFFT
• Error in theL2-norm
• Parameter choice and comparison of window functions
2 Application: interactions in particle systems
• Coulomb problem and Ewald summation
• A fast NFFT based algorithm
• Errors and parameter choice
Parameter tuning for the nonuniform FFT and applications Introduction to NFFT
FFT for nonequispaced data – NFFT
Trig. polynomial: f(x) := X
k∈IM
fˆke2πik>x x∈Td
Notation: SetIM :={−M/2, . . . ,M/2−1}d⊂ZdfürM ∈2N.
TorusT:=R/Z'[−1/2,1/2).
(inverse) FFT: fj := X
k∈IM
fˆke2πik>j/M j∈IM
, N :=|IM|=Md
NFFT: f(xj) := X
k∈IM
fˆke2πik>xj xj∈Td, j= 1, . . . , N
adjoint NFFT: h(k) :=
N
X
j=1
fje−2πik>xj xj∈Td,k∈ IM
Complexity:O(|IM|log|IM|
+N
)
[Dutt, Rokhlin 1993] [Beylkin 1995] [Potts, Steidl, Tasche 2001] [Greengard, Lee 2004]
Parameter tuning for the nonuniform FFT and applications Introduction to NFFT
FFT for nonequispaced data – NFFT
Trig. polynomial: f(x) := X
k∈IM
fˆke2πik>x x∈Td
Notation: SetIM :={−M/2, . . . ,M/2−1}d⊂ZdfürM ∈2N.
TorusT:=R/Z'[−1/2,1/2).
(inverse) FFT: fj := X
k∈IM
fˆke2πik>j/M j∈ IM, N :=|IM|=Md
NFFT: f(xj) := X
k∈IM
fˆke2πik>xj xj∈Td, j= 1, . . . , N
adjoint NFFT: h(k) :=
N
X
j=1
fje−2πik>xj xj∈Td,k∈ IM
Complexity:O(|IM|log|IM|+N)
[Dutt, Rokhlin 1993] [Beylkin 1995]
[Potts, Steidl, Tasche 2001] [Greengard, Lee 2004]
Parameter tuning for the nonuniform FFT and applications Introduction to NFFT
FFT for nonequispaced data – NFFT
Trig. polynomial: f(x) := X
k∈IM
fˆke2πik>x x∈Td
Notation: SetIM :={−M/2, . . . ,M/2−1}d⊂ZdfürM ∈2N.
TorusT:=R/Z'[−1/2,1/2).
(inverse) FFT: fj := X
k∈IM
fˆke2πik>j/M j∈ IM, N :=|IM|=Md
NFFT: f(xj) := X
k∈IM
fˆke2πik>xj xj∈Td, j= 1, . . . , N
adjoint NFFT: h(k) :=
N
X
j=1
fje−2πik>xj xj∈Td,k∈ IM
Complexity:O(|IM|log|IM|+N)
[Dutt, Rokhlin 1993] [Beylkin 1995]
[Potts, Steidl, Tasche 2001] [Greengard, Lee 2004]
Parameter tuning for the nonuniform FFT and applications Introduction to NFFT
Idea
Trace problem back to equidistant case via convolution with awindow function.
iFFT:
gl:= 1 Md
X
k∈IM
1 ck( ˜ϕ)
fˆke2πik>l/M (l∈ IM)
Convolution with window:
f(xj)≈
X
l∈IM
glϕ˜ xj−Ml
=:f≈(xj)
−12
1
0 2 1
M
−mM,Mm
˜ ϕ(x)
−12
1
0 2
Higher accuracy: enlarge support parameterm∈N,oversampling factorσ≥1
Parameter tuning for the nonuniform FFT and applications Introduction to NFFT
Idea
Trace problem back to equidistant case via convolution with awindow function.
iFFT:
gl:= 1 Md
X
k∈IM
1 ck( ˜ϕ)
fˆke2πik>l/M (l∈ IM)
Convolution with window:
f(xj)≈ X
l∈IM
glϕ˜ xj−Ml
=:f≈(xj)
−12
1
0 2 1
M
−mM,Mm
˜ ϕ(x)
−12
1
0 2
Higher accuracy: enlarge support parameterm∈N,oversampling factorσ≥1
Parameter tuning for the nonuniform FFT and applications Introduction to NFFT
Idea
Trace problem back to equidistant case via convolution with awindow function.
iFFT:
gl:= 1 Md
X
k∈IM
1 ck( ˜ϕ)
fˆke2πik>l/M (l∈ IM)
Convolution with window:
f(xj)≈ X
l∈IM
glϕ˜ xj−Ml
=:f≈(xj)
−12
1
0 2 1
M
−mM,Mm
˜ ϕ(x)
−12
1
0 2
Higher accuracy: enlarge support parameterm∈N
,oversampling factorσ≥1
Parameter tuning for the nonuniform FFT and applications Introduction to NFFT
Idea
Trace problem back to equidistant case via convolution with awindow function.
iFFT:
gl:= 1 σdMd
X
k∈IM
1 ck( ˜ϕ)
fˆke2πik>l/σM (l∈ IσM)
Convolution with window:
f(xj)≈ X
l∈IσM
glϕ˜ xj−σMl
=:f≈(xj)
−12
1
0 2 1
σM
−σMm ,σMm
˜ ϕ(x)
−12
1
0 2
Higher accuracy: enlarge support parameterm∈N,oversampling factorσ≥1
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Error in the L
2-norm
In the following we consider the cased:= 1.
Letϕbe a rapidly decreasing function. Commonly, we choose
˜
ϕ(x) :=X
n∈Z
ϕ(x+n).
Forcompactly supportedfunctionsϕwe have
kf−f≈k2L2= X
k∈IM
|fˆk|2 X
r∈Z3
c2k+rσM( ˜ϕ) c2k( ˜ϕ) .
Strongly depends on:
• window functionϕwith support[−m/σM,m/σM]
• support parameterm
• oversampling factorσ
• Fourier coefficientsfˆk
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Error in the L
2-norm
In the following we consider the cased:= 1.
Letϕbe a rapidly decreasing function. Commonly, we choose
˜
ϕ(x) :=X
n∈Z
ϕ(x+n).
Forcompactly supportedfunctionsϕwe have
kf−f≈k2L2= X
k∈IM
|fˆk|2 X
r∈Z3
c2k+rσM( ˜ϕ) c2k( ˜ϕ) .
Strongly depends on:
• window functionϕwith support[−m/σM,m/σM]
• support parameterm
• oversampling factorσ
• Fourier coefficientsfˆk
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Compactly supported window functions
• Centered cardinal B-spline: with support[−σMm,σMm ]
ϕ(x) =B2m(σM x), ck( ˜ϕ) = 1 σMsinc2m
πk σM
• Kaiser-Bessel (Bessel-I0): with ashape parameterb >0 ϕ(x) = 12I0(bp
m2−σ2M2x2)·χ[−m σM,σMm ]
ck( ˜ϕ) = 1 σM
sinh(b√
4π2k2/(σ2M2)−m2)
√b2−4π2k2/(σ2M2) :|k| ≤ σMb2π msinc(mp
4π2k2/(σ2M2)−b2) :else
• Truncated Gaussian: with ashape parameterb >0 ϕ(x) = √1
πbe−σ2M2x2/b·χ[−σMm ,σMm ]
ck( ˜ϕ) = e−bπ2k2/(σ2M2)
σM Re
" erf m
√b+ iπk√ b σM
!#
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Compactly supported window functions
• Centered cardinal B-spline: with support[−σMm,σMm ]
ϕ(x) =B2m(σM x), ck( ˜ϕ) = 1 σMsinc2m
πk σM
• Kaiser-Bessel (Bessel-I0): with ashape parameterb >0 ϕ(x) = 12I0(bp
m2−σ2M2x2)·χ[−m σM,σMm]
ck( ˜ϕ) = 1 σM
sinh(b√
4π2k2/(σ2M2)−m2)
√b2−4π2k2/(σ2M2) :|k| ≤ σMb2π msinc(mp
4π2k2/(σ2M2)−b2) :else
• Truncated Gaussian: with ashape parameterb >0 ϕ(x) = √1
πbe−σ2M2x2/b·χ[−σMm ,σMm ]
ck( ˜ϕ) = e−bπ2k2/(σ2M2)
σM Re
" erf m
√b+ iπk√ b σM
!#
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Compactly supported window functions
• Centered cardinal B-spline: with support[−σMm,σMm ]
ϕ(x) =B2m(σM x), ck( ˜ϕ) = 1 σMsinc2m
πk σM
• Kaiser-Bessel (Bessel-I0): with ashape parameterb >0 ϕ(x) = 12I0(bp
m2−σ2M2x2)·χ[−m σM,σMm]
ck( ˜ϕ) = 1 σM
sinh(b√
4π2k2/(σ2M2)−m2)
√b2−4π2k2/(σ2M2) :|k| ≤ σMb2π msinc(mp
4π2k2/(σ2M2)−b2) :else
• Truncated Gaussian: with ashape parameterb >0 ϕ(x) = √1
πbe−σ2M2x2/b·χ[−σMm ,σMm ]
ck( ˜ϕ) = e−bπ2k2/(σ2M2)
σM Re
"
erf m
√b+ iπk√ b σM
!#
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Estimates for certain window functions
kf−f≈k2L2= X
k∈IM
|fˆk|2 X
r∈Z3
c2k+rσM( ˜ϕ) c2k( ˜ϕ)
| {z }
≤s(k)
≤ X
k∈IM
|fˆk|2s(k).
B-Spline[Steidl 1998]:
s(k) = 8m 4m−1
|k| σM
|k| σM −1
!4m
Bessel[N. 2016]: ForRk> σM|k| +2πb
s(k) = X
0<|r|≤Rk
c2k+rσM( ˜ϕ) c2k( ˜ϕ) + 1
c2k( ˜ϕ) ln
2π(|k|/σM−Rk)−b 2π(|k|/σM−Rk)+b
+ ln
2π(|k|/σM+Rk)+b 2π(|k|/σM+Rk)−b
4πbσ2M2
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Estimates for certain window functions
kf−f≈k2L2= X
k∈IM
|fˆk|2 X
r∈Z3
c2k+rσM( ˜ϕ) c2k( ˜ϕ)
| {z }
≤s(k)
≤ X
k∈IM
|fˆk|2s(k).
B-Spline[Steidl 1998]:
s(k) = 8m 4m−1
|k|
σM
|k|
σM −1
!4m
Bessel[N. 2016]: ForRk> σM|k| +2πb
s(k) = X
0<|r|≤Rk
c2k+rσM( ˜ϕ) c2k( ˜ϕ) + 1
c2k( ˜ϕ) ln
2π(|k|/σM−Rk)−b 2π(|k|/σM−Rk)+b
+ ln
2π(|k|/σM+Rk)+b 2π(|k|/σM+Rk)−b
4πbσ2M2
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Estimates for certain window functions
kf−f≈k2L2= X
k∈IM
|fˆk|2 X
r∈Z3
c2k+rσM( ˜ϕ) c2k( ˜ϕ)
| {z }
≤s(k)
≤ X
k∈IM
|fˆk|2s(k).
B-Spline[Steidl 1998]:
s(k) = 8m 4m−1
|k|
σM
|k|
σM −1
!4m
Bessel[N. 2016]: ForRk>σM|k| +2πb
s(k) = X
0<|r|≤Rk
c2k+rσM( ˜ϕ) c2k( ˜ϕ) + 1
c2k( ˜ϕ) ln
2π(|k|/σM−Rk)−b 2π(|k|/σM−Rk)+b
+ ln
2π(|k|/σM+Rk)+b 2π(|k|/σM+Rk)−b
4πbσ2M2
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Parameter choice
Error estimate:
kf−f≈k2L2 ≤ X
k∈IM
|fˆk|2s(k). (1)
Questions:
• How large to choosem,σin order to reach a certain accuracyε?
• How to choose the shape parameterb?
• Which window function performs best?
fˆkunkown→worst case error analysis fˆkknown→compute (1)
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Parameter choice
Error estimate:
kf−f≈k2L2 ≤ X
k∈IM
|fˆk|2s(k). (1)
Questions:
• How large to choosem,σin order to reach a certain accuracyε?
• How to choose the shape parameterb?
• Which window function performs best?
fˆkunkown→worst case error analysis fˆkknown→compute (1)
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
The optimal shape parameter
In case of theBessel window functiona worst case error analysis suggests[Potts, Steidl 2003]
b:= 2π 1−2σ1
≈
(3.14 :σ=1.0, 3.77 :σ=1.25. Example:Known Fourier coefficients.
2 4 6
10−13 10−8 10−3
shape parameterb kf−f≈k2 L2
fˆk:= 1+k12, k∈I64
2 4 6
10−17 10−11 10−5
shape parameterb kf−f≈k2 L2
fˆk:= e−0.2k2, k∈I64
Estimated (solid) and measured (dotted) errors. Parameters:m= 4,σ∈ {1.0,1.25}.
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
The optimal shape parameter
In case of theBessel window functiona worst case error analysis suggests[Potts, Steidl 2003]
b:= 2π 1−2σ1
≈
(3.14 :σ=1.0, 3.77 :σ=1.25.
Example:Known Fourier coefficients.
2 4 6
10−13 10−8 10−3
shape parameterb kf−f≈k2 L2
fˆk:= 1+k12, k∈I64
2 4 6
10−17 10−11 10−5
shape parameterb kf−f≈k2 L2
fˆk:= e−0.2k2, k∈I64
Estimated (solid) and measured (dotted) errors. Parameters:m= 4,σ∈ {1.0,1.25}.
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
The optimal shape parameter
In case of theBessel window functiona worst case error analysis suggests[Potts, Steidl 2003]
b:= 2π 1−2σ1
≈
(3.14 :σ=1.0, 3.77 :σ=1.25.
Example:Known Fourier coefficients.
2 4 6
10−13 10−8 10−3
shape parameterb kf−f≈k2 L2
fˆk:= 1+k12, k∈I64
2 4 6
10−17 10−11 10−5
shape parameterb kf−f≈k2 L2
fˆk:= e−0.2k2, k∈I64
Estimated (solid) and measured (dotted) errors. Parameters:m= 4,σ∈ {1.0,1.25}.
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Modified B-spline window
Introduce a shape parameterb∈ 12Nand set ϕ(x) :=B2b
σM b m x
.
supp(ϕ) = [−σMm ,σMm ]
Estimate:
For someRk∈Nwe obtain the upper bound[N. 2016]
s(k) = X
0<|r|≤Rk
c2k+rσM( ˜ϕ)
c2k( ˜ϕ) + 1 sinc4b mπkσM b
k
σM +Rk1−4b
− σMk −Rk1−4b πm
b
4b
(4b−1)
.
3 4 5 6
10−9 10−7 10−5
shape parameterb kf−f≈k2 L2
3 4 5 6
10−15 10−10 10−5
shape parameterb kf−f≈k2 L2
fˆk:=1+k12 (left) andfˆk:= e−0.2k2(right),m= 4,σ∈ {1.0,1.25}
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Modified B-spline window
Introduce a shape parameterb∈ 12Nand set ϕ(x) :=B2b
σM b m x
. Estimate: For someRk∈Nwe obtain the upper bound[N. 2016]
s(k) = X
0<|r|≤Rk
c2k+rσM( ˜ϕ)
c2k( ˜ϕ) + 1 sinc4b mπkσM b
k
σM +Rk1−4b
− σMk −Rk1−4b πm
b
4b
(4b−1) .
3 4 5 6
10−9 10−7 10−5
shape parameterb kf−f≈k2 L2
3 4 5 6
10−15 10−10 10−5
shape parameterb kf−f≈k2 L2
fˆk:=1+k12 (left) andfˆk:= e−0.2k2(right),m= 4,σ∈ {1.0,1.25}
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Modified B-spline window
Introduce a shape parameterb∈ 12Nand set ϕ(x) :=B2b
σM b m x
. Estimate: For someRk∈Nwe obtain the upper bound[N. 2016]
s(k) = X
0<|r|≤Rk
c2k+rσM( ˜ϕ)
c2k( ˜ϕ) + 1 sinc4b mπkσM b
k
σM +Rk1−4b
− σMk −Rk1−4b πm
b
4b
(4b−1) .
3 4 5 6
10−9 10−7 10−5
shape parameterb kf−f≈k2 L2
3 4 5 6
10−15 10−10 10−5
shape parameterb kf−f≈k2 L2
fˆk:= 12(left) andfˆk:= e−0.2k2(right),m= 4,σ∈ {1.0,1.25}
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Parameter tuning
(1) Choice of the shape parameter:
• Input:Fourier coefficientsfˆk, support paramterm, oversampling factorσ.
• Determine the optimalbbased on the error estimates and a simple binary search algorithm.
(2) Oversampling factorσ:
• Input:Fourier coefficientsfˆk, support parameterm, required accuracyε.
• Use a simple binary search algorithm to determine the minimal requiredσ.
→For each consideredσoptimizebbased on(1). (3) Minimal runtime:
• Input:Fourier coefficientsfˆk, required accuracyε.
• Consider different support parametersm.
• Determine viable parameter combinations based on(1)and(2).
• The runtime minimizing combination will depend on your implementation, software, hardware etc.
min
{m,σ,b}tmeasure
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Parameter tuning
(1) Choice of the shape parameter:
• Input:Fourier coefficientsfˆk, support paramterm, oversampling factorσ.
• Determine the optimalbbased on the error estimates and a simple binary search algorithm.
(2) Oversampling factorσ:
• Input:Fourier coefficientsfˆk, support parameterm, required accuracyε.
• Use a simple binary search algorithm to determine the minimal requiredσ.
→For each consideredσoptimizebbased on(1).
(3) Minimal runtime:
• Input:Fourier coefficientsfˆk, required accuracyε.
• Consider different support parametersm.
• Determine viable parameter combinations based on(1)and(2).
• The runtime minimizing combination will depend on your implementation, software, hardware etc.
min
{m,σ,b}tmeasure
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Parameter tuning
(1) Choice of the shape parameter:
• Input:Fourier coefficientsfˆk, support paramterm, oversampling factorσ.
• Determine the optimalbbased on the error estimates and a simple binary search algorithm.
(2) Oversampling factorσ:
• Input:Fourier coefficientsfˆk, support parameterm, required accuracyε.
• Use a simple binary search algorithm to determine the minimal requiredσ.
→For each consideredσoptimizebbased on(1).
(3) Minimal runtime:
• Input:Fourier coefficientsfˆk, required accuracyε.
• Consider different support parametersm.
• Determine viable parameter combinations based on(1)and(2).
• The runtime minimizing combination will depend on your implementation, software, hardware etc.
min
{m,σ,b}tmeasure
Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions
Comparison of different window functions
2 4 6 8
10−24 10−14 10−4
support parameterm kf−f≈k2 L2
2 4 6 8
10−35 10−19 10−3
support parameterm kf−f≈k2 L2
Estimated errorskf−f≈k2for different window functions:
*Bessel,oB-spline,+Gaussian (all with optimizedb)
fˆk:=1+k12 (left) andfˆk:= e−0.2k2(right),m∈ {2, . . . ,8},σ={1.0,1.25}
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
The Coulomb problem
Charged particle system: LetNchargesqj∈Rat positionsxj∈R3be given.
Are interested in the electrostatic potentials (xij:=xi−xj):
φ(j) :=
N
X
i=1 i6=j
qi
kxijk, j= 1, . . . , N. → O(N2)?
3d-periodic boundary conditions ChooseS:=Z3,xj∈[−L/2,L/2)3and set
φ(j) :=X
n∈S N
X
i=1 i6=jifn=0
qi
kxij+Lnk
→crystals, etc.
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
The Coulomb problem
Charged particle system: LetNchargesqj∈Rat positionsxj∈R3be given.
Are interested in the electrostatic potentials (xij:=xi−xj):
φ(j) :=
N
X
i=1 i6=j
qi
kxijk, j= 1, . . . , N. → O(N2)?
3d-periodic boundary conditions ChooseS:=Z3,xj∈[−L/2,L/2)3and set
φ(j) :=X
n∈S N
X
i=1 i6=jifn=0
qi
kxij+Lnk
→crystals, etc.
L
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
The Coulomb problem
Charged particle system: LetNchargesqj∈Rat positionsxj∈R3be given.
Are interested in the electrostatic potentials (xij:=xi−xj):
φ(j) :=
N
X
i=1 i6=j
qi
kxijk, j= 1, . . . , N. → O(N2)?
3d-periodic boundary conditions ChooseS:=Z3,xj∈[−L/2,L/2)3and set
φ(j) :=X
n∈S N
X
i=1 i6=jifn=0
qi
kxij+Lnk
→crystals, etc.
Franziska Nestler, TU Chemnitz, Faculty of Mathematics 13
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
The Coulomb problem
Charged particle system: LetNchargesqj∈Rat positionsxj∈R3be given.
Are interested in the electrostatic potentials (xij:=xi−xj):
φ(j) :=
N
X
i=1 i6=j
qi
kxijk, j= 1, . . . , N. → O(N2)?
3d-periodic boundary conditions ChooseS:=Z3,xj∈[−L/2,L/2)3and set
φ(j) :=X
n∈S N
X
i=1 i6=jifn=0
qi
kxij+Lnk
→crystals, etc.
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
Ewald summation
φ(j) =X
n
X
i
qi
kxij+Lnk
Idea: Split kernel function into two parts[Ewald 1921]
1 r
= f(αr) r
| {z } long ranged, continuous
+ 1−f(αr) r
| {z } short ranged, singularity
0 0.2 0.4 0.6 0.8 1 0
2 4 6 8 10
φ(j) =X
n
X
i
qif(αkxij+Lnk) kxij+Lnk
| {z }
Fourier space
+X
n
X
i
qi
1−f(αkxij+Lnk) kxij+Lnk
| {z }
direct via truncation kxij+Lnk ≤rcut
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
Ewald summation
φ(j) =X
n
X
i
qi
kxij+Lnk
Idea: Split kernel function into two parts[Ewald 1921]
1
r = f(αr) r
| {z } long ranged, continuous
+ 1−f(αr) r
| {z } short ranged, singularity
0 0.2 0.4 0.6 0.8 1 0
2 4 6 8 10
φ(j) =X
n
X
i
qif(αkxij+Lnk) kxij+Lnk
| {z }
Fourier space
+X
n
X
i
qi
1−f(αkxij+Lnk) kxij+Lnk
| {z }
direct via truncation kxij+Lnk ≤rcut
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
Ewald summation
φ(j) =X
n
X
i
qi
kxij+Lnk
Idea: Split kernel function into two parts[Ewald 1921]
1
r = f(αr) r
| {z } long ranged, continuous
+ 1−f(αr) r
| {z } short ranged, singularity
0 0.2 0.4 0.6 0.8 1 0
2 4 6 8 10
φ(j) =X
n
X
i
qif(αkxij+Lnk) kxij+Lnk
| {z }
Fourier space
+X
n
X
i
qi
1−f(αkxij+Lnk) kxij+Lnk
| {z }
direct via truncation kxij+Lnk ≤rcut
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
Ewald summation
φ(j) =X
n
X
i
qi
kxij+Lnk
Idea: Split kernel function into two parts[Ewald 1921]
1
r = f(αr) r
| {z } long ranged, continuous
+ 1−f(αr) r
| {z } short ranged, singularity
0 0.2 0.4 0.6 0.8 1 0
2 4 6 8 10
φ(j) =X
n
X
i
qif(αkxij+Lnk) kxij+Lnk
| {z }
Fourier space
+X
n
X
i
qi
1−f(αkxij+Lnk) kxij+Lnk
| {z }
direct via truncation kxij+Lnk ≤rcut
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
Long range parts
Transformation into Fourier space yields[Ewald 1921]
φlong(j) = X
k∈Z3 N
X
i=1
qiψ(k)eˆ 2πik>xij/L.
Classical choice:f(αr) = erf(αr)
→ ψ(k) = (πL)ˆ −1kkk−2e−π2kkk2/(α2L2)
→ rapidly decreasing Fourier coefficients
→ good convergence, truncation of infinite sum
O(NlogN)Alg.P2NFFT [Pippig, Potts 2011]
φlong(j)≈ X
k∈IM
ψ(k)ˆ
N
X
i=1
qie2πik>xi/L
!
| {z }
adjoint NFFT
e−2πik>xj/L
| {z }
NFFT
.
Analogously: computeforcesF(j) =−qj∇xjφ(j) (qj·vector valued NFFT)
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
Long range parts
Transformation into Fourier space yields[Ewald 1921]
φlong(j) = X
k∈Z3 N
X
i=1
qiψ(k)eˆ 2πik>xij/L.
Classical choice:f(αr) = erf(αr)
→ ψ(k) = (πL)ˆ −1kkk−2e−π2kkk2/(α2L2)
→ rapidly decreasing Fourier coefficients
→ good convergence, truncation of infinite sum
O(NlogN)Alg.P2NFFT [Pippig, Potts 2011]
φlong(j)≈ X
k∈IM
ψ(k)ˆ
N
X
i=1
qie2πik>xi/L
!
| {z }
adjoint NFFT
e−2πik>xj/L
| {z }
NFFT
.
Analogously: computeforcesF(j) =−qj∇xjφ(j) (qj·vector valued NFFT)
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
Long range parts
Transformation into Fourier space yields[Ewald 1921]
φlong(j) = X
k∈Z3 N
X
i=1
qiψ(k)eˆ 2πik>xij/L.
Classical choice:f(αr) = erf(αr)
→ ψ(k) = (πL)ˆ −1kkk−2e−π2kkk2/(α2L2)
→ rapidly decreasing Fourier coefficients
→ good convergence,truncationof infinite sum O(NlogN)Alg.P2NFFT [Pippig, Potts 2011]
φlong(j)≈ X
k∈IM
ψ(k)ˆ
N
X
i=1
qie2πik>xi/L
!
| {z }
adjoint NFFT
e−2πik>xj/L
| {z }
NFFT
.
Analogously: computeforcesF(j) =−qj∇xjφ(j) (qj·vector valued NFFT)
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
Error analysis
In Applications: Interested in root mean square (rms) force error
∆F:=
v u u t 1 N
N
X
j=1
kF(j)−F≈(j)k2.
Two different types of errors:
1 Ewald truncation errors [Kolafa, Perram 1992]
→cutoff radiusrcut, splitting parameterα, cutoff parameterM(mesh size)
2 NFFT approximation errors (long range part)
→window functionϕ, support parameterm, oversampling factorσ, shape parameterb
∆FNFFT≈ v u u t 1 N
N
X
j=1
qj2 v u u u t
X
k∈IM
kkk2ψ(k)ˆ 2
X
r∈Z3
c2k+rσM( ˜ϕ) c2k( ˜ϕ)
2
−1
fˆk2(given analytically),error sums (as before, now 3d)
[Hockney, Eastwood 1988] [Pippig 2015] [N. 2016]
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
Error analysis
In Applications: Interested in root mean square (rms) force error
∆F:=
v u u t 1 N
N
X
j=1
kF(j)−F≈(j)k2.
Two different types of errors:
1 Ewald truncation errors [Kolafa, Perram 1992]
→cutoff radiusrcut, splitting parameterα, cutoff parameterM(mesh size)
2 NFFT approximation errors (long range part)
→window functionϕ, support parameterm, oversampling factorσ, shape parameterb
∆FNFFT≈ v u u t 1 N
N
X
j=1
qj2 v u u u t
X
k∈IM
kkk2ψ(k)ˆ 2
X
r∈Z3
c2k+rσM( ˜ϕ) c2k( ˜ϕ)
2
−1
fˆk2(given analytically),error sums (as before, now 3d)
[Hockney, Eastwood 1988] [Pippig 2015] [N. 2016]
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
Error analysis
In Applications: Interested in root mean square (rms) force error
∆F:=
v u u t 1 N
N
X
j=1
kF(j)−F≈(j)k2.
Two different types of errors:
1 Ewald truncation errors [Kolafa, Perram 1992]
→cutoff radiusrcut, splitting parameterα, cutoff parameterM(mesh size)
2 NFFT approximation errors (long range part)
→window functionϕ, support parameterm, oversampling factorσ, shape parameterb
∆FNFFT≈ v u u t 1 N
N
X
j=1
qj2 v u u u t
X
k∈IM
kkk2ψ(k)ˆ 2
X
r∈Z3
c2k+rσM( ˜ϕ) c2k( ˜ϕ)
2
−1
fˆk2(given analytically),error sums (as before, now 3d)
[Hockney, Eastwood 1988] [Pippig 2015] [N. 2016]
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
Parameter tuning approach
Accuracy tuning:
Input: Required level of accuracyε, near field cutoff radiusrcut.
1 Compute optimalαandMbased on
∆Fshort≈! ε and ∆Flong≈! ε.
2 Tune NFFT parameters: ∆FNFFT
≈! ε
For a set of possible support parametersmcompute the corresponding
• required oversampling factorsσ,
• optimal shape parametersb.
Output:α,Mand several combinations{m, σ, b}.
Runtime optimization:depending on implementation, software, hardware
{rcutmin,α,M} min
{m,σ,b}tmeasure
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
Parameter tuning approach
Accuracy tuning:
Input: Required level of accuracyε, near field cutoff radiusrcut.
1 Compute optimalαandMbased on
∆Fshort≈! ε and ∆Flong≈! ε.
2 Tune NFFT parameters: ∆FNFFT
≈! ε
For a set of possible support parametersmcompute the corresponding
• required oversampling factorsσ,
• optimal shape parametersb.
Output:α,Mand several combinations{m, σ, b}.
Runtime optimization:depending on implementation, software, hardware
{rcutmin,α,M} min
{m,σ,b}tmeasure
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
Parameter tuning approach
Accuracy tuning:
Input: Required level of accuracyε, near field cutoff radiusrcut.
1 Compute optimalαandMbased on
∆Fshort≈! ε and ∆Flong≈! ε.
2 Tune NFFT parameters: ∆FNFFT
≈! ε
For a set of possible support parametersmcompute the corresponding
• required oversampling factorsσ,
• optimal shape parametersb.
Output:α,Mand several combinations{m, σ, b}.
Runtime optimization:depending on implementation, software, hardware
{rcutmin,α,M} min
{m,σ,b}tmeasure
Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems
Results / examples
[N. 2016, 2018]• Spending some oversampling is oftentimes advantageous in terms of computational costs.
• Bessel (with optimizedb) outperforms the B-spline window in most cases.
{rcutmin,α,M} min
{m,σ,b}tmeasure
B-spline
m σrequired runtime
3 1.72 0.125
4 1.23 0.077
5 1.08 0.069
6 1.02 0.074
7 1.00 0.079
Bessel
m σrequired runtime
3 1.28 0.074
4 1.00 0.056
5 1.00 0.062
6 1.00 0.069
7 1.00 0.078
Example:Possible combinations ofm,σand corresponding runtimes (for{rcut, α, M}andε= 10−5fixed).
min
{rcut,α,M} min
{m,σ,b}tmeasure
4 5 6 7
6·10−2 8·10−2 0.1
rcut
overallruntime
Example:Typical trend of runtime with respect to near field cutoffrcutfor fixedε(B-splinevs.Bessel).