Skip to content
Snippets Groups Projects
Commit 625e2593 authored by Jan Frederik Engels's avatar Jan Frederik Engels :new_moon:
Browse files

Some improvements.

parent 6dd136cc
No related branches found
No related tags found
1 merge request!72Draft: Compute devices lecture
......@@ -107,28 +107,31 @@ N = 8
```bash
module load gcc
```
2. Compile and run the serial example
2. Compile and run the serial example
```bash
gcc main.c -o serial.x -lm
gcc main.c -o serial.x -lm
time ./serial.x # use `time` to check the runtime
```
3. Compile and run the example using OpenMP
```bash
gcc -fopenmp main.c -o parallel.x -lm
OMP_NUM_THREADS=2 time ./parallel.x
gcc -fopenmp main.c -o parallel.x -lm
OMP_NUM_THREADS=2 time ./parallel.x
```
4. See next slide!
# Hands-on Session! {background-color=var(--dark-bg-color) .leftalign}
4. Now add
* `schedule(static,1)`
* `schedule(static,10)`
* `schedule(FIXMEsomethingelse)`
* `schedule(FIXMEsomethingelse)`
and find out how the OpenMP runtime decomposes the problem domain.
FIXME: Maybe add something varying the number of threads, so that one can see
first ideas of strong/weak scaling.
4. Now compile/run with
```bash
gcc -fopenmp main.c -o parallel.x -lm -DWRITE_DECOMP
OMP_NUM_THREADS=4 time ./parallel.x
```
5. What does the additional output mean?
4. Now uncomment/adapt
* `schedule(static,100)`
* `schedule(static,10)`
and interpret the results.
# Scaling
......@@ -257,7 +260,7 @@ Wikipedia
"Parallel computing is the simultaneous use of multiple compute resources to solve a computational problem"
:::{.smaller}
-- *Introduction to Parallel Computing Tutorial, LLNL *
-- *Introduction to Parallel Computing Tutorial, LLNL *
:::
......@@ -267,7 +270,7 @@ Wikipedia
* what we've been discussing
* Task-level parallelism
* Example: Atmosphere ocean coupling
## Precondition for parallel execution
......@@ -441,9 +444,13 @@ S1 and S2 can NOT be executed in parallel!
# FIXME
* Homework:
* Do something where you run into hardware-constraints (i.e. Numa, too many threads, ...)
* Give some example with race condition or stuff and have them find it.
* Have them discuss the concepts from the lecture using the metaphor of a kitchen workflow?
* Revisit `schedule` and try `dynamic` and explain why that happens.
* Parallelize the loop in `maxval`.
* Do a strong-scaling experiment starting with 2 threads and up to 32
threads and plot the result.
* If you were to increase the number of threads, do you expect the speedup
to continue indefinitely? If not, which limits can you imagine? Feel free
to use kitchen metaphors.
# Additional reading
......
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