-
Notifications
You must be signed in to change notification settings - Fork 448
Automatically flush eplusout.err if running in DEBUG mode or if env var DeveloperFlag=TRUE is passed #11174
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
base: develop
Are you sure you want to change the base?
Conversation
#ifndef NDEBUG | ||
// Debug build: unbuffer it, flushes automatically on each output | ||
state.files.err_stream->setf(std::ios::unitbuf); | ||
#else | ||
// In release builds, only unbuffer if in developer mode | ||
if (state.dataSysVars->DeveloperFlag) { | ||
state.files.err_stream->setf(std::ios::unitbuf); | ||
} | ||
#endif |
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
|
||
Setting to ``yes'' (internal default is ``no'') causes the program to display some different information that could be useful to developers. In particular, this will cause the Warmup Convergence output to show the last day for each zone, each timestep. There is no Output:Diagnostics equivalent. | ||
|
||
It will also enable the automatic flushing of `eplusout.err` in Release mode (in Debug, this is enabled by default), so you can see the output the output while the program is running, and it will capture the content up to a segfault if any. |
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.
And document it
This is perfectly fine as it is, although I will say I wouldn't mind it just always being flushed. I appreciate your hesitation to make that change, @jmarrec , but I will ask the audience -- is there anyone who actually feels strongly that we should hold off writing to the err file? The ability to debug user issues without having to do special arrangements seems to be worth the milliseconds of writing time alone. |
@Myoldmopar Given our history of disk thrashing, I'd be against unbuffering the err file by default unless it can be shown (or someone does some testing to show) that it doesn't have an impact in areas where disk I/O was an issue (e.g., HPC). |
I don't have an opinion other than wanting to see more information. If there is a crash there will be missing information. I typically see blank err files. |
I'm going to modify this PR slightly. I am going to add a new environment variable that specifically handles ERR file flushing without affecting all the other developer flag stuff. Now the question is, what do we default? My gut says that the typical user wants the error file emitted right away. They do not like the shock of an empty error file after the shock of a crash. That's a bad look. And then after they ask for support, we tell them they have to re-run it with an environment variable set to see the error just to get info to us. Also, I think pretty much every interface will want this enabled. So if we default to the current behavior, then every interface developer will have to rebuild their tool to add the environment variable when it executes EnergyPlus. I think the primary reason anyone would actually want the current behavior is what @jasondegraw mentioned above. It's a fully valid reason to want it buffered if you are churning out thousands of runs on an HPC cluster. But my gut tells me that in these cases, the person setting up the workflow is much more capable of setting an environment variable than everyone on the range of users of EnergyPlus. My vote would be to turn this new behavior by default, but allow it to go back to previous behavior with the environment variable. I would name it something like |
…ar DeveloperFlag=TRUE is passed
1b1eac5
to
bf84d65
Compare
@jmarrec @Myoldmopar it has been 28 days since this pull request was last updated. |
Pull request overview
Description of the purpose of this PR
Regarding eplusout.err, I often want to see the content up to a segfault: if segfaulting, the final flush is never happening. Or just see the content while the simulation is running (slowly, in Debug).
I'd like to make it so that at least when building in Debug mode, the
err_stream
flushes on each write.I'd personally argue that in 99.5% of cases, the amount of IO happening in
eplusout.err
is minimal and it wouldn't hurt to do it even in Release mode. Users could actually report the content up to a segfault when opening an issue, which would be useful for us. But it's not necessarily a battle I want to fight, so I took an alternative approach of doing it in Release Mode only if environment variableDeveloperFlag=TRUE
.Pull Request Author
Reviewer