From b1fc8a7ed72c06dd7a19a3a1b4aa960d057d0e52 Mon Sep 17 00:00:00 2001 From: Alice Date: Wed, 25 Oct 2023 12:31:34 +0100 Subject: [PATCH] vault backup: 2023-10-25 12:31:34 --- .obsidian/workspace.json | 11 +++++---- 4a1s/CP/PL - Aula 7.md | 21 ++++++++++++++++-- .../Pasted image 20231018122801.png | Bin 3 files changed, 24 insertions(+), 8 deletions(-) rename Pasted image 20231018122801.png => Images/Pasted image 20231018122801.png (100%) diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 78984fc..e99d485 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -4,11 +4,11 @@ "type": "split", "children": [ { - "id": "f2e5c2c113449b23", + "id": "e289691ce7e736ef", "type": "tabs", "children": [ { - "id": "6a363953132aebe7", + "id": "abd7a3e8df397999", "type": "leaf", "state": { "type": "markdown", @@ -158,10 +158,12 @@ "digitalgarden:Digital Garden Publication Center": false } }, - "active": "6a363953132aebe7", + "active": "3ca14d4a6c304083", "lastOpenFiles": [ "4a1s/CP/PL - Aula 6.md", "4a1s/CP/PL - Aula 7.md", + "My Digital Garden.md", + "Images/Pasted image 20231018122801.png", "Excalidraw/Drawing 2023-10-25 12.16.38.excalidraw.md", "4a1s/MFES/T - Aula 2.md", "4a1s/MFES/PL - Aula 5.md", @@ -172,8 +174,6 @@ "4a1s/RAS/Notas Projeto RAS.md", "4a1s/CP/PL - Aula 4.md", "4a1s/CP/Projeto Fase 1.md", - "My Digital Garden.md", - "Pasted image 20231018122801.png", "Images/Pasted image 20231018121319.png", "Images/Pasted image 20231018120412.png", "Images/Pasted image 20231018120219.png", @@ -196,7 +196,6 @@ "Images", "4a1s/CP/PL - Aula 3.md", "4a1s/CP/PL - Aula 2.md", - "4a1s/RAS/Projeto.md", "4a1s/ESR", "Private-Project", "4a1s/Excalidraw/RAS", diff --git a/4a1s/CP/PL - Aula 7.md b/4a1s/CP/PL - Aula 7.md index dcf366d..0d48f9d 100644 --- a/4a1s/CP/PL - Aula 7.md +++ b/4a1s/CP/PL - Aula 7.md @@ -557,7 +557,12 @@ Run \#1 (--cpus-per-task=2): Dot is 1.2020569029595982 ``` -With the same cpus per task (cores), the result may vary depending on how +Run \#n (--cpus-per-task=2): +``` +Dot is 0.0000000001499965 +``` +With the same cpus per task (cores), the result may vary depending on how each threads randomly "picks up" the iterations of the for. + Run \#2 (--cpus-per-task=4): ``` @@ -569,6 +574,18 @@ Run \#3 (--cpus-per-task=6): Dot is 0.0000000013500135 ``` +Run \#4 (--cpus-per-task=8): +``` +Dot is 0.0000000000719980 +``` + + Varies with the number of cpus per task (cores) because depending on the number of threads, the distribution of the instruction ```dot += a[i]*b[i];``` per thread will vary, aka the value ```i``` will constantly vary, making the memory space alternate between versions. -### c) \ No newline at end of file +### c) +We can change the code to: + +And the results will always be: + +### d) +We can use _reduction_ to do that. \ No newline at end of file diff --git a/Pasted image 20231018122801.png b/Images/Pasted image 20231018122801.png similarity index 100% rename from Pasted image 20231018122801.png rename to Images/Pasted image 20231018122801.png