mirror of
https://github.com/fverdugo/XM_40017.git
synced 2025-11-10 17:14:23 +01:00
Some cleanup and restructuring
This commit is contained in:
parent
ecebbdbab1
commit
a6b8b7e051
21
docs/make.jl
21
docs/make.jl
@ -102,14 +102,14 @@ end
|
||||
|
||||
# Loop over notebooks and generate html and markdown
|
||||
notebook_files = glob("*.ipynb", "docs/src/notebooks/")
|
||||
#for filepath in notebook_files
|
||||
# convert_embedded_img_to_base64(filepath)
|
||||
# create_md_nb_file(filepath)
|
||||
# filename_with_ext = splitpath(filepath)[end]
|
||||
# filename = splitext(filename_with_ext)[1]
|
||||
# convert_notebook_to_html(filepath, output_name = filename)
|
||||
# modify_notebook_html("docs/src/notebook-output/$(filename).html")
|
||||
#end
|
||||
for filepath in notebook_files
|
||||
convert_embedded_img_to_base64(filepath)
|
||||
create_md_nb_file(filepath)
|
||||
filename_with_ext = splitpath(filepath)[end]
|
||||
filename = splitext(filename_with_ext)[1]
|
||||
convert_notebook_to_html(filepath, output_name = filename)
|
||||
modify_notebook_html("docs/src/notebook-output/$(filename).html")
|
||||
end
|
||||
|
||||
makedocs(;
|
||||
modules=[XM_40017],
|
||||
@ -125,8 +125,9 @@ makedocs(;
|
||||
"Julia Basics" => "julia_basics.md",
|
||||
"Tasks and channels" => "julia_async.md",
|
||||
"Remote calls and remote channels" => "julia_distributed.md",
|
||||
"Matrix Multiplication"=>["Matrix Multiplication" => "matrix_matrix.md", "Solutions" => "sol_matrix_matrix.md"],
|
||||
"Jacobi/SOR" => "julia_jacobi.md"
|
||||
"Matrix Multiplication"=>"matrix_matrix.md",
|
||||
"Jacobi/SOR" => "julia_jacobi.md",
|
||||
"Solutions" => "sol_matrix_matrix.md"
|
||||
]],
|
||||
)
|
||||
|
||||
|
||||
@ -8,8 +8,9 @@ Welcome to the interactive lecture notes of the [Programming Large-Scale Paralle
|
||||
## What
|
||||
|
||||
This page contains part of the course material of the Programming Large-Scale Parallel Systems course at VU Amsterdam.
|
||||
Further information about this course is found in the study guide
|
||||
([click here](https://studiegids.vu.nl/EN/courses/2023-2024/XM_40017#/)) and our Canvas page (for registered students). This material consists of several lecture notes in jupyter notebook format, which will help you to learn how to design, analyze, and program parallel algorithms on multi-node computing systems.
|
||||
In this page, we provide several lecture notes in jupyter notebook format, which will help you to learn how to design, analyze, and program parallel algorithms on multi-node computing systems.
|
||||
Further information about the course is found in the study guide
|
||||
([click here](https://studiegids.vu.nl/EN/courses/2023-2024/XM_40017#/)) and our Canvas page (for registered students).
|
||||
|
||||
!!! note
|
||||
This page contains only part of the course material. The rest is available on Canvas. In particular, **the lecture notes in this public webpage do not fully cover all topics in the final exam**.
|
||||
@ -30,17 +31,6 @@ To run a notebook locally follow these steps:
|
||||
- Install Julia (if not done already). More information in [Getting started](@ref).
|
||||
- Download the notebook.
|
||||
- Launch Julia. More information in [Getting started](@ref).
|
||||
```
|
||||
_ _ _(_)_ | Documentation: https://docs.julialang.org
|
||||
(_) | (_) (_) |
|
||||
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
|
||||
| | | | | | |/ _` | |
|
||||
| | |_| | | | (_| | | Version 1.9.0 (2023-05-07)
|
||||
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|
||||
|__/ |
|
||||
|
||||
julia>
|
||||
```
|
||||
- Execute these commands in the Julia command line:
|
||||
|
||||
```
|
||||
|
||||
@ -14600,9 +14600,7 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/VU_logo.png/800px-VU_logo.png?20161029201021" width="350">
|
||||
<h3 id="Programming-large-scale-parallel-systems">Programming large-scale parallel systems<a class="anchor-link" href="#Programming-large-scale-parallel-systems">¶</a></h3><h3 id="Lectures-on-Julia-for-HPC">Lectures on Julia for HPC<a class="anchor-link" href="#Lectures-on-Julia-for-HPC">¶</a></h3><h1 id="Asynchronous-programming-in-Julia">Asynchronous programming in Julia<a class="anchor-link" href="#Asynchronous-programming-in-Julia">¶</a></h1><p>by Francesc Verdugo (VU Amsterdam)</p>
|
||||
<p>Version fall 2022</p>
|
||||
|
||||
<h3 id="Programming-large-scale-parallel-systems">Programming large-scale parallel systems<a class="anchor-link" href="#Programming-large-scale-parallel-systems">¶</a></h3><h1 id="Asynchronous-programming-in-Julia">Asynchronous programming in Julia<a class="anchor-link" href="#Asynchronous-programming-in-Julia">¶</a></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -15416,8 +15414,7 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h2 id="Questions">Questions<a class="anchor-link" href="#Questions">¶</a></h2><p>How long the next cells will take each?</p>
|
||||
<h3 id="Q1-(Asynchronous.ipynb)">Q1 (Asynchronous.ipynb)<a class="anchor-link" href="#Q1-(Asynchronous.ipynb)">¶</a></h3>
|
||||
<h2 id="Questions">Questions<a class="anchor-link" href="#Questions">¶</a></h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -15429,7 +15426,7 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
<div class="jp-InputPrompt jp-InputArea-prompt">In [ ]:</div>
|
||||
<div class="jp-CodeMirrorEditor jp-Editor jp-InputArea-editor" data-type="inline">
|
||||
<div class="CodeMirror cm-s-jupyter">
|
||||
<div class=" highlight hl-julia"><pre><span></span><span class="nd">@time</span><span class="w"> </span><span class="n">compute_π</span><span class="p">(</span><span class="mi">100_000_000</span><span class="p">)</span>
|
||||
<div class=" highlight hl-julia"><pre><span></span><span class="n">t</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nd">@elapsed</span><span class="w"> </span><span class="n">compute_π</span><span class="p">(</span><span class="mi">100_000_000</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
@ -15437,6 +15434,25 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<div class="alert alert-block alert-success">
|
||||
<b>Question (Q1):</b> How long will the compute time of next cell be?
|
||||
</div>
|
||||
<pre><code>a) 10*t
|
||||
b) t
|
||||
c) 0.1*t
|
||||
d) near 0*t
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs ">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
|
||||
@ -15462,7 +15478,16 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h3 id="Q2-(Asynchronous.ipynb)">Q2 (Asynchronous.ipynb)<a class="anchor-link" href="#Q2-(Asynchronous.ipynb)">¶</a></h3>
|
||||
<div class="alert alert-block alert-success">
|
||||
<b>Question (Q2):</b> How long will the compute time of next cell be?
|
||||
</div>
|
||||
<pre><code>a) 10*t
|
||||
b) t
|
||||
c) 0.1*t
|
||||
d) near 0*t
|
||||
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -15491,7 +15516,15 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h3 id="Q3-(Asynchronous.ipynb)">Q3 (Asynchronous.ipynb)<a class="anchor-link" href="#Q3-(Asynchronous.ipynb)">¶</a></h3>
|
||||
<div class="alert alert-block alert-success">
|
||||
<b>Question (Q3):</b> How long will the compute time of next cell be?
|
||||
</div>
|
||||
<pre><code>a) 10*t
|
||||
b) t
|
||||
c) 0.1*t
|
||||
d) near 0*t
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -15520,7 +15553,15 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h3 id="Q4-(Asynchronous.ipynb)">Q4 (Asynchronous.ipynb)<a class="anchor-link" href="#Q4-(Asynchronous.ipynb)">¶</a></h3>
|
||||
<div class="alert alert-block alert-success">
|
||||
<b>Question (Q4):</b> How long will the compute time of the 2nd cell be?
|
||||
</div>
|
||||
<pre><code>a) infinity
|
||||
b) 1 second
|
||||
c) near 0 seconds
|
||||
d) 3 seconds
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -15568,7 +15609,15 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h3 id="Q5-(Asynchronous.ipynb)">Q5 (Asynchronous.ipynb)<a class="anchor-link" href="#Q5-(Asynchronous.ipynb)">¶</a></h3>
|
||||
<div class="alert alert-block alert-success">
|
||||
<b>Question (Q5):</b> How long will the compute time of the 2nd cell be?
|
||||
</div>
|
||||
<pre><code>a) infinity
|
||||
b) 1 second
|
||||
c) near 0 seconds
|
||||
d) 3 seconds
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -14600,9 +14600,7 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/VU_logo.png/800px-VU_logo.png?20161029201021" width="350">
|
||||
<h3 id="Programming-large-scale-parallel-systems">Programming large-scale parallel systems<a class="anchor-link" href="#Programming-large-scale-parallel-systems">¶</a></h3><h3 id="Lectures-on-Julia-for-HPC">Lectures on Julia for HPC<a class="anchor-link" href="#Lectures-on-Julia-for-HPC">¶</a></h3><h1 id="Basics-of-Julia">Basics of Julia<a class="anchor-link" href="#Basics-of-Julia">¶</a></h1><p>by Francesc Verdugo (VU Amsterdam)</p>
|
||||
<p>Version fall 2022</p>
|
||||
|
||||
<h3 id="Programming-large-scale-parallel-systems">Programming large-scale parallel systems<a class="anchor-link" href="#Programming-large-scale-parallel-systems">¶</a></h3><h1 id="Julia-basics">Julia basics<a class="anchor-link" href="#Julia-basics">¶</a></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -15188,7 +15186,9 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h3 id="Question-1">Question 1<a class="anchor-link" href="#Question-1">¶</a></h3><p>Which will be the value of <code>x</code> in the last line ?</p>
|
||||
<div class="alert alert-block alert-success">
|
||||
<b>Question:</b> Which will be the value of `x` in the last line ? (Think your answer before executing next cell to find out the result)
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -15250,7 +15250,7 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<p>Once defined, a function can be called using bracket notation.</p>
|
||||
<p>Once defined, a function can be called using bracket notation as you would expect.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -15263,7 +15263,7 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
<div class="jp-InputPrompt jp-InputArea-prompt">In [ ]:</div>
|
||||
<div class="jp-CodeMirrorEditor jp-Editor jp-InputArea-editor" data-type="inline">
|
||||
<div class="CodeMirror cm-s-jupyter">
|
||||
<div class=" highlight hl-julia"><pre><span></span><span class="n">result</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">add</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">)</span>
|
||||
<div class=" highlight hl-julia"><pre><span></span><span class="n">add</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
@ -15329,6 +15329,57 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<div class="alert alert-block alert-success">
|
||||
<b>Question:</b> Which will be the value of `x` in the last line ?
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs ">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea">
|
||||
<div class="jp-InputPrompt jp-InputArea-prompt">In [ ]:</div>
|
||||
<div class="jp-CodeMirrorEditor jp-Editor jp-InputArea-editor" data-type="inline">
|
||||
<div class="CodeMirror cm-s-jupyter">
|
||||
<div class=" highlight hl-julia"><pre><span></span><span class="k">function</span><span class="w"> </span><span class="n">q</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
|
||||
<span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">2</span>
|
||||
<span class="w"> </span><span class="n">x</span>
|
||||
<span class="k">end</span>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs ">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea">
|
||||
<div class="jp-InputPrompt jp-InputArea-prompt">In [ ]:</div>
|
||||
<div class="jp-CodeMirrorEditor jp-Editor jp-InputArea-editor" data-type="inline">
|
||||
<div class="CodeMirror cm-s-jupyter">
|
||||
<div class=" highlight hl-julia"><pre><span></span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span>
|
||||
<span class="n">y</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">q</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
|
||||
<span class="n">x</span>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
@ -15922,7 +15973,9 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h3 id="Question-2">Question 2<a class="anchor-link" href="#Question-2">¶</a></h3><p>Which will be the value of <code>x</code> below?</p>
|
||||
<div class="alert alert-block alert-success">
|
||||
<b>Question:</b> Which will be the value of `x` below?
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -14600,36 +14600,10 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/VU_logo.png/800px-VU_logo.png?20161029201021" width="350">
|
||||
<h3 id="Programming-large-scale-parallel-systems">Programming large-scale parallel systems<a class="anchor-link" href="#Programming-large-scale-parallel-systems">¶</a></h3><h3 id="Lectures-on-Julia-for-HPC">Lectures on Julia for HPC<a class="anchor-link" href="#Lectures-on-Julia-for-HPC">¶</a></h3>
|
||||
<h3 id="Programming-large-scale-parallel-systems">Programming large-scale parallel systems<a class="anchor-link" href="#Programming-large-scale-parallel-systems">¶</a></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs ">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea">
|
||||
<div class="jp-InputPrompt jp-InputArea-prompt">In [ ]:</div>
|
||||
<div class="jp-CodeMirrorEditor jp-Editor jp-InputArea-editor" data-type="inline">
|
||||
<div class="CodeMirror cm-s-jupyter">
|
||||
<div class=" highlight hl-julia"><pre><span></span><span class="k">using</span><span class="w"> </span><span class="n">Printf</span>
|
||||
|
||||
<span class="k">function</span><span class="w"> </span><span class="n">answer_checker</span><span class="p">(</span><span class="n">answer</span><span class="p">,</span><span class="n">solution</span><span class="p">)</span>
|
||||
<span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">answer</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">solution</span>
|
||||
<span class="w"> </span><span class="s">"🥳 Well done! "</span>
|
||||
<span class="w"> </span><span class="k">else</span>
|
||||
<span class="w"> </span><span class="s">"It's not correct. Keep trying! 💪"</span>
|
||||
<span class="w"> </span><span class="k">end</span><span class="w"> </span><span class="o">|></span><span class="w"> </span><span class="n">println</span>
|
||||
<span class="k">end</span>
|
||||
<span class="n">q_1_check</span><span class="p">(</span><span class="n">answer</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">answer_checker</span><span class="p">(</span><span class="n">answer</span><span class="p">,</span><span class="s">"a"</span><span class="p">)</span>
|
||||
<span class="n">q_2_check</span><span class="p">(</span><span class="n">answer</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">answer_checker</span><span class="p">(</span><span class="n">answer</span><span class="p">,</span><span class="s">"b"</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
@ -14637,9 +14611,7 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h1 id="Distributed-computing-in-Julia">Distributed computing in Julia<a class="anchor-link" href="#Distributed-computing-in-Julia">¶</a></h1><p>by Francesc Verdugo (VU Amsterdam)</p>
|
||||
<p>Version fall 2022</p>
|
||||
|
||||
<h1 id="Distributed-computing-in-Julia">Distributed computing in Julia<a class="anchor-link" href="#Distributed-computing-in-Julia">¶</a></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -14661,6 +14633,45 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<div class="alert alert-block alert-info">
|
||||
<b>Note:</b> Do not forget to execute the next cell before starting this notebook!
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs ">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea">
|
||||
<div class="jp-InputPrompt jp-InputArea-prompt">In [ ]:</div>
|
||||
<div class="jp-CodeMirrorEditor jp-Editor jp-InputArea-editor" data-type="inline">
|
||||
<div class="CodeMirror cm-s-jupyter">
|
||||
<div class=" highlight hl-julia"><pre><span></span><span class="k">using</span><span class="w"> </span><span class="n">Printf</span>
|
||||
<span class="k">function</span><span class="w"> </span><span class="n">answer_checker</span><span class="p">(</span><span class="n">answer</span><span class="p">,</span><span class="n">solution</span><span class="p">)</span>
|
||||
<span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">answer</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">solution</span>
|
||||
<span class="w"> </span><span class="s">"🥳 Well done! "</span>
|
||||
<span class="w"> </span><span class="k">else</span>
|
||||
<span class="w"> </span><span class="s">"It's not correct. Keep trying! 💪"</span>
|
||||
<span class="w"> </span><span class="k">end</span><span class="w"> </span><span class="o">|></span><span class="w"> </span><span class="n">println</span>
|
||||
<span class="k">end</span>
|
||||
<span class="n">q_1_check</span><span class="p">(</span><span class="n">answer</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">answer_checker</span><span class="p">(</span><span class="n">answer</span><span class="p">,</span><span class="s">"a"</span><span class="p">)</span>
|
||||
<span class="n">q_2_check</span><span class="p">(</span><span class="n">answer</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">answer_checker</span><span class="p">(</span><span class="n">answer</span><span class="p">,</span><span class="s">"b"</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
@ -15625,7 +15636,9 @@ bottlenecks. Being aware of the data we are moving when using functions such as
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h3 id="Q1-(Distributed.ipynb)">Q1 (Distributed.ipynb)<a class="anchor-link" href="#Q1-(Distributed.ipynb)">¶</a></h3><p>How many integers are transferred between master and worker? Including both directions.</p>
|
||||
<div class="alert alert-block alert-success">
|
||||
<b>Question (Q1):</b> How many integers are transferred between master and worker? Including both directions.
|
||||
</div>
|
||||
<div class="highlight"><pre><span></span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">rand</span><span class="p">(</span><span class="kt">Int</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">4</span><span class="p">)</span>
|
||||
<span class="n">proc</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">4</span>
|
||||
<span class="nd">@fetchfrom</span><span class="w"> </span><span class="n">proc</span><span class="w"> </span><span class="n">sum</span><span class="p">(</span><span class="n">a</span><span class="o">^</span><span class="mi">2</span><span class="p">)</span>
|
||||
@ -15663,7 +15676,9 @@ d) 65
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h3 id="Q2-(Distributed.ipynb)">Q2 (Distributed.ipynb)<a class="anchor-link" href="#Q2-(Distributed.ipynb)">¶</a></h3><p>How many integers are transferred between master and worker? Including both directions.</p>
|
||||
<div class="alert alert-block alert-success">
|
||||
<b>Question (Q2):</b> How many integers are transferred between master and worker? Including both directions.
|
||||
</div>
|
||||
<div class="highlight"><pre><span></span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">rand</span><span class="p">(</span><span class="kt">Int</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">4</span><span class="p">)</span>
|
||||
<span class="n">proc</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">4</span>
|
||||
<span class="nd">@fetchfrom</span><span class="w"> </span><span class="n">proc</span><span class="w"> </span><span class="n">sum</span><span class="p">(</span><span class="n">a</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">]</span><span class="o">^</span><span class="mi">2</span><span class="p">)</span>
|
||||
@ -15701,7 +15716,9 @@ d) 32
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h3 id="Q3-(Distributed.ipynb)">Q3 (Distributed.ipynb)<a class="anchor-link" href="#Q3-(Distributed.ipynb)">¶</a></h3><p>Which value will be the value of <code>x</code> ?</p>
|
||||
<div class="alert alert-block alert-success">
|
||||
<b>Question (Q3):</b> Which value will be the value of `x` ?
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -15733,7 +15750,10 @@ d) 32
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h3 id="Q4-(Distributed.ipynb)">Q4 (Distributed.ipynb)<a class="anchor-link" href="#Q4-(Distributed.ipynb)">¶</a></h3><p>Which value will be the value of <code>x</code> ?</p>
|
||||
<div class="alert alert-block alert-success">
|
||||
<b>Question (Q4):</b> Which value will be the value of `x` ?
|
||||
</div>
|
||||
<p>Which value will be the value of <code>x</code> ?</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -14593,6 +14593,46 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
<!-- End of mathjax configuration --></head>
|
||||
<body class="jp-Notebook" data-jp-theme-light="true" data-jp-theme-name="JupyterLab Light">
|
||||
|
||||
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/VU_logo.png/800px-VU_logo.png?20161029201021" width="350">
|
||||
<h3 id="Programming-large-scale-parallel-systems">Programming large-scale parallel systems<a class="anchor-link" href="#Programming-large-scale-parallel-systems">¶</a></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h1 id="Matrix-matrix-multiplication">Matrix-matrix multiplication<a class="anchor-link" href="#Matrix-matrix-multiplication">¶</a></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h2 id="Contents">Contents<a class="anchor-link" href="#Contents">¶</a></h2><p>In this notebook, we will:</p>
|
||||
<ul>
|
||||
<li>Parallelize a simple algorithm</li>
|
||||
<li>Study the performance of different parallelization strategies</li>
|
||||
<li>Implement them using Julia</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
|
||||
@ -14657,34 +14697,6 @@ body[data-format='mobile'] .jp-OutputArea-child .jp-OutputArea-output {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h1 id="Distributed-matrix-matrix-multiplication">Distributed matrix-matrix multiplication<a class="anchor-link" href="#Distributed-matrix-matrix-multiplication">¶</a></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h2 id="Contents">Contents<a class="anchor-link" href="#Contents">¶</a></h2><p>In this notebook, we will:</p>
|
||||
<ul>
|
||||
<li>Parallelize a simple algorithm</li>
|
||||
<li>Study the performance of different parallelization strategies</li>
|
||||
<li>Implement them using Julia</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell">
|
||||
<div class="jp-Cell-inputWrapper">
|
||||
@ -15778,7 +15790,7 @@ d) O(N²/P) communication and O(N³/P) computation
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h3 id="Implementation-of-algorithm-3">Implementation of algorithm 3<a class="anchor-link" href="#Implementation-of-algorithm-3">¶</a></h3><p>Implement algorithm 3 in the function below. For simplicity, assume that the number of rows of C is a multiple of the number of workers.</p>
|
||||
<h3 id="Exercise-1">Exercise 1<a class="anchor-link" href="#Exercise-1">¶</a></h3><p>Implement algorithm 3 in the function below. For simplicity, assume that the number of rows of C is a multiple of the number of workers.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -15891,7 +15903,7 @@ d) O(N²/P) communication and O(N³/P) computation
|
||||
</div>
|
||||
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
|
||||
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput " data-mime-type="text/markdown">
|
||||
<h3 id="A-more-practical-version-of-algorithm-1">A more practical version of algorithm 1<a class="anchor-link" href="#A-more-practical-version-of-algorithm-1">¶</a></h3>
|
||||
<h3 id="Exercise-2">Exercise 2<a class="anchor-link" href="#Exercise-2">¶</a></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -8,14 +8,9 @@
|
||||
"<img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/VU_logo.png/800px-VU_logo.png?20161029201021\" width=\"350\">\n",
|
||||
"\n",
|
||||
"### Programming large-scale parallel systems\n",
|
||||
"### Lectures on Julia for HPC\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# Asynchronous programming in Julia\n",
|
||||
"\n",
|
||||
"by Francesc Verdugo (VU Amsterdam)\n",
|
||||
"\n",
|
||||
"Version fall 2022"
|
||||
"# Asynchronous programming in Julia\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -583,14 +578,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "2a23b1c3",
|
||||
"id": "81de1c86",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Questions\n",
|
||||
"\n",
|
||||
"How long the next cells will take each?\n",
|
||||
"\n",
|
||||
"### Q1 (Asynchronous.ipynb)"
|
||||
"## Questions"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -600,7 +591,22 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"@time compute_π(100_000_000)"
|
||||
"t = @elapsed compute_π(100_000_000)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "2a23b1c3",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q1):</b> How long will the compute time of next cell be? \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
" a) 10*t\n",
|
||||
" b) t\n",
|
||||
" c) 0.1*t\n",
|
||||
" d) near 0*t \n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -620,7 +626,15 @@
|
||||
"id": "5f19d38c",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Q2 (Asynchronous.ipynb)"
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q2):</b> How long will the compute time of next cell be? \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
" a) 10*t\n",
|
||||
" b) t\n",
|
||||
" c) 0.1*t\n",
|
||||
" d) near 0*t \n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -640,7 +654,14 @@
|
||||
"id": "5041c355",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Q3 (Asynchronous.ipynb)"
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q3):</b> How long will the compute time of next cell be? \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
" a) 10*t\n",
|
||||
" b) t\n",
|
||||
" c) 0.1*t\n",
|
||||
" d) near 0*t \n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -660,7 +681,14 @@
|
||||
"id": "841b690e",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Q4 (Asynchronous.ipynb)"
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q4):</b> How long will the compute time of the 2nd cell be? \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
" a) infinity\n",
|
||||
" b) 1 second\n",
|
||||
" c) near 0 seconds\n",
|
||||
" d) 3 seconds"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -693,7 +721,14 @@
|
||||
"id": "df663f11",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Q5 (Asynchronous.ipynb)"
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q5):</b> How long will the compute time of the 2nd cell be? \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
" a) infinity\n",
|
||||
" b) 1 second\n",
|
||||
" c) near 0 seconds\n",
|
||||
" d) 3 seconds"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -723,15 +758,15 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Julia 1.8.5",
|
||||
"display_name": "Julia 1.9.0",
|
||||
"language": "julia",
|
||||
"name": "julia-1.8"
|
||||
"name": "julia-1.9"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".jl",
|
||||
"mimetype": "application/julia",
|
||||
"name": "julia",
|
||||
"version": "1.8.5"
|
||||
"version": "1.9.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
@ -8,14 +8,9 @@
|
||||
"<img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/VU_logo.png/800px-VU_logo.png?20161029201021\" width=\"350\">\n",
|
||||
"\n",
|
||||
"### Programming large-scale parallel systems\n",
|
||||
"### Lectures on Julia for HPC\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# Basics of Julia\n",
|
||||
"\n",
|
||||
"by Francesc Verdugo (VU Amsterdam)\n",
|
||||
"\n",
|
||||
"Version fall 2022"
|
||||
"# Julia basics"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -437,9 +432,11 @@
|
||||
"id": "d36ba0ae",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Question 1\n",
|
||||
"\n",
|
||||
"Which will be the value of `x` in the last line ?"
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question:</b> Which will be the value of `x` in the last line ? (Think your answer before executing next cell to find out the result) \n",
|
||||
"</div>\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -486,7 +483,7 @@
|
||||
"id": "de95c63c",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Once defined, a function can be called using bracket notation."
|
||||
"Once defined, a function can be called using bracket notation as you would expect."
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -496,7 +493,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"result = add(1,3)"
|
||||
"add(1,3)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -539,6 +536,41 @@
|
||||
"a .* b"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "58a4e395",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question:</b> Which will be the value of `x` in the last line ?\n",
|
||||
"</div>\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "4952cce7",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"function q(x)\n",
|
||||
" x = 2\n",
|
||||
" x\n",
|
||||
"end"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "a1134379",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"x = 1\n",
|
||||
"y = q(x)\n",
|
||||
"x"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d20bc3a4",
|
||||
@ -947,9 +979,10 @@
|
||||
"id": "94599fa3",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Question 2\n",
|
||||
"\n",
|
||||
"Which will be the value of `x` below?"
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question:</b> Which will be the value of `x` below? \n",
|
||||
"</div>\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@ -7,28 +7,7 @@
|
||||
"source": [
|
||||
"<img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/VU_logo.png/800px-VU_logo.png?20161029201021\" width=\"350\">\n",
|
||||
"\n",
|
||||
"### Programming large-scale parallel systems\n",
|
||||
"### Lectures on Julia for HPC"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "aebf6482",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"using Printf\n",
|
||||
"\n",
|
||||
"function answer_checker(answer,solution)\n",
|
||||
" if answer == solution\n",
|
||||
" \"🥳 Well done! \"\n",
|
||||
" else\n",
|
||||
" \"It's not correct. Keep trying! 💪\"\n",
|
||||
" end |> println\n",
|
||||
"end\n",
|
||||
"q_1_check(answer) = answer_checker(answer,\"a\")\n",
|
||||
"q_2_check(answer) = answer_checker(answer,\"b\")"
|
||||
"### Programming large-scale parallel systems\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -36,11 +15,7 @@
|
||||
"id": "2133c064",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Distributed computing in Julia\n",
|
||||
"\n",
|
||||
"by Francesc Verdugo (VU Amsterdam)\n",
|
||||
"\n",
|
||||
"Version fall 2022"
|
||||
"# Distributed computing in Julia\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -59,6 +34,35 @@
|
||||
"With this knowledge you will be able to implement simple and complex parallel algorithms in Julia."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "b9a04db7",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div class=\"alert alert-block alert-info\">\n",
|
||||
"<b>Note:</b> Do not forget to execute the next cell before starting this notebook! \n",
|
||||
"</div>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "aebf6482",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"using Printf\n",
|
||||
"function answer_checker(answer,solution)\n",
|
||||
" if answer == solution\n",
|
||||
" \"🥳 Well done! \"\n",
|
||||
" else\n",
|
||||
" \"It's not correct. Keep trying! 💪\"\n",
|
||||
" end |> println\n",
|
||||
"end\n",
|
||||
"q_1_check(answer) = answer_checker(answer,\"a\")\n",
|
||||
"q_2_check(answer) = answer_checker(answer,\"b\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "01af032c",
|
||||
@ -763,9 +767,12 @@
|
||||
"id": "fd22b74b",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Q1 (Distributed.ipynb)\n",
|
||||
"\n",
|
||||
"How many integers are transferred between master and worker? Including both directions.\n",
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q1):</b> How many integers are transferred between master and worker? Including both directions. \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"```julia\n",
|
||||
"a = rand(Int,4,4)\n",
|
||||
@ -795,9 +802,11 @@
|
||||
"id": "dbe373d1",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Q2 (Distributed.ipynb)\n",
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q2):</b> How many integers are transferred between master and worker? Including both directions. \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"How many integers are transferred between master and worker? Including both directions.\n",
|
||||
"\n",
|
||||
"```julia\n",
|
||||
"a = rand(Int,4,4)\n",
|
||||
@ -827,9 +836,10 @@
|
||||
"id": "c561a73d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Q3 (Distributed.ipynb)\n",
|
||||
"\n",
|
||||
"Which value will be the value of `x` ?"
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q3):</b> Which value will be the value of `x` ? \n",
|
||||
"</div>\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -851,7 +861,9 @@
|
||||
"id": "835080aa",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Q4 (Distributed.ipynb)\n",
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q4):</b> Which value will be the value of `x` ? \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
"Which value will be the value of `x` ?"
|
||||
]
|
||||
@ -1295,15 +1307,15 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Julia 1.8.5",
|
||||
"display_name": "Julia 1.9.0",
|
||||
"language": "julia",
|
||||
"name": "julia-1.8"
|
||||
"name": "julia-1.9"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".jl",
|
||||
"mimetype": "application/julia",
|
||||
"name": "julia",
|
||||
"version": "1.8.5"
|
||||
"version": "1.9.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
@ -1,5 +1,37 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "2a976c0f",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/VU_logo.png/800px-VU_logo.png?20161029201021\" width=\"350\">\n",
|
||||
"\n",
|
||||
"### Programming large-scale parallel systems"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "038e5442",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Matrix-matrix multiplication"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "f70e2f35",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Contents\n",
|
||||
"\n",
|
||||
"In this notebook, we will:\n",
|
||||
"\n",
|
||||
"- Parallelize a simple algorithm\n",
|
||||
"- Study the performance of different parallelization strategies\n",
|
||||
"- Implement them using Julia"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "480af594",
|
||||
@ -49,28 +81,6 @@
|
||||
"alg_3_complex_check(answer) = answer_checker(answer, \"d\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "038e5442",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Distributed matrix-matrix multiplication"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "f70e2f35",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Contents\n",
|
||||
"\n",
|
||||
"In this notebook, we will:\n",
|
||||
"\n",
|
||||
"- Parallelize a simple algorithm\n",
|
||||
"- Study the performance of different parallelization strategies\n",
|
||||
"- Implement them using Julia"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "96d2693d",
|
||||
@ -82,7 +92,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "88bc2633",
|
||||
"metadata": {},
|
||||
@ -118,7 +127,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "5828e243",
|
||||
"metadata": {},
|
||||
@ -247,7 +255,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "6a706283",
|
||||
"metadata": {},
|
||||
@ -278,7 +285,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "acfb354b",
|
||||
"metadata": {},
|
||||
@ -329,7 +335,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "70087bce",
|
||||
"metadata": {},
|
||||
@ -556,7 +561,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "62e5c637",
|
||||
"metadata": {},
|
||||
@ -616,7 +620,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "fb6b572b",
|
||||
"metadata": {},
|
||||
@ -775,7 +778,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "f1b8c712",
|
||||
"metadata": {},
|
||||
@ -835,7 +837,6 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"id": "c14ebcb3",
|
||||
"metadata": {},
|
||||
@ -927,7 +928,7 @@
|
||||
"id": "a628a1df",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Implementation of algorithm 3\n",
|
||||
"### Exercise 1\n",
|
||||
"\n",
|
||||
"Implement algorithm 3 in the function below. For simplicity, assume that the number of rows of C is a multiple of the number of workers.\n"
|
||||
]
|
||||
@ -1012,7 +1013,7 @@
|
||||
"id": "fa8d7f40",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### A more practical version of algorithm 1"
|
||||
"### Exercise 2"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -1119,7 +1120,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Julia 1.9.1",
|
||||
"display_name": "Julia 1.9.0",
|
||||
"language": "julia",
|
||||
"name": "julia-1.9"
|
||||
},
|
||||
@ -1127,7 +1128,7 @@
|
||||
"file_extension": ".jl",
|
||||
"mimetype": "application/julia",
|
||||
"name": "julia",
|
||||
"version": "1.9.1"
|
||||
"version": "1.9.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user