Contents
Using Intel Vectorization Advisor for gcc
Intel Advisor provides the possibility to be used together with GNUs gcc as well.Get Started
We closely follow here the analysis presented for the Intel compiler now using both, the module for Intel and the module for the latest GNU compiler:
module add intel/latest
module add gcc/latest
and compile the same program as specified here with gcc:
module add gcc/latest
gcc -g -O3 simple01.c -fopt-info-vec -ftree-vectorize -o simple01_gcc
Using the GUI advixe-gui we immediately find out, that these options
support SSE and SSE2 but no AVX instruction set.
Unfortunately the provided recommendations are not useful at all:
But reading the compiler manual (man gcc in a
command window) or reading GNUS online Docu provides
information to add support vor AVX. It's the additional option
-mavx that adds support for AVX (version 1 with 256 bits) and -mavx2
that adds support for AVX2 (enhanced 256 bits).
Unfortunately, changing to AVX512 is not just -mavx512, because there are several flavours of AVX512. Instead it is best to switch to an architecture dependent option, in our case -march=skylake-avx512. For completeness, the whole compilations sequence reads now
gcc -g -O3 simple01.c -fopt-info-vec -ftree-vectorize -march=skylake-avx512 -o simple01_gcc
and indeed, the examples uses now the AVX512 instruction set and the
512 bit wide ZMM registers.
For the moment we don't have to care about this difference, as both versions do the same work in almost identical time.