diff --git a/lectures/parallelism/slides.qmd b/lectures/parallelism/slides.qmd index 33365ff3616cc33770ed86e68e87c14e53cc3651..99365a34c0052553c109c8384098e0e3471fb6e6 100644 --- a/lectures/parallelism/slides.qmd +++ b/lectures/parallelism/slides.qmd @@ -67,15 +67,41 @@ Credit: MPI-M * A popular way to parallelize code * Pragma-based parallelization API * 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 * Wait until next week for a definition +:::: {.columns} + +::: {.column width="50%"} + +<br> + ```c++ +N = 8 #pragma omp parallel for for (int i = 0; i < N; ++i) a[i] = 2 * i; ``` +::: + +::: {.column width="50%"} + +{width=100%} + +::: + +:::: + # Hands-on Session! {background-color=var(--dark-bg-color) .leftalign} 1. Load the GNU compiler on Levante ```bash diff --git a/lectures/parallelism/static/threads.jpg b/lectures/parallelism/static/threads.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3ec89cab0771527a55f536b254aa3f6c12808c70 Binary files /dev/null and b/lectures/parallelism/static/threads.jpg differ