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
4c79658a
Commit
4c79658a
authored
10 months ago
by
Georgiana Mania
Browse files
Options
Downloads
Patches
Plain Diff
fix pancake example & other FIXME
parent
add8a649
No related branches found
No related tags found
1 merge request
!72
Draft: Compute devices lecture
Pipeline
#70077
passed
10 months ago
Stage: test
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lectures/parallelism/slides.qmd
+11
-11
11 additions, 11 deletions
lectures/parallelism/slides.qmd
with
11 additions
and
11 deletions
lectures/parallelism/slides.qmd
+
11
−
11
View file @
4c79658a
...
@@ -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};
...
...
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