Skip to content

Commit

Permalink
build based on 114bc8b
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Oct 7, 2024
1 parent f51fadf commit 6fd5700
Show file tree
Hide file tree
Showing 17 changed files with 45 additions and 44 deletions.
2 changes: 1 addition & 1 deletion dev/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-10-07T15:20:15","documenter_version":"1.7.0"}}
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-10-07T15:43:11","documenter_version":"1.7.0"}}
20 changes: 10 additions & 10 deletions dev/examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
[ Int[] ]
end
end</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">4-element Vector{Vector{Vector{Int64}}}:
[[26, 2, 13], [26, 23, 10], [20, 7, 17], [4, 27, 20]]
[[27, 29, 20], [14, 21, 24], [13, 25, 13], [7, 17, 5]]
[[]]
[[]]
[[]]</code></pre><p>Note that only the first entry contains meaningful data in previous output.</p><pre><code class="language-julia hljs">a_rcv = scatter(a_snd,source=1)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">4-element Vector{Vector{Int64}}:
[26, 2, 13]
[26, 23, 10]
[20, 7, 17]
[4, 27, 20]</code></pre><p>After the scatter, all the parts have received their chunk. Now, we can count in parallel.</p><pre><code class="language-julia hljs">b_snd = map(ai-&gt;count(isodd,ai),a_rcv)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">4-element Vector{Int64}:
1
1
[27, 29, 20]
[14, 21, 24]
[13, 25, 13]
[7, 17, 5]</code></pre><p>After the scatter, all the parts have received their chunk. Now, we can count in parallel.</p><pre><code class="language-julia hljs">b_snd = map(ai-&gt;count(isodd,ai),a_rcv)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">4-element Vector{Int64}:
2
1</code></pre><p>Finally we reduce the partial sums.</p><pre><code class="language-julia hljs">b_rcv = reduction(+,b_snd,init=0,destination=1)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">4-element Vector{Int64}:
5
1
3
3</code></pre><p>Finally we reduce the partial sums.</p><pre><code class="language-julia hljs">b_rcv = reduction(+,b_snd,init=0,destination=1)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">4-element Vector{Int64}:
9
0
0
0</code></pre><p>Only the destination rank will receive the correct result.</p><h2 id="Point-to-point-communication"><a class="docs-heading-anchor" href="#Point-to-point-communication">Point-to-point communication</a><a id="Point-to-point-communication-1"></a><a class="docs-heading-anchor-permalink" href="#Point-to-point-communication" title="Permalink"></a></h2><p>Each rank generates some message (in this case an integer 10 times the current rank id). Each rank sends this data to the next rank. The last one sends it to the first, closing the circle. After repeating this exchange a number of times equal to the number of ranks, we check that we ended up with the original message.</p><p>First, each rank generates the ids of the neighbor to send data to.</p><pre><code class="language-julia hljs">using PartitionedArrays
Expand Down Expand Up @@ -167,4 +167,4 @@
x .= 0
Pl = setup(amg(),x,A,b)
_, history = IterativeSolvers.cg!(x,A,b;Pl,log=true)
history</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">Converged after 10 iterations.</code></pre><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../usage/">« Usage</a><a class="docs-footer-nextpage" href="../jacobi_tutorial/">Jacobi method »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Monday 7 October 2024 15:20">Monday 7 October 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
history</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">Converged after 10 iterations.</code></pre><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../usage/">« Usage</a><a class="docs-footer-nextpage" href="../jacobi_tutorial/">Jacobi method »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Monday 7 October 2024 15:43">Monday 7 October 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
2 changes: 1 addition & 1 deletion dev/index.html

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions dev/jacobi_tutorial/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@
[2] = [0.5556122817624403, 0.333265846578943, 0.11118785421447791, -0.11118785421447791, -0.3332569063154697]
[3] = [-0.11119802070547052, -0.333265846578943, -0.5556056460575878, -0.7777511251764432, -1.0]
</code></pre><h2 id="Parallel-execution"><a class="docs-heading-anchor" href="#Parallel-execution">Parallel execution</a><a id="Parallel-execution-1"></a><a class="docs-heading-anchor-permalink" href="#Parallel-execution" title="Permalink"></a></h2><p>After having debugged the code in sequential, we just need to change a couple of code passages to execute the Jacobi method in parallel using MPI. First of all, include the Julia MPI API <code>MPI.jl</code>.</p><pre><code class="language-julia hljs">using MPI</code></pre><p>In general, any Julia program can be executed using <code>MPI.jl</code> like so:</p><pre><code class="language-julia hljs">run(`$(mpiexec()) -np 3 julia -e &#39;println(&quot;hi!&quot;)&#39;`);</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">hi!
hi!hi!</code></pre><p>The command <code>mpiexec</code> launches MPI and <code>-np</code> specifies the number of processes. Instead of passing the code, you can also copy the code in a file called <code>filename.jl</code> and launch the code with</p><pre><code class="nohighlight hljs">run(`$(mpiexec()) -np 3 julia --project=. filename.jl`)</code></pre><h3 id="The-MPI-mode"><a class="docs-heading-anchor" href="#The-MPI-mode">The MPI mode</a><a id="The-MPI-mode-1"></a><a class="docs-heading-anchor-permalink" href="#The-MPI-mode" title="Permalink"></a></h3><p>Now we can call the main function, which calls the parallel Jacobi method, using <code>with_mpi(main)</code>. This expression calls function <code>main</code> &quot;in MPI mode&quot;. Essentially, <code>with_mpi(main)</code> calls function <code>main</code> with function argument <code>distribute_with_mpi</code>. The function <code>distribute_with_mpi</code> in turn creates an <code>MPIArray</code> from a given collection and distributes its items over the ranks of the given MPI communicator <code>comm</code>. (If <code>comm</code> is not specified, the standard communicator <code>MPI.COMM_WORLD</code> is used.) The difference to the debug mode is that now a real distributed <code>MPIArray</code> is used where before <code>DebugArray</code> was employed. To switch back to debug mode, simply replace <code>with_mpi</code> with <code>with_debug</code>.</p><p>Finally the whole syntax is copied in a Julia <code>quote</code> block and run with <code>mpiexec</code>.</p><pre><code class="language-julia hljs">code = quote
hi!
hi!</code></pre><p>The command <code>mpiexec</code> launches MPI and <code>-np</code> specifies the number of processes. Instead of passing the code, you can also copy the code in a file called <code>filename.jl</code> and launch the code with</p><pre><code class="nohighlight hljs">run(`$(mpiexec()) -np 3 julia --project=. filename.jl`)</code></pre><h3 id="The-MPI-mode"><a class="docs-heading-anchor" href="#The-MPI-mode">The MPI mode</a><a id="The-MPI-mode-1"></a><a class="docs-heading-anchor-permalink" href="#The-MPI-mode" title="Permalink"></a></h3><p>Now we can call the main function, which calls the parallel Jacobi method, using <code>with_mpi(main)</code>. This expression calls function <code>main</code> &quot;in MPI mode&quot;. Essentially, <code>with_mpi(main)</code> calls function <code>main</code> with function argument <code>distribute_with_mpi</code>. The function <code>distribute_with_mpi</code> in turn creates an <code>MPIArray</code> from a given collection and distributes its items over the ranks of the given MPI communicator <code>comm</code>. (If <code>comm</code> is not specified, the standard communicator <code>MPI.COMM_WORLD</code> is used.) The difference to the debug mode is that now a real distributed <code>MPIArray</code> is used where before <code>DebugArray</code> was employed. To switch back to debug mode, simply replace <code>with_mpi</code> with <code>with_debug</code>.</p><p>Finally the whole syntax is copied in a Julia <code>quote</code> block and run with <code>mpiexec</code>.</p><pre><code class="language-julia hljs">code = quote
using PartitionedArrays

function main(distribute)
Expand Down Expand Up @@ -192,4 +193,4 @@

end # quote

run(`$(mpiexec()) -np 3 julia --project=. -e $code`);</code></pre><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../examples/">« Examples</a><a class="docs-footer-nextpage" href="../reference/backends/">Back-ends »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Monday 7 October 2024 15:20">Monday 7 October 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
run(`$(mpiexec()) -np 3 julia --project=. -e $code`);</code></pre><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../examples/">« Examples</a><a class="docs-footer-nextpage" href="../reference/backends/">Back-ends »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Monday 7 October 2024 15:43">Monday 7 October 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Binary file modified dev/objects.inv
Binary file not shown.
6 changes: 3 additions & 3 deletions dev/reference/advanced/index.html

Large diffs are not rendered by default.

Loading

0 comments on commit 6fd5700

Please sign in to comment.