mirror of
https://github.com/fverdugo/XM_40017.git
synced 2025-12-29 10:18:31 +01:00
build based on 0e7cdd0
This commit is contained in:
@@ -14,4 +14,4 @@ max_iters = 100
|
||||
n = 1000
|
||||
x = LinRange(-1.7,0.7,n)
|
||||
y = LinRange(-1.2,1.2,n)
|
||||
heatmap(x,y,(i,j)->mandel(i,j,max_iters))</code></pre><h2 id="Asynchronous-programming-in-Julia"><a class="docs-heading-anchor" href="#Asynchronous-programming-in-Julia">Asynchronous programming in Julia</a><a id="Asynchronous-programming-in-Julia-1"></a><a class="docs-heading-anchor-permalink" href="#Asynchronous-programming-in-Julia" title="Permalink"></a></h2><h3 id="NB2-Q1"><a class="docs-heading-anchor" href="#NB2-Q1">NB2-Q1</a><a id="NB2-Q1-1"></a><a class="docs-heading-anchor-permalink" href="#NB2-Q1" title="Permalink"></a></h3><p>Evaluating <code>compute_π(100_000_000)</code> takes about 0.25 seconds. Thus, the loop would take about 2.5 seconds since we are calling the function 10 times.</p><h3 id="NB2-Q2"><a class="docs-heading-anchor" href="#NB2-Q2">NB2-Q2</a><a id="NB2-Q2-1"></a><a class="docs-heading-anchor-permalink" href="#NB2-Q2" title="Permalink"></a></h3><p>The time in doing the loop will be almost zero since the loop just schedules 10 tasks, which should be very fast.</p><h3 id="NB2-Q3"><a class="docs-heading-anchor" href="#NB2-Q3">NB2-Q3</a><a id="NB2-Q3-1"></a><a class="docs-heading-anchor-permalink" href="#NB2-Q3" title="Permalink"></a></h3><p>It will take 2.5 seconds, like in question 1. The <code>@sync</code> macro forces to wait for all tasks we have generated with the <code>@async</code> macro. Since we have created 10 tasks and each of them takes about 0.25 seconds, the total time will be about 2.5 seconds.</p><h3 id="NB2-Q4"><a class="docs-heading-anchor" href="#NB2-Q4">NB2-Q4</a><a id="NB2-Q4-1"></a><a class="docs-heading-anchor-permalink" href="#NB2-Q4" title="Permalink"></a></h3><p>It will take about 3 seconds. The channel has buffer size 4, thus the call to <code>put!</code>will not block. The call to <code>take!</code> will not block neither since there is a value stored in the channel. The taken value is 3 and therefore we will wait for 3 seconds. </p><h3 id="NB2-Q5"><a class="docs-heading-anchor" href="#NB2-Q5">NB2-Q5</a><a id="NB2-Q5-1"></a><a class="docs-heading-anchor-permalink" href="#NB2-Q5" title="Permalink"></a></h3><p>The channel is not buffered and therefore the call to <code>put!</code> will block. The cell will run forever, since there is no other task that calls <code>take!</code> on this channel. </p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../asp/">« All pairs of shortest paths</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="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.25 on <span class="colophon-date" title="Friday 8 September 2023 16:03">Friday 8 September 2023</span>. Using Julia version 1.9.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
|
||||
heatmap(x,y,(i,j)->mandel(i,j,max_iters))</code></pre><h2 id="Asynchronous-programming-in-Julia"><a class="docs-heading-anchor" href="#Asynchronous-programming-in-Julia">Asynchronous programming in Julia</a><a id="Asynchronous-programming-in-Julia-1"></a><a class="docs-heading-anchor-permalink" href="#Asynchronous-programming-in-Julia" title="Permalink"></a></h2><h3 id="NB2-Q1"><a class="docs-heading-anchor" href="#NB2-Q1">NB2-Q1</a><a id="NB2-Q1-1"></a><a class="docs-heading-anchor-permalink" href="#NB2-Q1" title="Permalink"></a></h3><p>Evaluating <code>compute_π(100_000_000)</code> takes about 0.25 seconds. Thus, the loop would take about 2.5 seconds since we are calling the function 10 times.</p><h3 id="NB2-Q2"><a class="docs-heading-anchor" href="#NB2-Q2">NB2-Q2</a><a id="NB2-Q2-1"></a><a class="docs-heading-anchor-permalink" href="#NB2-Q2" title="Permalink"></a></h3><p>The time in doing the loop will be almost zero since the loop just schedules 10 tasks, which should be very fast.</p><h3 id="NB2-Q3"><a class="docs-heading-anchor" href="#NB2-Q3">NB2-Q3</a><a id="NB2-Q3-1"></a><a class="docs-heading-anchor-permalink" href="#NB2-Q3" title="Permalink"></a></h3><p>It will take 2.5 seconds, like in question 1. The <code>@sync</code> macro forces to wait for all tasks we have generated with the <code>@async</code> macro. Since we have created 10 tasks and each of them takes about 0.25 seconds, the total time will be about 2.5 seconds.</p><h3 id="NB2-Q4"><a class="docs-heading-anchor" href="#NB2-Q4">NB2-Q4</a><a id="NB2-Q4-1"></a><a class="docs-heading-anchor-permalink" href="#NB2-Q4" title="Permalink"></a></h3><p>It will take about 3 seconds. The channel has buffer size 4, thus the call to <code>put!</code>will not block. The call to <code>take!</code> will not block neither since there is a value stored in the channel. The taken value is 3 and therefore we will wait for 3 seconds. </p><h3 id="NB2-Q5"><a class="docs-heading-anchor" href="#NB2-Q5">NB2-Q5</a><a id="NB2-Q5-1"></a><a class="docs-heading-anchor-permalink" href="#NB2-Q5" title="Permalink"></a></h3><p>The channel is not buffered and therefore the call to <code>put!</code> will block. The cell will run forever, since there is no other task that calls <code>take!</code> on this channel. </p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../asp/">« All pairs of shortest paths</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="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.25 on <span class="colophon-date" title="Friday 8 September 2023 16:24">Friday 8 September 2023</span>. Using Julia version 1.9.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
|
||||
|
||||
Reference in New Issue
Block a user