You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/lecture5.md
+11-7Lines changed: 11 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,10 @@
3
3
<h1>Lecture 5: Parallel Programming</h1>
4
4
~~~
5
5
6
+
7
+
\toc
8
+
9
+
6
10
## Caveats First
7
11
8
12
* You hear often: "sure, that's a big problem you have there. But you can parallelize it!" Whether that will help in your case is strictly problem-specific. You need to _try it out_ in order to know.
@@ -18,7 +22,7 @@
18
22
* The smallest parallel computation unit lives on your CPU.
19
23
* The basic idea is simple: If a computational task of duration `M` can split into `N` subtasks, which can be performed _concurrently_ (at the same time), without interfering with each other, then _in theory_, the duration of the task should fall to `M/N`. _In practice_ we almost never achieve this theoretical bound, because of time spent communicating between computational units and other _system time_.
20
24
21
-
## Resources:
25
+
## Resources
22
26
23
27
1. Julia [whitepaper](https://juliahub.com/assets/pdf/Parallel-Computing-Guide-for-Julia-byJuliaHub.pdf)
24
28
2.[Guide](https://www.sas.upenn.edu/~jesusfv/Guide_Parallel.pdf) by Jesus Fernandez-Villaverde and David Zurrak-Valencia
@@ -44,7 +48,7 @@ Paradigms 1. and 2. live in a _shared memory_ world, i.e. they operate within th
44
48
45
49
Paradigms 3. and 4. are different, because they (can) rely on **separate** hardware. We can start a distributed julia process inside a single machine, but this will behave _like another computer_ (almost), so you will have to worry about making data and functions accessible to all worker processes.
46
50
47
-
## 1. Asyncronous Tasks or Coroutines
51
+
## Asyncronous Tasks or Coroutines
48
52
49
53
Even within a single thread there may be computational operations which can be performed next to each other. *Coroutines* split a single task into multiple chunks, and there is an efficient process which allows *non-blocking execution*. This may be beneficial in I/O operations or when we wait for something to arrive via a network. It is *not* beneficial if our operation involvs many CPU cycles (i.e. if it's compute intensive). Let's see an example.
50
54
@@ -147,7 +151,7 @@ You can see that julia makes it extremely easy to run *concurrent* tasks.
147
151
Check out more in the manual: https://docs.julialang.org/en/v1/manual/parallel-computing/
148
152
149
153
150
-
## 2. Multi-Threading
154
+
## Multi-Threading
151
155
152
156
* What are threads again? _Threads are sequences of instructions given to the CPU_ which can be executed concurrently. So, multithreading is something that happens on a _core_ of CPU. Your CPU may have several _cores_.
153
157
* The [manual](https://docs.julialang.org/en/v1/manual/multi-threading/#man-multithreading) is the authorative source - very comprehensive.
@@ -406,7 +410,7 @@ Threads.@threads for i in 1:100
In this [research project - [private repo]](https://github.com/floswald/FMig.jl/pull/17/commits/119b34bbf621374be187a023399d74a5e16c3934) we encountered a situation very similar to the above.
458
462
459
463
460
-
## 3. Distributed Computing
464
+
## Distributed Computing
461
465
462
466
The [manual](https://docs.julialang.org/en/v1/manual/distributed-computing/) is again very helpful here.
463
467
@@ -589,7 +593,7 @@ I would recommend
589
593
* define all required data within the `module` you load on the workers, such that each of them has access to all required data. This may not be feasible if you require huge amounts of input data.
590
594
* Example: [private repo again]
591
595
592
-
### Example Setup Real World Project
596
+
### Example Setup Real World HPC Project
593
597
594
598
Suppose we have the following structure on an HPC cluster.
0 commit comments