-
Notifications
You must be signed in to change notification settings - Fork 75
Compiler Flags
The section address the following two compilers:
- Intel (
icpc
); - GNU/GCC (
g++
);
However please note different/additional compilers are supported (if you find any issues with a specific compiler, please let us know)
For VPIC to obtain good performance (a factor of more than 2x
), you need to ensure two things:
- The correct vector width has been selected for the platform during compilation
- The correct compiler flags were used for the platform (in addition to a
RELEASE
cmake build, which enables-O3
by default)
This means that for good performance, you must compile VPIC on a per-platform basis
CMake offers native support for user defined compiler optimization flags through the CMAKE_CXX_FLAGS
variable. Users should set the variable when invoking CMake to compile the core VPIC library. This will likely look something like:
cmake -DCMAKE_CXX_FLAGS="-rdynamic" ..
Currently users may see a performance benefit from also setting CMAKE_C_FLAGS
(same flags) for the pure C portion of VPIC, however this will ultimately be phased out in favor of pure C++.
To generate correct code for #2 above (when not cross-compiling) the user can use -XHost
.
The following flags have been shown to give good performance on modern intel architectures:
-O3 -rdynamic -inline-forceinline -qoverride-limits -no-ansi-alias -xHost
To generate correct code for #2 above (when not cross-compiling) the user can use -march=native
.
Additionally GCC requires the use of -fno-strict-aliasing
for correct results.
A following is good initial attempt at compiling for GCC:
-O3 -rdynamic -fno-strict-aliasing