Skip to content
Snippets Groups Projects
Commit 072dd2ea authored by Claudia Frauen's avatar Claudia Frauen
Browse files

Added threads graphic

parent 7f431195
No related branches found
No related tags found
1 merge request!72Draft: Compute devices lecture
Pipeline #69355 passed
...@@ -67,15 +67,41 @@ Credit: MPI-M ...@@ -67,15 +67,41 @@ Credit: MPI-M
* A popular way to parallelize code * A popular way to parallelize code
* Pragma-based parallelization API * Pragma-based parallelization API
* You annotate your code with parallel regions and the compiler does the rest * You annotate your code with parallel regions and the compiler does the rest
```c++
#pragma omp parallel for
for (int i = 0; i < N; ++i)
a[i] = 2 * i;
```
# OpenMP threads
* OpenMP uses something called threads * OpenMP uses something called threads
* Wait until next week for a definition * Wait until next week for a definition
:::: {.columns}
::: {.column width="50%"}
<br>
```c++ ```c++
N = 8
#pragma omp parallel for #pragma omp parallel for
for (int i = 0; i < N; ++i) for (int i = 0; i < N; ++i)
a[i] = 2 * i; a[i] = 2 * i;
``` ```
:::
::: {.column width="50%"}
![](static/threads.jpg){width=100%}
:::
::::
# Hands-on Session! {background-color=var(--dark-bg-color) .leftalign} # Hands-on Session! {background-color=var(--dark-bg-color) .leftalign}
1. Load the GNU compiler on Levante 1. Load the GNU compiler on Levante
```bash ```bash
......
lectures/parallelism/static/threads.jpg

23.3 KiB

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