CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums

Quick notes on testing optimization flags with OpenFOAM et al

Register Blogs Community New Posts Updated Threads Search

Rate this Entry

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:
Code:
-march=native -mtune=native
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:
  1. Go into the folder "wmake/rules/linux64Gcc"
  2. Copy the files "cOpt" and "c++Opt" to another name, for example: "cOptNative" and "c++OptNative"
  3. "cOPT" and "c++OPT" are the lines that need to be updated.
  4. 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'
  5. Start a new terminal and activate this alias ofdevNative.
  6. Then run ./Allwmake inside "OpenFOAM-dev".
  7. 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
Views 1962 Comments 0 Edit Tags Email Blog Entry
« Prev     Main     Next »
Total Comments 0

Comments

 

All times are GMT -4. The time now is 14:24.