vault backup: 2023-10-25 12:31:34

This commit is contained in:
Alice 2023-10-25 12:31:34 +01:00
parent e212392f9d
commit b1fc8a7ed7
3 changed files with 24 additions and 8 deletions

View file

@ -4,11 +4,11 @@
"type": "split", "type": "split",
"children": [ "children": [
{ {
"id": "f2e5c2c113449b23", "id": "e289691ce7e736ef",
"type": "tabs", "type": "tabs",
"children": [ "children": [
{ {
"id": "6a363953132aebe7", "id": "abd7a3e8df397999",
"type": "leaf", "type": "leaf",
"state": { "state": {
"type": "markdown", "type": "markdown",
@ -158,10 +158,12 @@
"digitalgarden:Digital Garden Publication Center": false "digitalgarden:Digital Garden Publication Center": false
} }
}, },
"active": "6a363953132aebe7", "active": "3ca14d4a6c304083",
"lastOpenFiles": [ "lastOpenFiles": [
"4a1s/CP/PL - Aula 6.md", "4a1s/CP/PL - Aula 6.md",
"4a1s/CP/PL - Aula 7.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", "Excalidraw/Drawing 2023-10-25 12.16.38.excalidraw.md",
"4a1s/MFES/T - Aula 2.md", "4a1s/MFES/T - Aula 2.md",
"4a1s/MFES/PL - Aula 5.md", "4a1s/MFES/PL - Aula 5.md",
@ -172,8 +174,6 @@
"4a1s/RAS/Notas Projeto RAS.md", "4a1s/RAS/Notas Projeto RAS.md",
"4a1s/CP/PL - Aula 4.md", "4a1s/CP/PL - Aula 4.md",
"4a1s/CP/Projeto Fase 1.md", "4a1s/CP/Projeto Fase 1.md",
"My Digital Garden.md",
"Pasted image 20231018122801.png",
"Images/Pasted image 20231018121319.png", "Images/Pasted image 20231018121319.png",
"Images/Pasted image 20231018120412.png", "Images/Pasted image 20231018120412.png",
"Images/Pasted image 20231018120219.png", "Images/Pasted image 20231018120219.png",
@ -196,7 +196,6 @@
"Images", "Images",
"4a1s/CP/PL - Aula 3.md", "4a1s/CP/PL - Aula 3.md",
"4a1s/CP/PL - Aula 2.md", "4a1s/CP/PL - Aula 2.md",
"4a1s/RAS/Projeto.md",
"4a1s/ESR", "4a1s/ESR",
"Private-Project", "Private-Project",
"4a1s/Excalidraw/RAS", "4a1s/Excalidraw/RAS",

View file

@ -557,7 +557,12 @@ Run \#1 (--cpus-per-task=2):
Dot is 1.2020569029595982 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): Run \#2 (--cpus-per-task=4):
``` ```
@ -569,6 +574,18 @@ Run \#3 (--cpus-per-task=6):
Dot is 0.0000000013500135 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. 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) ### c)
We can change the code to:
And the results will always be:
### d)
We can use _reduction_ to do that.

View file

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB