[ET Trac] [Einstein Toolkit] #1704: redirect stdout and stderr of all processes if requested (also of the root process)
Einstein Toolkit
trac-noreply at einsteintoolkit.org
Sun Nov 23 06:12:08 CST 2014
#1704: redirect stdout and stderr of all processes if requested (also of the root
process)
--------------------------+-------------------------------------------------
Reporter: knarf | Owner:
Type: enhancement | Status: reopened
Priority: optional | Milestone:
Component: Cactus | Version: development version
Resolution: | Keywords:
--------------------------+-------------------------------------------------
Comment (by knarf):
What I intended was having Cactus write to a file _and_ to the screen.
However, after reading up on the matter a bit more that does not seem
possible, at least not using the mechanism Cactus uses for redirection.
Cactus uses freopen, which essentially changes stdout and/or stderr to
point to a file. There does not seem to be a way to have one input stream
point to two outputs. One would need to write twice. This is problematic
in this case, as I would imagine not everyone uses the CCTK_* wrappers,
especially not for debugging. The current solution redirects, e.g., a
printf too. Even worse - freopen is not (portably) reversible. Once
redirected to a file there is no (portable) way to get it back to stdout.
One option I still see would be to redirect to a file, and having a second
thread (created before MPI_Init, like the web server) constantly printing
the contents of that file (like tail -f). This would not be ideal either
though, because especially for crashes (one of the use-cases of this
feature), users might 'miss' output.
Another possibility would indeed be a new parameter to do the normal
redirection also on the root process, but one would need to know then that
this run will be quite silent in the terminal...
Does anybody have a better idea? Any preferences?
--
Ticket URL: <https://trac.einsteintoolkit.org/ticket/1704#comment:6>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit
More information about the Trac
mailing list