LLNL/Umpire

ability shut down umpire's I/O cleanly

evaleev opened this issue · 3 comments

Is your feature request related to a problem? Please describe.

umpire::initialize_io grabs std::cerr's rdbuf and flushes it when at the end of lifetime of the corresponding static object (s_error_buffer). This assumes that the buffer is still around. In our app we reset std::cerr's rdbuf. Unfortunately there is no way to access s_error_buffer.

Describe the solution you'd like

Ideally there should be a way to control the lifetime of ResourceManager. Or there should be a finalize_io function that can be called by the user.

Describe alternatives you've considered

Not messing with std::cerr's buffer ... but I don't see anything in the standard forbidding this.

Additional context

n/a.

Hey @evaleev - thanks for reporting this. I believe it's actually an error in what we implemented. The log and 'replay' output streams are correctly set to a specific file, e.g. https://github.com/LLNL/Umpire/blob/develop/src/umpire/util/io.cpp#L139

The intent was to do the same for errors, but it looks like we didn't ever implement that!

Would that solution be okay for you?

@davidbeckingsale yes, sure, if Umpire uses (and most importantly, manages the lifetime of) its own streambufs correctly that will solve this issue for us. Thanks!

gentle bump @davidbeckingsale :)