Skip to content

Commit

Permalink
Deploying to gh-pages from @ 41404fe 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
pancetta committed May 6, 2024
1 parent 507d41d commit f17426b
Show file tree
Hide file tree
Showing 380 changed files with 3,526 additions and 3,432 deletions.
Binary file modified .doctrees/environment.pickle
Binary file not shown.
Binary file modified .doctrees/projects/Hamiltonian.doctree
Binary file not shown.
Binary file modified .doctrees/projects/doc_fput.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified .doctrees/tutorial/doc_step_2_C.doctree
Binary file not shown.
Binary file modified .doctrees/tutorial/doc_step_3_B.doctree
Binary file not shown.
Binary file modified .doctrees/tutorial/doc_step_4_D.doctree
Binary file not shown.
Binary file modified .doctrees/tutorial/doc_step_7_A.doctree
Binary file not shown.
Binary file modified .doctrees/tutorial/doc_step_7_B.doctree
Binary file not shown.
Binary file modified .doctrees/tutorial/doc_step_7_C.doctree
Binary file not shown.
Binary file modified .doctrees/tutorial/doc_step_8_C.doctree
Binary file not shown.
Binary file modified .doctrees/tutorial/step_2.doctree
Binary file not shown.
Binary file modified .doctrees/tutorial/step_3.doctree
Binary file not shown.
Binary file modified .doctrees/tutorial/step_4.doctree
Binary file not shown.
Binary file modified .doctrees/tutorial/step_7.doctree
Binary file not shown.
Binary file modified .doctrees/tutorial/step_8.doctree
Binary file not shown.
Binary file modified _images/timings_SDC_variants_Fisher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/timings_SDC_variants_GrayScott.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
125 changes: 60 additions & 65 deletions _modules/implementations/datatype_classes/cupy_mesh.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,34 @@ <h1>Source code for implementations.problem_classes.generic_MPIFFT_Laplacian</h1
<span class="n">dtype_f</span> <span class="o">=</span> <span class="n">imex_mesh</span>

<span class="n">xp</span> <span class="o">=</span> <span class="n">np</span>
<span class="n">fft_backend</span> <span class="o">=</span> <span class="s1">&#39;fftw&#39;</span>
<span class="n">fft_comm_backend</span> <span class="o">=</span> <span class="s1">&#39;MPI&#39;</span>

<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nvars</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">spectral</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">L</span><span class="o">=</span><span class="mi">2</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">comm</span><span class="o">=</span><span class="n">MPI</span><span class="o">.</span><span class="n">COMM_WORLD</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="s1">&#39;d&#39;</span><span class="p">,</span> <span class="n">x0</span><span class="o">=</span><span class="mf">0.0</span><span class="p">):</span>
<div class="viewcode-block" id="IMEX_Laplacian_MPIFFT.setup_GPU">
<a class="viewcode-back" href="../../../pySDC/implementations.problem_classes.generic_MPIFFT_Laplacian.html#implementations.problem_classes.generic_MPIFFT_Laplacian.IMEX_Laplacian_MPIFFT.setup_GPU">[docs]</a>
<span class="nd">@classmethod</span>
<span class="k">def</span> <span class="nf">setup_GPU</span><span class="p">(</span><span class="bp">cls</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;switch to GPU modules&quot;&quot;&quot;</span>
<span class="kn">import</span> <span class="nn">cupy</span> <span class="k">as</span> <span class="nn">cp</span>
<span class="kn">from</span> <span class="nn">pySDC.implementations.datatype_classes.cupy_mesh</span> <span class="kn">import</span> <span class="n">cupy_mesh</span><span class="p">,</span> <span class="n">imex_cupy_mesh</span>

<span class="bp">cls</span><span class="o">.</span><span class="n">xp</span> <span class="o">=</span> <span class="n">cp</span>

<span class="bp">cls</span><span class="o">.</span><span class="n">dtype_u</span> <span class="o">=</span> <span class="n">cupy_mesh</span>
<span class="bp">cls</span><span class="o">.</span><span class="n">dtype_f</span> <span class="o">=</span> <span class="n">imex_cupy_mesh</span>

<span class="bp">cls</span><span class="o">.</span><span class="n">fft_backend</span> <span class="o">=</span> <span class="s1">&#39;cupy&#39;</span>
<span class="bp">cls</span><span class="o">.</span><span class="n">fft_comm_backend</span> <span class="o">=</span> <span class="s1">&#39;NCCL&#39;</span></div>


<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span> <span class="n">nvars</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">spectral</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">L</span><span class="o">=</span><span class="mi">2</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">pi</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">comm</span><span class="o">=</span><span class="n">MPI</span><span class="o">.</span><span class="n">COMM_WORLD</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="s1">&#39;d&#39;</span><span class="p">,</span> <span class="n">useGPU</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">x0</span><span class="o">=</span><span class="mf">0.0</span>
<span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Initialization routine&quot;&quot;&quot;</span>

<span class="k">if</span> <span class="n">useGPU</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">setup_GPU</span><span class="p">()</span>

<span class="k">if</span> <span class="n">nvars</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">nvars</span> <span class="o">=</span> <span class="p">(</span><span class="mi">128</span><span class="p">,</span> <span class="mi">128</span><span class="p">)</span>

Expand All @@ -100,7 +124,15 @@ <h1>Source code for implementations.problem_classes.generic_MPIFFT_Laplacian</h1
<span class="c1"># Creating FFT structure</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ndim</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">nvars</span><span class="p">)</span>
<span class="n">axes</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ndim</span><span class="p">))</span>
<span class="bp">self</span><span class="o">.</span><span class="n">fft</span> <span class="o">=</span> <span class="n">PFFT</span><span class="p">(</span><span class="n">comm</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">nvars</span><span class="p">),</span> <span class="n">axes</span><span class="o">=</span><span class="n">axes</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">dtype</span><span class="p">,</span> <span class="n">collapse</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">fft</span> <span class="o">=</span> <span class="n">PFFT</span><span class="p">(</span>
<span class="n">comm</span><span class="p">,</span>
<span class="nb">list</span><span class="p">(</span><span class="n">nvars</span><span class="p">),</span>
<span class="n">axes</span><span class="o">=</span><span class="n">axes</span><span class="p">,</span>
<span class="n">dtype</span><span class="o">=</span><span class="n">dtype</span><span class="p">,</span>
<span class="n">collapse</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">backend</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">fft_backend</span><span class="p">,</span>
<span class="n">comm_backend</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">fft_comm_backend</span><span class="p">,</span>
<span class="p">)</span>

<span class="c1"># get test data to figure out type and dimensions</span>
<span class="n">tmp_u</span> <span class="o">=</span> <span class="n">newDistArray</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fft</span><span class="p">,</span> <span class="n">spectral</span><span class="p">)</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ <h3>Navigation</h3>
<h1>Source code for implementations.transfer_classes.TransferMesh_MPIFFT</h1><div class="highlight"><pre>
<span></span><span class="kn">from</span> <span class="nn">pySDC.core.Errors</span> <span class="kn">import</span> <span class="n">TransferError</span>
<span class="kn">from</span> <span class="nn">pySDC.core.SpaceTransfer</span> <span class="kn">import</span> <span class="n">space_transfer</span>
<span class="kn">from</span> <span class="nn">pySDC.implementations.datatype_classes.mesh</span> <span class="kn">import</span> <span class="n">mesh</span><span class="p">,</span> <span class="n">imex_mesh</span>
<span class="kn">from</span> <span class="nn">mpi4py_fft</span> <span class="kn">import</span> <span class="n">PFFT</span><span class="p">,</span> <span class="n">newDistArray</span>


