diff --git a/lectures/memory-hierarchies/slides.qmd b/lectures/memory-hierarchies/slides.qmd index ed4ca013289ca20f6fa72aeb54e0cbb44bf61e82..ed95f0b55583215e7e61d4034c1368873d52bfdb 100644 --- a/lectures/memory-hierarchies/slides.qmd +++ b/lectures/memory-hierarchies/slides.qmd @@ -11,6 +11,15 @@ author: "Dominik Zobel and Florian Ziemen" +## Intended Takeaways + + - Locality matters: data-centric view + - Think workbench: Operating with parts of the data + - Processor tries to be busy all the time (prefetching) + - Latency and memory sizes of components + + + ## Questions {.handson .incremental} - Why not keep everything in memory? @@ -19,6 +28,8 @@ author: "Dominik Zobel and Florian Ziemen" +# Speed and access time + ## Processor speed vs. memory speed {width=70%} @@ -135,12 +146,12 @@ new_data = operate_on_data(data=data, ``` --> -| | Levante (Fixed) | Local (Fixed) | Levante (Random) | Local (Random) | +| | Levante (Fixed) | Laptop (Fixed) | Levante (Random) | Laptop (Random) | | -------------------------- | ----------------- | ----------------- | ----------------- | ----------------- | -| Create data | 0.5607 | 0.2280 | 1.6623 | 0.8759 | -| Load data | 0.7605 | 0.8767 | 0.7615 | 0.9225 | -| Store data | 2.2317 | 4.0427 | 2.2327 | 3.4378 | -| Process data | 0.7618 | 0.3792 | 0.7572 | 0.3747 | +| Create data | 0.56 | 0.23 | 1.66 | 0.88 | +| Load data | 0.76 | 0.88 | 0.76 | 0.92 | +| Store data | 2.23 | 4.04 | 2.23 | 3.44 | +| Process data | 0.76 | 0.38 | 0.76 | 0.37 | :::{.smaller} Time in seconds using a 2 GB numpy array ($128 \times 128 \times 128 \times 128$) either with a fixed number or random number in each entry @@ -156,6 +167,9 @@ Time in seconds using a 2 GB numpy array ($128 \times 128 \times 128 \times 128$ + +# Theory + ## Techniques - Caching @@ -248,6 +262,8 @@ T_{avg,s} &= H_1 T_1 + ((1-H_1)\cdot H_2)\cdot(T_1+T_2)\\ +# Visualizations + ## Memory Pyramid (upwards) @@ -269,14 +285,25 @@ T_{avg,s} &= H_1 T_1 + ((1-H_1)\cdot H_2)\cdot(T_1+T_2)\\ -## Memory Pyramid (downwards) - check numbers {auto-animate=true} +## Memory Pyramid (downwards) {auto-animate=true} Order of magnitude on Levante (AMD EPYC 7763) - Base frequency: 2.45 GHz -## Memory Pyramid (downwards) - check numbers {auto-animate=true} + +## Memory Pyramid (downwards) {auto-animate=true} + +::::::::{.r-stack} + +:::{.normal style="color: #ffcccc; font-size: 3em; font-weight: bold; rotate: -30deg; opacity: 0.5;"} + +Check numbers + +::: + +:::{.normal} Order of magnitude on Levante (AMD EPYC 7763) @@ -284,6 +311,9 @@ Order of magnitude on Levante (AMD EPYC 7763) ------------ ----------------- --------- Register ~0.4 1 KB +::: + +:::::::: :::{.incremental} @@ -292,7 +322,17 @@ Register ~0.4 1 KB ::: -## Memory Pyramid (downwards) - check numbers {auto-animate=true} +## Memory Pyramid (downwards) {auto-animate=true} + +::::::::{.r-stack} + +:::{.normal style="color: #ffcccc; font-size: 3em; font-weight: bold; rotate: -30deg; opacity: 0.5;"} + +Check numbers + +::: + +:::{.normal} Order of magnitude on Levante (AMD EPYC 7763) @@ -301,6 +341,10 @@ Order of magnitude on Levante (AMD EPYC 7763) Register ~0.4 1 KB L1 Cache ~1.1 32 KB +::: + +:::::::: + :::{.incremental} - Same factors for L2 and L3 @@ -308,7 +352,17 @@ L1 Cache ~1.1 32 KB ::: -## Memory Pyramid (downwards) - check numbers {auto-animate=true} +## Memory Pyramid (downwards) {auto-animate=true} + +::::::::{.r-stack} + +:::{.normal style="color: #ffcccc; font-size: 3em; font-weight: bold; rotate: -30deg; opacity: 0.5;"} + +Check numbers + +::: + +:::{.normal} Order of magnitude on Levante (AMD EPYC 7763) @@ -319,6 +373,10 @@ L1 Cache ~1.1 32 KB L2 Cache ~3.3 512 KB L3 Cache ~12.8 32 MB +::: + +:::::::: + :::{.incremental} - 256 GB of main memory (default) with a theoretical memory bandwidth of ~200 GB/s @@ -327,7 +385,17 @@ L3 Cache ~12.8 32 MB -## Memory Pyramid (downwards) - check numbers {auto-animate=true} +## Memory Pyramid (downwards) {auto-animate=true} + +::::::::{.r-stack} + +:::{.normal style="color: #ffcccc; font-size: 3em; font-weight: bold; rotate: -30deg; opacity: 0.5;"} + +Check numbers + +::: + +:::{.normal} Order of magnitude on Levante (AMD EPYC 7763) @@ -339,6 +407,10 @@ L2 Cache ~3.3 512 KB L3 Cache ~12.8 32 MB Main Memory 60 256 GB +::: + +:::::::: + :::{.incremental} - Fast Data as Flash based file system @@ -347,7 +419,17 @@ Main Memory 60 256 GB -## Memory Pyramid (downwards) - check numbers {auto-animate=true} +## Memory Pyramid (downwards) {auto-animate=true} + +::::::::{.r-stack} + +:::{.normal style="color: #ffcccc; font-size: 3em; font-weight: bold; rotate: -30deg; opacity: 0.5;"} + +Check numbers + +::: + +:::{.normal} Order of magnitude on Levante (AMD EPYC 7763) @@ -358,7 +440,11 @@ L1 Cache ~1.1 32 KB L2 Cache ~3.3 512 KB L3 Cache ~12.8 32 MB Main Memory 60 256 GB -SSD 100 1 PB +SSD 100 200 TB + +::: + +:::::::: :::{.incremental} @@ -368,7 +454,17 @@ SSD 100 1 PB -## Memory Pyramid (downwards) - check numbers {auto-animate=true} +## Memory Pyramid (downwards) {auto-animate=true} + +::::::::{.r-stack} + +:::{.normal style="color: #ffcccc; font-size: 3em; font-weight: bold; rotate: -30deg; opacity: 0.5;"} + +Check numbers + +::: + +:::{.normal} Order of magnitude on Levante (AMD EPYC 7763) @@ -379,15 +475,13 @@ L1 Cache ~1.1 32 KB L2 Cache ~3.3 512 KB L3 Cache ~12.8 32 MB Main Memory ~60 256 GB -SSD ~100 1 PB +SSD ~100 200 TB Hard disk ~3000 130 PB -:::{.incremental} - - - Tape backup also possible - ::: +:::::::: + ## Memory Mountain (1/2)