From c8bfa5bda1270e2850b86a4e93cf1a21489461ec Mon Sep 17 00:00:00 2001 From: Georgiana Mania <mania@dkrz.de> Date: Mon, 27 May 2024 17:12:21 +0200 Subject: [PATCH] add slide 26 --- lectures/parallelism/slides.qmd | 63 +++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/lectures/parallelism/slides.qmd b/lectures/parallelism/slides.qmd index 37ce200..5747f35 100644 --- a/lectures/parallelism/slides.qmd +++ b/lectures/parallelism/slides.qmd @@ -217,8 +217,11 @@ Wikipedia ## Types of parallelism -* Data-level parallelism - what we've been discussing -* Task-level parallelism - Example: Atmosphere ocean coupling + +* Data-level parallelism + * what we've been discussing +* Task-level parallelism + * Example: Atmosphere ocean coupling ## Precondition for parallel execution @@ -331,6 +334,62 @@ d = c - b; // S2 ``` ::: +## Bernstein's parallelism conditions {.alignleft} + +:::{.fragment .semi-fade-out} +```c++ +c = a + b; // S1 +d = a - b; // S2 +``` +::: + + +:::{.fragment} +Replace `a` with `c` in statement 2 +```c++ +c = a + b; // S1 +d = c - b; // S2 +``` +::: + +:::{.smaller} + +:::: {.columns} + +::: {.column width="50%"} + +:::{.fragment} + +Read and write sets for S1 and S2: +$$ +R_1 = \{a,b\} ; W_1 = \{c\} \\ +R_2 = \{c,b\} ; W_2 = \{d\} \\ +$$ + +::: +::: + +::: {.column width="50%"} + +:::{.fragment} +Bernstein's conditions: + +$$ +R_1 \cap W_2 = \emptyset \\ +W_1 \cap R_2 = \{c\} \\ +W_1 \cap W_2 = \emptyset +$$ +::: + +::: +::: +:::: + +:::{.fragment} +S1 and S2 can NOT be executed in parallel! +::: + + ## Best practices * Parallelisation should not change the results! Exceptions to be discussed next week! -- GitLab