my_digital_garden/4a1s/CP/PL - Aula 3.md

29 lines
754 B
Markdown
Raw Normal View History

2023-09-27 11:11:52 +01:00
## Ex. 1
### a)
2023-09-27 11:31:52 +01:00
Spacial locality -(constant) proximity of memory spaces relative to a reference memory space
2023-09-27 11:11:52 +01:00
2023-09-27 11:31:52 +01:00
Logically following the multiplication process of matrices, C and A have spacial locality (while B does not, due to advancing in columns and not rows). Matrix C also has temporal locality.
2023-09-27 11:11:52 +01:00
### b)
2023-09-27 11:21:52 +01:00
cache size = 25600 KB
2023-09-27 11:31:52 +01:00
cache line/alignment= 64 B
2023-09-27 11:41:52 +01:00
double -> 8
2023-09-27 11:31:52 +01:00
2023-09-27 11:41:52 +01:00
(64/8) = 8 elements
2023-09-27 11:31:52 +01:00
2023-09-27 11:41:52 +01:00
**Estimation of misses:**
- matrix C: n² / 8
2023-09-27 11:51:52 +01:00
- matrix B: n³
- matrix A: n³ / 8
2023-09-27 11:41:52 +01:00
2023-09-27 11:51:52 +01:00
>[!info] The difference in being divided by 8 or not comes from the spacial locality of the matrix.
2023-09-27 11:41:52 +01:00
>[!info]- Commands ran
>nano /proc/cpuinfo
>srun --partition=cpar perf cat /proc/cpuinfo
2023-09-27 11:21:52 +01:00
### c)
2023-09-27 12:01:52 +01:00
C -> n² / 8
B -> n³ / 8 (since it has been transpost)
C -> n³/8
### d)