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

41 lines
1.2 KiB
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)
2023-09-27 12:11:52 +01:00
| N | Version | Time | CPI | \#I| L1_DMiss (estimated) | L1_DMiss | |
| --------- | --- | --- | -------- | ----------- | ---------- | -------------- | ---------- | ------ | ------ |
| 512 | base() | | 1 | 0 | 1 | 1 | 0 | 0 | 1 |
| 512 | transp() | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 |
512x512x8 = 2 MB
512x8 = 4KB
Impacto (n=512):
- C -> n² / 8 = 32
- A -> n² / 8
- B -> n³ ( 8)