Skip to content

Commit 1401bec

Browse files
committed
Deploying to main from @ AMReX-Codes/amrex@6502398 🚀
1 parent dce390d commit 1401bec

File tree

625 files changed

+94584
-87133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

625 files changed

+94584
-87133
lines changed

amrex/docs_html/FFT.html

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
<li class="toctree-l1"><a class="reference internal" href="EB_Chapter.html">Embedded Boundaries</a></li>
6868
<li class="toctree-l1 current"><a class="reference internal" href="FFT_Chapter.html">Discrete Fourier Transform</a><ul class="current">
6969
<li class="toctree-l2 current"><a class="current reference internal" href="#">FFT::R2C Class</a></li>
70+
<li class="toctree-l2"><a class="reference internal" href="#fft-localr2c-class">FFT::LocalR2C Class</a></li>
7071
<li class="toctree-l2"><a class="reference internal" href="#poisson-solver">Poisson Solver</a></li>
7172
</ul>
7273
</li>
@@ -112,18 +113,17 @@
112113
<section id="fft-r2c-class">
113114
<span id="sec-fft-r2c"></span><h1>FFT::R2C Class<a class="headerlink" href="#fft-r2c-class" title="Permalink to this heading"></a></h1>
114115
<p>Class template <cite>FFT::R2C</cite> supports discrete Fourier transforms between real
115-
and complex data. The name R2C indicates that the forward transform converts
116-
real data to complex data, while the backward transform converts complex
117-
data to real data. It should be noted that both directions of transformation
118-
are supported, not just from real to complex.</p>
116+
and complex data across MPI processes. The name R2C indicates that the
117+
forward transform converts real data to complex data, while the backward
118+
transform converts complex data to real data. It should be noted that both
119+
directions of transformation are supported, not just from real to complex.</p>
119120
<p>The implementation utilizes cuFFT, rocFFT, oneMKL and FFTW, for CUDA, HIP,
120121
SYCL and CPU builds, respectively. Because the parallel communication is
121122
handled by AMReX, it does not need the parallel version of
122123
FFTW. Furthermore, there is no constraint on the domain decomposition such
123124
as one Box per process. This class performs parallel FFT on AMReX’s parallel
124125
data containers (e.g., <code class="code highlight cpp c++ docutils literal highlight-c++"><span class="n">MultiFab</span><span class="w"></span></code> and
125-
<code class="code highlight cpp c++ docutils literal highlight-c++"><span class="n">FabArray</span><span class="o">&lt;</span><span class="n">BaseFab</span><span class="o">&lt;</span><span class="n">ComplexData</span><span class="o">&lt;</span><span class="n">Real</span><span class="o">&gt;&gt;&gt;</span><span class="w"></span></code>. For local FFT, the users can
126-
use FFTW, cuFFT, rocFFT, or oneMKL directly.</p>
126+
<code class="code highlight cpp c++ docutils literal highlight-c++"><span class="n">FabArray</span><span class="o">&lt;</span><span class="n">BaseFab</span><span class="o">&lt;</span><span class="n">ComplexData</span><span class="o">&lt;</span><span class="n">Real</span><span class="o">&gt;&gt;&gt;</span><span class="w"></span></code>.</p>
127127
<p>Other than using column-majored order, AMReX follows the convention of
128128
FFTW. Applying the forward transform followed by the backward transform
129129
scales the original data by the size of the input array. The layout of the
@@ -165,6 +165,24 @@
165165
<code class="code highlight cpp c++ docutils literal highlight-c++"><span class="n">FFT</span><span class="o">::</span><span class="n">R2C</span><span class="w"></span></code> does not have a default constructor, one could always use
166166
<code class="code highlight cpp c++ docutils literal highlight-c++"><span class="n">std</span><span class="o">::</span><span class="n">unique_ptr</span><span class="o">&lt;</span><span class="n">FFT</span><span class="o">::</span><span class="n">R2C</span><span class="o">&lt;</span><span class="n">Real</span><span class="o">&gt;&gt;</span><span class="w"></span></code> to store an object in one’s class.</p>
167167
</section>
168+
<section id="fft-localr2c-class">
169+
<span id="sec-fft-localr2c"></span><h1>FFT::LocalR2C Class<a class="headerlink" href="#fft-localr2c-class" title="Permalink to this heading"></a></h1>
170+
<p>Class template <cite>FFT::LocalR2C</cite> supports local discrete Fourier transforms
171+
between real and complex data. The name R2C indicates that the forward
172+
transform converts real data to complex data, while the backward transform
173+
converts complex data to real data. It should be noted that both directions
174+
of transformation are supported, not just from real to complex.</p>
175+
<p>Below is an example of using <code class="code highlight cpp c++ docutils literal highlight-c++"><span class="n">FFT</span><span class="o">::</span><span class="n">LocalR2C</span><span class="w"></span></code>.</p>
176+
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="n">MultiFab</span><span class="w"> </span><span class="nf">mf</span><span class="p">(...);</span><span class="w"></span>
177+
<span class="n">BaseFab</span><span class="o">&lt;</span><span class="n">GpuComplex</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;&gt;</span><span class="w"> </span><span class="n">cfab</span><span class="p">;</span><span class="w"></span>
178+
<span class="k">for</span><span class="w"> </span><span class="p">(</span><span class="n">MFIter</span><span class="w"> </span><span class="n">mfi</span><span class="p">(</span><span class="n">mf</span><span class="p">);</span><span class="w"> </span><span class="n">mfi</span><span class="p">.</span><span class="n">isValid</span><span class="p">();</span><span class="w"> </span><span class="o">++</span><span class="n">mfi</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
179+
<span class="w"> </span><span class="n">FFT</span><span class="o">::</span><span class="n">LocalR2C</span><span class="w"> </span><span class="nf">fft</span><span class="p">(</span><span class="n">mfi</span><span class="p">.</span><span class="n">fabbox</span><span class="p">().</span><span class="n">length</span><span class="p">());</span><span class="w"></span>
180+
<span class="w"> </span><span class="n">cfab</span><span class="p">.</span><span class="n">resize</span><span class="p">(</span><span class="n">IntVect</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span><span class="w"> </span><span class="n">fft</span><span class="p">.</span><span class="n">spectralSize</span><span class="p">()</span><span class="mi">-1</span><span class="p">);</span><span class="w"></span>
181+
<span class="w"> </span><span class="n">fft</span><span class="p">.</span><span class="n">forward</span><span class="p">(</span><span class="n">mf</span><span class="p">[</span><span class="n">mfi</span><span class="p">].</span><span class="n">dataPtr</span><span class="p">(),</span><span class="w"> </span><span class="n">cfab</span><span class="p">.</span><span class="n">dataPtr</span><span class="p">());</span><span class="w"></span>
182+
<span class="p">}</span><span class="w"></span>
183+
</pre></div>
184+
</div>
185+
</section>
168186
<section id="poisson-solver">
169187
<h1>Poisson Solver<a class="headerlink" href="#poisson-solver" title="Permalink to this heading"></a></h1>
170188
<p>AMReX provides FFT based Poisson solvers. Here, Poisson’s equation is</p>

amrex/docs_html/FFT_Chapter.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
<li class="toctree-l1"><a class="reference internal" href="EB_Chapter.html">Embedded Boundaries</a></li>
6767
<li class="toctree-l1 current"><a class="current reference internal" href="#">Discrete Fourier Transform</a><ul>
6868
<li class="toctree-l2"><a class="reference internal" href="FFT.html">FFT::R2C Class</a></li>
69+
<li class="toctree-l2"><a class="reference internal" href="FFT.html#fft-localr2c-class">FFT::LocalR2C Class</a></li>
6970
<li class="toctree-l2"><a class="reference internal" href="FFT.html#poisson-solver">Poisson Solver</a></li>
7071
</ul>
7172
</li>
@@ -116,6 +117,7 @@
116117
<div class="toctree-wrapper compound">
117118
<ul>
118119
<li class="toctree-l1"><a class="reference internal" href="FFT.html">FFT::R2C Class</a></li>
120+
<li class="toctree-l1"><a class="reference internal" href="FFT.html#fft-localr2c-class">FFT::LocalR2C Class</a></li>
119121
<li class="toctree-l1"><a class="reference internal" href="FFT.html#poisson-solver">Poisson Solver</a></li>
120122
</ul>
121123
</div>
Binary file not shown.

amrex/docs_html/_sources/FFT.rst.txt

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@ FFT::R2C Class
77
==============
88

99
Class template `FFT::R2C` supports discrete Fourier transforms between real
10-
and complex data. The name R2C indicates that the forward transform converts
11-
real data to complex data, while the backward transform converts complex
12-
data to real data. It should be noted that both directions of transformation
13-
are supported, not just from real to complex.
10+
and complex data across MPI processes. The name R2C indicates that the
11+
forward transform converts real data to complex data, while the backward
12+
transform converts complex data to real data. It should be noted that both
13+
directions of transformation are supported, not just from real to complex.
1414

1515
The implementation utilizes cuFFT, rocFFT, oneMKL and FFTW, for CUDA, HIP,
1616
SYCL and CPU builds, respectively. Because the parallel communication is
1717
handled by AMReX, it does not need the parallel version of
1818
FFTW. Furthermore, there is no constraint on the domain decomposition such
1919
as one Box per process. This class performs parallel FFT on AMReX's parallel
2020
data containers (e.g., :cpp:`MultiFab` and
21-
:cpp:`FabArray<BaseFab<ComplexData<Real>>>`. For local FFT, the users can
22-
use FFTW, cuFFT, rocFFT, or oneMKL directly.
21+
:cpp:`FabArray<BaseFab<ComplexData<Real>>>`.
2322

2423
Other than using column-majored order, AMReX follows the convention of
2524
FFTW. Applying the forward transform followed by the backward transform
@@ -68,6 +67,32 @@ object. Therefore, one should cache it for reuse if possible. Although
6867
:cpp:`std::unique_ptr<FFT::R2C<Real>>` to store an object in one's class.
6968

7069

70+
.. _sec:FFT:localr2c:
71+
72+
FFT::LocalR2C Class
73+
===================
74+
75+
Class template `FFT::LocalR2C` supports local discrete Fourier transforms
76+
between real and complex data. The name R2C indicates that the forward
77+
transform converts real data to complex data, while the backward transform
78+
converts complex data to real data. It should be noted that both directions
79+
of transformation are supported, not just from real to complex.
80+
81+
Below is an example of using :cpp:`FFT::LocalR2C`.
82+
83+
.. highlight:: c++
84+
85+
::
86+
87+
MultiFab mf(...);
88+
BaseFab<GpuComplex<T>> cfab;
89+
for (MFIter mfi(mf); mfi.isValid(); ++mfi) {
90+
FFT::LocalR2C fft(mfi.fabbox().length());
91+
cfab.resize(IntVect(0), fft.spectralSize()-1);
92+
fft.forward(mf[mfi].dataPtr(), cfab.dataPtr());
93+
}
94+
95+
7196
Poisson Solver
7297
==============
7398

0 commit comments

Comments
 (0)