Skip to content
Snippets Groups Projects
Commit 4c79658a authored by Georgiana Mania's avatar Georgiana Mania
Browse files

fix pancake example & other FIXME

parent add8a649
No related branches found
No related tags found
1 merge request!72Draft: Compute devices lecture
Pipeline #70077 passed
...@@ -113,16 +113,15 @@ module load gcc ...@@ -113,16 +113,15 @@ module load gcc
``` ```
2. Compile and run the serial example 2. Compile and run the serial example
```bash ```bash
gcc main.c -o serial.x -lm gcc -O3 main.c -o serial.x -lm
time ./serial.x # use `time` to check the runtime time ./serial.x # use `time` to check the runtime
``` ```
3. Compile and run the example using OpenMP 3. Compile and run the example using OpenMP
```bash ```bash
gcc -fopenmp main.c -o parallel.x -lm gcc -O3 -fopenmp main.c -o parallel.x -lm
time OMP_NUM_THREADS=2 ./parallel.x export OMP_NUM_THREADS=2
time ./parallel.x
``` ```
FIXME: time is often a shell builtin, so output varies and also the place
where the env-var needs to be set.
4. See next slide! 4. See next slide!
...@@ -131,11 +130,12 @@ where the env-var needs to be set. ...@@ -131,11 +130,12 @@ where the env-var needs to be set.
4. Now compile/run with 4. Now compile/run with
```bash ```bash
gcc -fopenmp main.c -o parallel.x -lm -DWRITE_DECOMP gcc -fopenmp main.c -o parallel.x -lm -DWRITE_DECOMP
OMP_NUM_THREADS=4 time ./parallel.x export OMP_NUM_THREADS=4
time ./parallel.x
``` ```
5. What does the additional output mean? 5. What does the additional output mean?
4. Now uncomment/adapt 6. Now uncomment/adapt
* `schedule(static,100)` * `schedule(static,100)`
* `schedule(static,10)` * `schedule(static,10)`
and interpret the results. and interpret the results.
...@@ -182,16 +182,16 @@ Images generated by Pradipta Samanta with DALL-E ...@@ -182,16 +182,16 @@ Images generated by Pradipta Samanta with DALL-E
## Strong vs weak scaling ## Strong vs weak scaling
:::{.smaller} :::{.smaller}
Starting with batter for $N$ pancakes and 1 pan, we can scale by using $P$ pans in two ways: Starting with 1 pan, we can (perfect) scale this by using $P$ pans in two ways:
::: :::
:::{.fragment} :::{.fragment}
|Parameter / Scaling type |Strong|Weak| |Parameter / Scaling type |Strong|Weak|
|-------|---|---| |-------|---|---|
|Resources <br> (e.g. pans) | $P$| $P$ | |Resources <br> (e.g. pans) | $P$| $P$ |
|Total workload <br> (e.g. pancake count)| $N$ | $P \times N$ | |Total workload <br> (e.g. pancake count)| $N$ | $N \times P$ |
|Workload per worker <br> (e.g. pancakes per pan) | $N/P$ | $N$ | |Workload per worker <br> (e.g. pancakes per pan) | $N/P$ | $N$ |
|Total time | $T_1 \times N/P$ | $T_1 \times N$ | |Total time | $T_1 \times N/P$ | $T_1 \times N \times P$ |
::: :::
...@@ -203,7 +203,7 @@ Starting with batter for $N$ pancakes and 1 pan, we can scale by using $P$ pans ...@@ -203,7 +203,7 @@ Starting with batter for $N$ pancakes and 1 pan, we can scale by using $P$ pans
* Weak scaling * Weak scaling
--> -->
# Reductions FIXME title should be more generic # Aggregate parallel results
## What is happening here? ## What is happening here?
```c++ ```c++
int a[] = {2, 4, 6}; int a[] = {2, 4, 6};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment