-
Notifications
You must be signed in to change notification settings - Fork 918
Faster compilation #853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Faster compilation #853
Conversation
restructure and clean config_structure
| static const map<string, AVERAGE_TYPE> Average_Map = CCreateMap<string, AVERAGE_TYPE> | ||
| ("AREA", AVERAGE_AREA) | ||
| ("MASSFLUX", AVERAGE_MASSFLUX); | ||
| static const MapType<string, AVERAGE_TYPE> Average_Map = { | ||
| MakePair("AREA", AVERAGE_AREA) | ||
| MakePair("MASSFLUX", AVERAGE_MASSFLUX) | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what the map declaration semantics look like now, so that they can be switched on/off.
When map declarations are needed #define ENABLE_MAPS before including either config/option_structure.hpp, by default this is not default.
MakePair is a "do-nothing" macro when that flag is not defined, MapType is defined at the top as either std::map or a dummy empty class when the flag is not defined.
|
Thanks @pcarruscag ! FYI: that makes compilation like 5 times faster on our system ... |
Yeah, the speedup is ridiculous. On 28cores on our system an MPI build (no AD-stuff involved) takes ~30 seconds instead of 3min. 🐎 vs 🐌 |
talbring
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe its a good thing to clean up config_structure now ... We can also think about renaming it (that should be tracked by git anyway).
|
I already did the spaces, the tabs, the inlines, what more is there? |
Just wanted to say that I think its good that you did that 👍 |
|
We could always look for unused methods amongst the thousand or so we have 🤣 |
|
Nice job on the compile speed up @pcarruscag 👍 |
| @@ -174,34 +147,35 @@ enum AVERAGE_TYPE { | |||
| AVERAGE_AREA = 1, /*!< \brief Area-weighted average. */ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While major changes are happening in this file, it could be a good time to finally remove the integer specifiers for each value in the enums, which aren't needed. Up to you if you have time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm If we did not cast every enum to unsigned short in CConfig I would agree, and it should be doable with a script. But for debugging I find it useful to know what number to expect without having to count / print extra stuff.
jayantmukho
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes seem to be pretty straight forward. Got a speedup of ~3.8x for compilation with AD and pywrapper. (meson+ninja)
Since the config has been restructured, you could change the file name to CConfig.
|
Files renamed |
talbring
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks fine! Lets get that in asap. Thanks @pcarruscag once again ..
TobiKattmann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some very picky comments only related to comments and alignment so you might as well ditch them.
I would have preferred though to separate the CConfig refactor + and cleanup and the compile time stuff in different PR's to improve PR's readability.
But anyway, the compile time improvement is awesome and the cleanup goes beyond just stripping whitespaces but includes alignements, typo-fixes, the const-additions etc ... so thanks a lot!
|
|
||
| void addStringOption(const string name, string & option_field, string default_value); | ||
|
|
||
| void addIntegerOption(const string name, int & option_field, int default_value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add documentation here, although there is a general explanation on top.
But it is not really the job of the 'refactorer' to sanitize everything, so you might as well ignore this comment ... and all my other comments 😄
As my brother tends to say: The 'good' shouldn't be the enemy of the 'better' ☮️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the doxy stuff in these files only contribute to confusion, the methods explain themselves but then they have some copy pasted brief from other methods... I'll address some of your comments, thanks for looking through the stuff.
|
|
||
| void addDoubleArrayOption(const string name, const int size, su2double * & option_field, su2double * default_value); | ||
|
|
||
| void addDoubleListOption(const string name, unsigned short & size, su2double * & option_field); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here again no documentation
Proposed Changes
Addresses the compilation time issue (#851) in the way discussed with @talbring in #824.
Plus, I think it is time to bite the bullet and cleanup CConfig, no more .inl, tabs replaced (but the comments still look ok-ish), methods made const when possible.
This will probably cause you issues, but the changes to these files are usually very linear and so, easy to re-apply.
There is no more CCreateMap function, in C++11 braced initialization can be used instead e.g.:
map<string, string> AverageGroupName = {{"BGS_RES", "bgs"},{"RMS_RES","rms"},{"MAX_RES", "max"}};PR Checklist