Quick notes on testing optimization flags with OpenFOAM et al
Posted January 20, 2020 at 19:45 by wyldckat
Greetings to all!
Tobi sent me an email earlier today related to this and I might as well leave a public note as well, to share with everyone the suggestions I had... so this is a quick copy-paste-adapt for future reference, until I or anyone else bothers with writing this at openfoamwiki.net
I have no idea yet for the current generation of Ryzen CPUs (Ryzen 3000 series), but I do know of this report for EPYC: http://www.prace-ri.eu/best-practice-guide-amd-epyc
If you look for Table 5, you will see the options they suggest for GCC/G++.
However, the "znver1" architecture is possibly not the best for this generation of Ryzen/Threadripper... there is an alternative, which is to use:
It will only work properly with a recent GCC version for the more recent CPUs.
Beyond this, it might take some trial and error. Some guidelines are given here: https://wiki.gentoo.org/wiki/GCC_optimization
You can use the following strategy to test various builds with different optimization flags:
Warning: Last time I checked, AVX and AVX2 are not used by OpenFOAM, so don't bother with them.
Best regards,
Bruno
Tobi sent me an email earlier today related to this and I might as well leave a public note as well, to share with everyone the suggestions I had... so this is a quick copy-paste-adapt for future reference, until I or anyone else bothers with writing this at openfoamwiki.net
I have no idea yet for the current generation of Ryzen CPUs (Ryzen 3000 series), but I do know of this report for EPYC: http://www.prace-ri.eu/best-practice-guide-amd-epyc
If you look for Table 5, you will see the options they suggest for GCC/G++.
However, the "znver1" architecture is possibly not the best for this generation of Ryzen/Threadripper... there is an alternative, which is to use:
Code:
-march=native -mtune=native
Beyond this, it might take some trial and error. Some guidelines are given here: https://wiki.gentoo.org/wiki/GCC_optimization
You can use the following strategy to test various builds with different optimization flags:
- Go into the folder "wmake/rules/linux64Gcc"
- Copy the files "cOpt" and "c++Opt" to another name, for example: "cOptNative" and "c++OptNative"
- "cOPT" and "c++OPT" are the lines that need to be updated.
- Create a new alias in your ".bashrc" file for this, for example:
Code:alias ofdevNative='source $HOME/OpenFOAM/OpenFOAM-dev/etc/bashrc WM_COMPILE_OPTION=OptNative'
- Start a new terminal and activate this alias ofdevNative.
- Then run ./Allwmake inside "OpenFOAM-dev".
- Repeat the same strategy for other names and therefore you can do several builds with small changes to the optimization flags.
Warning: Last time I checked, AVX and AVX2 are not used by OpenFOAM, so don't bother with them.
Best regards,
Bruno
Total Comments 0