Expand Down Expand Up @@ -74,13 +73,20 @@ <h1>Source code for implementations.transfer_classes.TransferMesh_MPIFFT</h1><di
<span class="bp">self</span><span class="o">.</span><span class="n">ratio</span> <span class="o">=</span> <span class="p">[</span><span class="nb">int</span><span class="p">(</span><span class="n">nf</span> <span class="o">/</span> <span class="n">nc</span><span class="p">)</span> <span class="k">for</span> <span class="n">nf</span><span class="p">,</span> <span class="n">nc</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">Nf</span><span class="p">,</span> <span class="n">Nc</span><span class="p">)]</span>
<span class="n">axes</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">Nf</span><span class="p">)))</span>

<span class="n">fft_args</span> <span class="o">=</span> <span class="p">{}</span>
<span class="n">useGPU</span> <span class="o">=</span> <span class="s1">&#39;cupy&#39;</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fine_prob</span><span class="o">.</span><span class="n">dtype_u</span><span class="o">.</span><span class="vm">__name__</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span>
<span class="k">if</span> <span class="n">useGPU</span><span class="p">:</span>
<span class="n">fft_args</span><span class="p">[</span><span class="s1">&#39;backend&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;cupy&#39;</span>
<span class="n">fft_args</span><span class="p">[</span><span class="s1">&#39;comm_backend&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;NCCL&#39;</span>

<span class="bp">self</span><span class="o">.</span><span class="n">fft_pad</span> <span class="o">=</span> <span class="n">PFFT</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">coarse_prob</span><span class="o">.</span><span class="n">comm</span><span class="p">,</span>
<span class="n">Nc</span><span class="p">,</span>
<span class="n">padding</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">ratio</span><span class="p">,</span>
<span class="n">axes</span><span class="o">=</span><span class="n">axes</span><span class="p">,</span>
<span class="n">dtype</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">coarse_prob</span><span class="o">.</span><span class="n">fft</span><span class="o">.</span><span class="n">dtype</span><span class="p">(</span><span class="kc">False</span><span class="p">),</span>
<span class="n">slab</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="o">**</span><span class="n">fft_args</span><span class="p">,</span>
<span class="p">)</span>

<div class="viewcode-block" id="fft_to_fft.restrict">
Expand Down Expand Up @@ -120,7 +126,7 @@ <h1>Source code for implementations.transfer_classes.TransferMesh_MPIFFT</h1><di
<span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">F</span><span class="p">),</span> <span class="s1">&#39;components&#39;</span><span class="p">):</span>
<span class="k">for</span> <span class="n">comp</span> <span class="ow">in</span> <span class="n">F</span><span class="o">.</span><span class="n">components</span><span class="p">:</span>
<span class="n">_restrict</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="fm">__getattr__</span><span class="p">(</span><span class="n">comp</span><span class="p">),</span> <span class="n">G</span><span class="o">.</span><span class="fm">__getattr__</span><span class="p">(</span><span class="n">comp</span><span class="p">))</span>
<span class="k">elif</span> <span class="nb">type</span><span class="p">(</span><span class="n">F</span><span class="p">)</span><span class="o">.</span><span class="vm">__name__</span> <span class="o">==</span> <span class="s1">&#39;mesh&#39;</span><span class="p">:</span>
<span class="k">elif</span> <span class="nb">type</span><span class="p">(</span><span class="n">F</span><span class="p">)</span><span class="o">.</span><span class="vm">__name__</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">&#39;mesh&#39;</span><span class="p">,</span> <span class="s1">&#39;cupy_mesh&#39;</span><span class="p">]:</span>
<span class="n">_restrict</span><span class="p">(</span><span class="n">F</span><span class="p">,</span> <span class="n">G</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">TransferError</span><span class="p">(</span><span class="s1">&#39;Wrong data type for restriction, got </span><span class="si">%s</span><span class="s1">&#39;</span> <span class="o">%</span> <span class="nb">type</span><span class="p">(</span><span class="n">F</span><span class="p">))</span>
Expand Down Expand Up @@ -167,7 +173,7 @@ <h1>Source code for implementations.transfer_classes.TransferMesh_MPIFFT</h1><di
<span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">F</span><span class="p">),</span> <span class="s1">&#39;components&#39;</span><span class="p">):</span>
<span class="k">for</span> <span class="n">comp</span> <span class="ow">in</span> <span class="n">F</span><span class="o">.</span><span class="n">components</span><span class="p">:</span>
<span class="n">_prolong</span><span class="p">(</span><span class="n">G</span><span class="o">.</span><span class="fm">__getattr__</span><span class="p">(</span><span class="n">comp</span><span class="p">),</span> <span class="n">F</span><span class="o">.</span><span class="fm">__getattr__</span><span class="p">(</span><span class="n">comp</span><span class="p">))</span>
<span class="k">elif</span> <span class="nb">type</span><span class="p">(</span><span class="n">G</span><span class="p">)</span><span class="o">.</span><span class="vm">__name__</span> <span class="o">==</span> <span class="s1">&#39;mesh&#39;</span><span class="p">:</span>
<span class="k">elif</span> <span class="nb">type</span><span class="p">(</span><span class="n">G</span><span class="p">)</span><span class="o">.</span><span class="vm">__name__</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">&#39;mesh&#39;</span><span class="p">,</span> <span class="s1">&#39;cupy_mesh&#39;</span><span class="p">]:</span>
<span class="n">_prolong</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="n">F</span><span class="p">)</span>

<span class="k">else</span><span class="p">:</span>
Expand Down
Loading

0 comments on commit f17426b

Please sign in to comment.