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

Final grounding and deglobalizing #8668

Merged
merged 23 commits into from
Mar 30, 2021
Merged

Conversation

Myoldmopar
Copy link
Member

Pull request overview

Finishes the global and static refactor of EnergyPlus. There are now zero (known) global variables or static variables in our codebase, and EnergyPlus has achieved thread-safety. For the first time ever, we are able to run EnergyPlus in a multithreaded environment which is going to enable many great new applications.

Notes:

  • This required moving some last minute global objects, which touched a lot of objects. For example, the global inputProcessor had to be pulled onto state as well. This branch has a lot of file diffs, but it is all clean on CI.
  • There was a very weird issue with the RE2 library once I pulled the output variable storage into state. For now there is a hacky workaround that is already being investigated by @lefticus and we will hopefully figure out a more formal solution by release, but if not, it can go out in the current state.
  • The build times are getting worse because of the state variables, and we are actively working on that. As soon as the release is out the door we'll be taking the work from @mbadams5 and @jasondegraw, and the prototype and roadmap that @lefticus worked on, and come up with a major improvement on build time. It will likely involve removing most of the Array1D objects or at least trimming their functionality way down, and then also carefully moving data that got put on state into struct members where appropriate.

Example multithreaded output for those curious folks:

$ ./MultiThreadedEPlusAPI
Thread: Running at working directory: /tmp/test_c_thread_1
Thread: Running at working directory: /tmp/test_c_thread_2
Thread: Running at working directory: /tmp/test_c_thread_3
EnergyPlus Starting
EnergyPlus, Version 9.5.0-cedf66d837, YMD=2021.03.29 15:58
EnergyPlus Starting
EnergyPlus, Version 9.5.0-cedf66d837, YMD=2021.03.29 15:58
EnergyPlus Starting
EnergyPlus, Version 9.5.0-cedf66d837, YMD=2021.03.29 15:58
Initializing Response Factors
Calculating CTFs for "ROOF-1"
Calculating CTFs for "WALL-1"
Calculating CTFs for "FLOOR-SLAB-1"
Calculating CTFs for "INT-WALL-1"
Initializing Window Optical Properties
Initializing Solar Calculations
Allocate Solar Module Arrays
Initializing Zone and Enclosure Report Variables
Initializing Surface (Shading) Report Variables
Computing Interior Solar Absorption Factors
Determining Shadowing Combinations
Computing Window Shade Absorption Factors
Proceeding with Initializing Solar Calculations
Initializing Surfaces
Initializing Outdoor environment for Surfaces
Setting up Surface Reporting Variables
Initializing Temperature and Flux Histories
Initializing Window Shading
Computing Interior Absorption Factors
Computing Interior Diffuse Solar Absorption Factors
Initializing Solar Heat Gains
Initializing Internal Heat Gains
Initializing Interior Solar Distribution
Initializing Interior Convection Coefficients
Gathering Information for Predefined Reporting
Completed Initializing Surface Heat Balance
Calculate Outside Surface Heat Balance
Calculate Inside Surface Heat Balance
Calculate Air Heat Balance
Initializing HVAC
Warming up
Adjusting Air System Sizing
Adjusting Standard 62.1 Ventilation Sizing
Initializing Simulation
Warming up
Reporting Surfaces
Beginning Primary Simulation
Initializing New Environment Parameters
Warming up {1}
Starting Simulation at 12/21 for DENVER_STAPLETON ANN HTG 99.6% CONDNS DB
Warming up
Initializing New Environment Parameters
Warming up {1}
Starting Simulation at 07/21 for DENVER_STAPLETON ANN CLG .4% CONDNS DB=>MWB
Writing tabular output file results using HTML format.
Warming up
Warming up
Warming up
Performing Zone Sizing Simulation for Load Component Report
...for Sizing Period: #1 CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB
Warming up
Warming up
Adjusting Air System Sizing
Adjusting Standard 62.1 Ventilation Sizing
Initializing Simulation
EnergyPlus Run Time=00hr 00min  0.16sec
Warming up
Warming up
Reporting Surfaces
Beginning Primary Simulation
Initializing New Environment Parameters
Warming up {1}
Starting Simulation at 07/21 for CHICAGO ANN CLG 1% CONDNS DB=>MWB
Warming up
Initializing New Environment Parameters
Warming up {1}
Starting Simulation at 01/21 for CHICAGO ANN HTG 99% CONDNS DB
Warming up
Writing tabular output file results using HTML format.
Performing Zone Sizing Simulation for Load Component Report
...for Sizing Period: #2 CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB
EnergyPlus Completed Successfully.
Writing final SQL reports
Re-zeroing zone sizing arrays
Warming up
Warming up
Warming up
Warming up
Warming up
EnergyPlus Run Time=00hr 00min  0.20sec
Warming up
Performing Zone Sizing Simulation
...for Sizing Period: #1 CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB
Warming up
Warming up
Warming up
EnergyPlus Completed Successfully.
Warming up
Warming up
Warming up
Performing Zone Sizing Simulation
...for Sizing Period: #2 CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB
Calculating System sizing
...for Sizing Period: #1 CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB
Calculating System sizing
...for Sizing Period: #2 CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB
Adjusting Air System Sizing
Adjusting Standard 62.1 Ventilation Sizing
Initializing Simulation
Reporting Surfaces
Beginning Primary Simulation
Initializing New Environment Parameters
Warming up {1}
Warming up {2}
Warming up {3}
Warming up {4}
Warming up {5}
Warming up {6}
Starting Simulation at 01/21 for CHICAGO_IL_USA ANNUAL HEATING 99% DESIGN CONDITIONS DB
Initializing New Environment Parameters
Warming up {1}
Warming up {2}
Warming up {3}
Warming up {4}
Warming up {5}
Warming up {6}
Starting Simulation at 07/21 for CHICAGO_IL_USA ANNUAL COOLING 1% DESIGN CONDITIONS DB/MCWB
Writing tabular output file results using HTML format.
EnergyPlus Run Time=00hr 00min  0.50sec
EnergyPlus Completed Successfully.

@Myoldmopar Myoldmopar added the Refactoring Includes code changes that don't change the functionality of the program, just perform refactoring label Mar 30, 2021
@Myoldmopar Myoldmopar added this to the EnergyPlus 9.5.0 milestone Mar 30, 2021
@Myoldmopar
Copy link
Member Author

Alright, this is going in. Just for fun I pulled the RC1 tag which is based on this branch and linked my multithreaded application to it. It worked every single time without any cross talk between the threads. This is a very exciting step. Thanks to all who contributed to this, and thanks to all of those who had patience while this happened. As soon as the release is out the door, it's time to get build time under control again.

@Myoldmopar Myoldmopar merged commit c38a032 into develop Mar 30, 2021
@Myoldmopar Myoldmopar deleted the FinalGroundingAndDeglobalizing branch March 30, 2021 15:01
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.

6 participants