Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lecture materials
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
generic software skills
lecture materials
Commits
625e2593
Commit
625e2593
authored
10 months ago
by
Jan Frederik Engels
Browse files
Options
Downloads
Patches
Plain Diff
Some improvements.
parent
6dd136cc
No related branches found
No related tags found
1 merge request
!72
Draft: Compute devices lecture
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lectures/parallelism/slides.qmd
+24
-17
24 additions, 17 deletions
lectures/parallelism/slides.qmd
with
24 additions
and
17 deletions
lectures/parallelism/slides.qmd
+
24
−
17
View file @
625e2593
...
@@ -107,28 +107,31 @@ N = 8
...
@@ -107,28 +107,31 @@ N = 8
```bash
```bash
module load gcc
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 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 -fopenmp main.c -o parallel.x -lm
OMP_NUM_THREADS=2 time ./parallel.x
OMP_NUM_THREADS=2 time ./parallel.x
```
```
4. See next slide!
4. See next slide!
# Hands-on Session! {background-color=var(--dark-bg-color) .leftalign}
# 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
4. Now compile/run with
first ideas of strong/weak scaling.
```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
# Scaling
...
@@ -257,7 +260,7 @@ Wikipedia
...
@@ -257,7 +260,7 @@ Wikipedia
"Parallel computing is the simultaneous use of multiple compute resources to solve a computational problem"
"Parallel computing is the simultaneous use of multiple compute resources to solve a computational problem"
:::{.smaller}
:::{.smaller}
-- *Introduction to Parallel Computing Tutorial, LLNL *
-- *Introduction to Parallel Computing Tutorial, LLNL *
:::
:::
...
@@ -267,7 +270,7 @@ Wikipedia
...
@@ -267,7 +270,7 @@ Wikipedia
* what we've been discussing
* what we've been discussing
* Task-level parallelism
* Task-level parallelism
* Example: Atmosphere ocean coupling
* Example: Atmosphere ocean coupling
## Precondition for parallel execution
## Precondition for parallel execution
...
@@ -441,9 +444,13 @@ S1 and S2 can NOT be executed in parallel!
...
@@ -441,9 +444,13 @@ S1 and S2 can NOT be executed in parallel!
# FIXME
# FIXME
* Homework:
* Homework:
* Do something where you run into hardware-constraints (i.e. Numa, too many threads, ...)
* Revisit `schedule` and try `dynamic` and explain why that happens.
* Give some example with race condition or stuff and have them find it.
* Parallelize the loop in `maxval`.
* Have them discuss the concepts from the lecture using the metaphor of a kitchen workflow?
* 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
# Additional reading
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment