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

Fix when Compiling with non-standard CMake Configurations #8378

Merged
merged 25 commits into from
Nov 30, 2020

Conversation

mitchute
Copy link
Collaborator

@mitchute mitchute commented Nov 12, 2020

Pull request overview

  • Fixes when compiling with the following
    • EP_nocache_Psychrometrics
    • EP_cache_GlycolSpecificHeat
    • LINK_WITH_PYTHON=OFF
  • Adds CMake commands and CI runs to build the following:
    • LINK_WITH_PYTHON=OFF
    • USE_PSYCHROMETRICS_CACHING=OFF
    • USE_GLYCOL_CACHING=OFF
    • USE_PSYCH_STATS=ON
    • USE_PSYCH_ERRORS=OFF

Pull Request Author

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context)
  • Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish
  • Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair
  • Author should provide a "walkthrough" of relevant code changes using a GitHub code review comment process
  • If any diffs are expected, author must demonstrate they are justified using plots and descriptions
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions
  • If any defect files are updated to a more recent version, upload new versions here or on DevSupport
  • If IDD requires transition, transition source, rules, ExpandObjects, and IDFs must be updated, and add IDDChange label
  • If structural output changes, add to output rules file and add OutputChange label
  • If adding/removing any LaTeX docs or figures, update that document's CMakeLists file dependencies

Reviewer

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • If branch is behind develop, merge develop and build locally to check for side effects of the merge
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified
  • Check that performance is not impacted (CI Linux results include performance check)
  • Run Unit Test(s) locally
  • Check any new function arguments for performance impacts
  • Verify IDF naming conventions and styles, memos and notes and defaults
  • If new idf included, locally check the err file and other outputs

@mitchute mitchute added Defect Includes code to repair a defect in EnergyPlus DoNotPublish Includes changes that shouldn't be reported in the changelog labels Nov 12, 2020
@mitchute mitchute added this to the EnergyPlus Future milestone Nov 12, 2020
@mitchute mitchute self-assigned this Nov 12, 2020
@mitchute mitchute changed the title Fix EP_nocache_Psychrometrics Fix when Compiling with EP_nocache_Psychrometrics Nov 12, 2020
@JasonGlazer
Copy link
Contributor

@mitchute I posted #8377 which would help catch this kind of thing in the future.

@mitchute
Copy link
Collaborator Author

Thanks, @JasonGlazer. This PR is adding CI runs to the GitHub actions workflows to build with LINK_WITH_PYTHON=ON/OFF and USE_PSYCHROMETRIC_CACHING=ON/OFF, so this should address #8377. Are there other macros like this we need to catch?

@JasonGlazer
Copy link
Contributor

I don't know, I presume so but I'm not sure.

@mitchute
Copy link
Collaborator Author

Here are some other macros in EnergyPlus that we may want to also consider:

  • EP_Detailed_Timings
  • EP_Count_Calls
  • SKYLINE_MATRIX_REMOVE_ZERO_COLUMNS
  • EP_cache_GlycolSpecificHeat
  • GROUND_PLOT
  • EP_psych_errors
  • EP_psych_stats
  • EP_NO_OPENGL

@Myoldmopar
Copy link
Member

@mitchute looks like there is indeed still some issue here, but this will be a really great addition. I don't know exactly how many of those definition conditionals we want to check...our list of possible builds could become monstrous. We surely don't need to build special versions of these on every single commit:

  • EP_Detailed_Timings
  • EP_Count_Calls
  • SKYLINE_MATRIX_REMOVE_ZERO_COLUMNS
  • GROUND_PLOT

I'd be interested in what happens if we toggle the other 4.

We could consider adding some special builds of more obscure build configurations to each tag rather than each commit. That way CI will only do those builds when we do package building.

@mitchute
Copy link
Collaborator Author

OK, I'm not sure what the problem is currently. I haven't seen any build problems locally on Mac and Linux, but I'll investigate more.

@jasondegraw
Copy link
Member

@Myoldmopar @mitchute I'm honestly not sure if you're trolling me now, but please remove SKYLINE_MATRIX_REMOVE_ZERO_COLUMNS from the list. It isn't the flag you're looking for.

@mitchute
Copy link
Collaborator Author

I'm honestly not sure if you're trolling me now

Wouldn't that be fun... :trollface:

I just straight up did a search of the code for all of the preprocessor macros and listed them. No trolling intended. 😄

@mitchute
Copy link
Collaborator Author

@Myoldmopar This is looking like NREL CI may need to run CMake again to catch these new flags. If you take a look at the GitHub builds for USE_PSYCHROMETRICS_CACHING=OFF, you will see that they are failing with the same errors as the NREL CI machines which should have caching turned on.

