Skip to content
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

Cmake modernize #8425

Merged
merged 39 commits into from
Feb 12, 2021
Merged

Cmake modernize #8425

merged 39 commits into from
Feb 12, 2021

Conversation

lefticus
Copy link
Contributor

@lefticus lefticus commented Dec 15, 2020

Pull request overview

Modernize CMake

  • prefer target_ directives over global settings
  • use cmake-format for consistent formatting
  • add a .cmake-format.yaml file at the top level which can be adjusted as needed

cmake-format is a pip package, easily installable on all platforms.

@lefticus lefticus added the Refactoring Includes code changes that don't change the functionality of the program, just perform refactoring label Dec 15, 2020
@mitchute mitchute mentioned this pull request Dec 24, 2020
20 tasks
@Myoldmopar
Copy link
Member

@lefticus so something is happening on this PR. We noticed Windows CI was struggling a couple times and eventually deduced that this branch was just eating days of the CI time. Just on Windows. You can see the results from that last commit and how the test time was about 220843 seconds. I'm not sure what changed on the build on Windows, but something definitely went awry.

For reference, the bigobj change already dropped into develop this morning and hasn't caused any issues with CI, so it's not that.

@lefticus
Copy link
Contributor Author

lefticus commented Dec 30, 2020 via email

@Myoldmopar
Copy link
Member

It seems to be happening again. I logged into the CI box and found these error messages popping up. Again, only on this branch.

Screen Shot 2020-12-30 at 9 11 02 AM

Screen Shot 2020-12-30 at 9 10 45 AM

@lefticus
Copy link
Contributor Author

lefticus commented Dec 30, 2020 via email

@Myoldmopar
Copy link
Member

@lefticus OK, that reversion definitely took care of the runtime issue. With the last build everything reported back in expected fashion.

There were a few build warnings on the last build though:

  • Mac is reporting a few unused variables in our own code which I can easily address.
  • Linux is reporting some build warnings in a third-party folder. I'd need to look at your modernized code to determine the best practice for muting things now.
  • Windows is reporting a bunch of warnings in the E+ code. I think we may need to itemize them to determine how to proceed with them. As an aside, it looks like the build warnings aren't being parsed properly by Decent CI as the links from that page aren't working. Some line/column number processing is off and it isn't doing some path manipulation right either. I'm not sure if something you modified would've changed the form of the Visual Studio error message, but I'll just need to figure out the pattern and fix it over in our fork of Decent.

It would be good to get some more feedback from others if they are interested.

Copy link
Member

@Myoldmopar Myoldmopar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still need to look a little further, but overall, this is such a nice standardization of our cmake rules. And we have so, so many.

add_simulation_test(IDF_FILE CoolingTower_VariableSpeed_CondEntTempReset.idf EPW_FILE USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw)
add_simulation_test(IDF_FILE CoolingTower_VariableSpeed_CondEntTempReset_MultipleTowers.idf EPW_FILE USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw)
add_simulation_test(IDF_FILE CoolingTower_VariableSpeed_IdealCondEntTempSetpoint.idf EPW_FILE USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw)
add_simulation_test(IDF_FILE CoolingTower_VariableSpeed_IdealCondEntTempSetpoint_MultipleTowers.idf EPW_FILE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any change to this file may require some polishing in a couple places:

  • The regression tool may still look to this file for matching EPWs with IDFs. I actually can't recall at this very moment.
  • There is a custom_check script that verifies all IDFs found in the testfiles directory are listed in this file. I think it does a simple line-by-line match, so line breaking will cause potential false positive/negatives and what-not.

@@ -0,0 +1,229 @@
_help_parse: Options affecting listfile parsing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standardized format. Nice. I wonder what all editors respect this file.

endif()
target_include_directories(project_options INTERFACE ${PROJECT_SOURCE_DIR}/third_party/kiva-ep/src)
target_include_directories(project_options INTERFACE "${kiva_BINARY_DIR}/src/libkiva")
target_include_directories(project_options SYSTEM INTERFACE "${kiva_SOURCE_DIR}/vendor/boost-1.61.0/")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did these have to get pulled from the third_party directory rules?

# ADD_CXX_DEFINITIONS("-d2SSAOptimizer-") # this disables this optimizer which has known major issues

# ADDITIONAL RELEASE-MODE-SPECIFIC FLAGS
target_compile_options(project_options INTERFACE $<$<CONFIG:Release>:/GS->) # Disable buffer overrun checks for performance in release mode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

@nrel-bot-3
Copy link

@lefticus @lgentile it has been 28 days since this pull request was last updated.

@lefticus
Copy link
Contributor Author

@Myoldmopar this line of code, by using abs is actually doing an integral comparison (this is caught now because we have more warnings enabled)

https://github.com/NREL/EnergyPlus/blob/cmake_modernize/src/EnergyPlus/Coils/CoilCoolingDXCurveFitSpeed.cc#L600

This is almost certainly not the intention. It can be fixed by moving to std::abs (the C++ version, which has overloads), but I wanted some input and sanity check before I made this change.

@Myoldmopar
Copy link
Member

Yay! Custom check is all clean. I know you still need to pull develop in, merge any conflicts, and mark it ready to review, so I'll be ready to review and merge once it's all good to go. Thanks @lefticus !

@lefticus lefticus marked this pull request as ready for review February 11, 2021 23:39
@Myoldmopar
Copy link
Member

All green here! Thanks @lefticus

@Myoldmopar Myoldmopar merged commit e8bf5ea into develop Feb 12, 2021
@Myoldmopar Myoldmopar deleted the cmake_modernize branch February 12, 2021 14:09
@jmarrec jmarrec mentioned this pull request May 19, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactoring Includes code changes that don't change the functionality of the program, just perform refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants