Commit f5bdafdebdedea5ad559405674e7482440768740
Committed by
Michał Szydłowski
1 parent
eef141a4
Pierwsza wersja wstępu
Showing
7 changed files
with
64 additions
and
4 deletions
bare_adv.pdf
0 → 100644
No preview for this file type
bare_adv.synctex.gz
0 → 100644
No preview for this file type
bare_conf_compsoc.pdf
0 → 100644
No preview for this file type
bare_conf_compsoc.synctex.gz
0 → 100644
No preview for this file type
bare_jrnl_compsoc.pdf
0 → 100644
No preview for this file type
bare_jrnl_compsoc.synctex.gz
0 → 100644
No preview for this file type
bare_jrnl_compsoc.tex
... | ... | @@ -366,6 +366,29 @@ |
366 | 366 | % correct bad hyphenation here |
367 | 367 | \hyphenation{op-tical net-works semi-conduc-tor} |
368 | 368 | |
369 | +\usepackage{listings} | |
370 | +\usepackage{color} | |
371 | + | |
372 | +\definecolor{dkgreen}{rgb}{0,0.6,0} | |
373 | +\definecolor{gray}{rgb}{0.5,0.5,0.5} | |
374 | +\definecolor{mauve}{rgb}{0.58,0,0.82} | |
375 | + | |
376 | +\lstset{frame=tb, | |
377 | + language=C++, | |
378 | + aboveskip=3mm, | |
379 | + belowskip=3mm, | |
380 | + showstringspaces=false, | |
381 | + columns=flexible, | |
382 | + basicstyle={\small\ttfamily}, | |
383 | + numbers=none, | |
384 | + numberstyle=\tiny\color{gray}, | |
385 | + keywordstyle=\color{blue}, | |
386 | + commentstyle=\color{dkgreen}, | |
387 | + stringstyle=\color{mauve}, | |
388 | + breaklines=true, | |
389 | + breakatwhitespace=true, | |
390 | + tabsize=3 | |
391 | +} | |
369 | 392 | |
370 | 393 | \begin{document} |
371 | 394 | % |
... | ... | @@ -537,12 +560,49 @@ Computer Society, IEEE, IEEEtran, journal, \LaTeX, paper, template. |
537 | 560 | % |
538 | 561 | % Here we have the typical use of a "T" for an initial drop letter |
539 | 562 | % and "HIS" in caps to complete the first word. |
540 | -\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file'' | |
541 | -for IEEE Computer Society journal papers produced under \LaTeX\ using | |
542 | -IEEEtran.cls version 1.8b and later. | |
563 | +\IEEEPARstart{F}{rom} the beginning of computer science there exists a problem in speed differences between processors and memories. | |
564 | +Processors have usually higher frequencies than memories containing data necessary for processor to perform calculations and in result processors spend much time being idle. | |
565 | +That is why they have really fast cache memory at their disposal, however because the cost of such memory is pretty high, its amount is not sufficient. | |
566 | +This problem is more widely known as data locality problem and it is quite serious, especially during execution of loops through significant amount of data. | |
567 | +Nowadays this problem is connected to phenomenon called cache memory miss, which occurs when processor asks for further data and it is not in cache memory. | |
568 | +Then computer needs to retrieve data from RAM memory, which is sllower than processor speed so from here we have this idle time of processors when they are wasting time. | |
569 | +Obvious solution for that is to decrease number of cache misses, so processor can operate without obstacles and data loading from RAM wil take place during time when processor will be performing other tasks. | |
570 | + | |
571 | +Many solutions and optimizations were proposed to minimize impact of data locality by decreasing cache misses, one of such methods is called tiling. | |
572 | +It derived from strip mining transformation, which was invented in times of vector processors. | |
573 | +It takes an original loop from program and divides it into smaller ones, called stripes, what on vector processors allowed for vectorization of smaller loops but nowadays it hold almost no improvement for execution speed of programs. | |
574 | +Tiling is utilizing the same idea but it is more suitable for modern processors as it enables more possibilities for other improvements and giving some gains on its own. | |
575 | +Tiling usually works on loop nests, transforming it into even larger loop nest by adding additional loops to the inside of the nest, increasing loops number twice. | |
576 | +However, overall number of iterations remain the same, thay are just grouped differently, what already can provide deacrease in cache memory misses. | |
577 | +Let's take a look at simple loop nest. | |
578 | + | |
579 | +\begin{lstlisting} | |
580 | +for(int i = 0; i < n; i++){ | |
581 | + for(int j = 0; j < n; j++){ | |
582 | + Stmt(i,j); | |
583 | + } | |
584 | +} | |
585 | +\end{lstlisting} | |
586 | + | |
587 | +This loop nest is transformed by tiling into more complex form. | |
588 | + | |
589 | +\begin{lstlisting} | |
590 | +for(int Ti = 0; Ti < n; Ti += 64){ | |
591 | + for(int Tj = 0; Tj < m; Tj += 64){ | |
592 | + for(int i = Ti; i < min(Ti+63, n); i++){ | |
593 | + for(int j = Tj; j < min(Tj+63,m); j++){ | |
594 | + Stmt(i,j); | |
595 | + } | |
596 | + } | |
597 | + } | |
598 | +} | |
599 | +\end{lstlisting} | |
600 | + | |
601 | +As it can be seen the number of iteration is exactly the same but they happen in parts instead of iterating through whole j loop and then starting next i loop iteration. | |
602 | +Number 64 in these loops is called tile size and is very important for efficency of this optimalization as it tries to limit amount of data loaded to cache memory from RAM, so for one iteration processor would have all data it needs to complete calculation, without a need to laod additional data. Unfortunately this number have to be optimized for each computer, because many processors are different from each other and have different cache memory configurations. | |
603 | + | |
543 | 604 | % You must have at least 2 lines in the paragraph with the drop letter |
544 | 605 | % (should never be an issue) |
545 | -I wish you the best of success. | |
546 | 606 | |
547 | 607 | \hfill mds |
548 | 608 | ... | ... |