@mitchute
Copy link
Collaborator Author

Currently, we have the following build matrix enabled on this branch.

CI Platform Build Name LINK_WITH_PYTHON USE_PSYCHROMETRICS_CACHING USE_GLYCOL_CACHING USE_PSYCH_STATS USE_PSYCH_ERRORS OPENGL_REQUIRED
Decent CI N/A (Every push/tag) X X X X X
GH Actions python_no_psychcach X X X X
GH Actions no_python_psychcach X X X X
GH Actions no_python_no_psychcach X X X
GH Actions no_glcol_cache X X X
GH Actions no_opengl X X X
GH Actions use_psych_stats X X X X X
GH Actions no_use_psych_errors X X X X

I'm not sure if we want to run them all on every push, but this should at least demonstrate that they are now all working.

@mitchute mitchute changed the title Fix when Compiling with EP_nocache_Psychrometrics Fix when Compiling with non-standard CMake Configurations Nov 23, 2020
@mitchute
Copy link
Collaborator Author

@Myoldmopar @mjwitte this is ready for review.

Copy link
Contributor

@mjwitte mjwitte left a comment

Choose a reason for hiding this comment

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

@mitchute The c++ changes all look ok to me. I'll yield to @Myoldmopar regarding the cmake and actions changes.

@@ -1343,4 +1376,4 @@ namespace Psychrometrics {

} // namespace EnergyPlus

#endif
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

This file needs an endline at the end.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll probably just add this to one of my upcoming globals branches and not spend more CI cycles on this.

Copy link
Member

Choose a reason for hiding this comment

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

👍

Comment on lines +662 to +663
[[maybe_unused]] std::string const &CalledFrom = blank_string, // routine this function was called from (error messages)
[[maybe_unused]] bool const SuppressWarnings = false // if calling function is calculating an intermediate state
Copy link
Contributor

Choose a reason for hiding this comment

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

I was going to question adding maybe_unused to these arguments when they have defaults, but I see now that certain arguments do truly become unused based on the state of the ifdefs. That makes sense.

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.

No problems here, this will definitely keep Github Action instances busy for us 👍

- name: Build EnergyPlus
working-directory: ${{runner.workspace}}/EnergyPlus/build
shell: bash
run: cmake --build . --target energyplus -j 2
Copy link
Member

Choose a reason for hiding this comment

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

This is fantastic!

mark_as_advanced(USE_PSYCHROMETRICS_CACHING)
mark_as_advanced(USE_GLYCOL_CACHING)
mark_as_advanced(USE_PSYCH_STATS)
mark_as_advanced(USE_PSYCH_ERRORS)
Copy link
Member

Choose a reason for hiding this comment

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

It's really great having some new CMake (advanced) variables for turning compiler settings on and off.

@@ -1328,7 +1328,7 @@ namespace PluginManagement {
}
}
#else
void PluginManager::setGlobalVariableValue([[maybe_unused]] EnergyPlusData &state, int EP_UNUSED(handle), Real64 EP_UNUSED(value))
void PluginManager::setGlobalVariableValue([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] int handle, [[maybe_unused]] Real64 value)
Copy link
Member

Choose a reason for hiding this comment

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

Yay for fixed syntax errors!

constexpr int iPsyRhFnTdbRhovLBnd0C = 13;
constexpr int iPsyTwbFnTdbWPb_cache = 18;
constexpr int iPsyPsatFnTemp_cache = 19;
constexpr int NumPsychMonitors = 19; // Parameterization of Number of psychrometric routines that
Copy link
Member

Choose a reason for hiding this comment

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

Oh yes.

#endif
#ifdef EP_cache_PsyTsatFnHPb
extern Array1D<cached_tsat_h_pb> cached_Tsat_HPb; // DIMENSION(0:tsat_hbp_cache_size)
inline Array1D<cached_tsat_h_pb> cached_Tsat_HPb; // DIMENSION(0:tsat_hbp_cache_size)
Copy link
Member

Choose a reason for hiding this comment

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

👍

@Myoldmopar
Copy link
Member

I thought I had merged this...well I am now. Thanks so much for this @mitchute, this will make sure all these conditional code paths are building all the time now!

@Myoldmopar Myoldmopar merged commit c1905e6 into develop Nov 30, 2020
@Myoldmopar Myoldmopar deleted the fix_nocache_psychrometrics branch November 30, 2020 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Defect Includes code to repair a defect in EnergyPlus DoNotPublish Includes changes that shouldn't be reported in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants