roberto.alfieri:pub:vectorization
Differenze
Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
Prossima revisione | Revisione precedenteUltima revisioneEntrambe le parti successive la revisione | ||
roberto.alfieri:pub:vectorization [12/06/2017 16:37] โ creata roberto.alfieri | roberto.alfieri:pub:vectorization [14/06/2017 11:30] โ roberto.alfieri | ||
---|---|---|---|
Linea 1: | Linea 1: | ||
- | ===== Vectorization ===== | + | ====== Vectorization |
+ | [[ http:// | ||
+ | |||
+ | |||
+ | Processor peak performance includes the speed-up provided by the vector instructions, | ||
+ | but in order to exploit it you need specific programming techniques. | ||
+ | |||
+ | |||
+ | |||
+ | {{: | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | {{: | ||
+ | |||
+ | |||
+ | |||
+ | Auto-vectorization is the easiest and more portable way to get vectorization. | ||
+ | |||
+ | The compiler recognize several vectiorization options. | ||
+ | |||
+ | Main vectorization options: | ||
+ | |||
+ | ^ | ||
+ | ^ KNL | -xMIC-AVX512 | ||
+ | ^ BDW | -xCORE-AVX2 | ||
+ | ^ Disable | ||
+ | |||
+ | Not all loops can be vectorized: | ||
+ | |||
+ | Some examples: | ||
+ | |||
+ | * Loop with dependencies between iterations | ||
+ | |||
+ | < | ||
+ | for (i=1; i<MAX; i++) { | ||
+ | d[i] = e[i] โ a[i-1]; | ||
+ | a[i] = b[i] + c[i]; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | * Complex loops | ||
+ | |||
+ | * Function calls inside the loop: | ||
+ | |||
+ | for (int i = 0; i < N; i++) a[i] = foo(b[i]); | ||
+ | |||
+ | * Loops on data that are not aligned in memory | ||
+ | |
roberto.alfieri/pub/vectorization.txt ยท Ultima modifica: 14/06/2017 11:30 da roberto.alfieri