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

add first part of hands-on ex

parent c8bfa5bd
No related branches found
No related tags found
1 merge request!72Draft: Compute devices lecture
Pipeline #68959 passed
...@@ -67,24 +67,31 @@ FIXME ...@@ -67,24 +67,31 @@ FIXME
a[i] = 2 * i; a[i] = 2 * i;
``` ```
## Hands-on Session! {background-color=var(--dark-bg-color) .leftalign} # Hands-on Session! {background-color=var(--dark-bg-color) .leftalign}
1. Load the GNU compliler and compile the code on Levante 1. Load the GNU compiler on Levante
```bash ```bash
module load gcc module load gcc
g++ main.cpp -o main
``` ```
2. Compile and run the serial example
```bash
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
```
4. See next slide!
# Hands-on Session! {background-color=var(--dark-bg-color) .leftalign}
1. Compile and run the example serially. Use `time ./serial.x` to time the execution. 4. Now add
23. Compile and run the example using OpenMP. Use `OMP_NUM_THREADS=2 time ./omp.x` to time the execution.
42. Now add
* `schedule(static,1)` * `schedule(static,1)`
* `schedule(static,10)` * `schedule(static,10)`
* `schedule(FIXMEsomethingelse)` * `schedule(FIXMEsomethingelse)`
* `schedule(FIXMEsomethingelse)` * `schedule(FIXMEsomethingelse)`
and find out how the OpenMP runtime decomposes the problem domain. and find out how the OpenMP runtime decomposes the problem domain.
FIXME: Maybe get rid of timings here?
FIXME: Maybe add something varying the number of threads, so that one can see FIXME: Maybe add something varying the number of threads, so that one can see
first ideas of strong/weak scaling. first ideas of strong/weak scaling.
......
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