[ET Trac] [Einstein Toolkit] #1548: stdout redirection in multithreading scenario
Einstein Toolkit
trac-noreply at einsteintoolkit.org
Thu May 22 13:53:29 CDT 2014
#1548: stdout redirection in multithreading scenario
----------------------------------+-----------------------------------------
Reporter: gzheng@… | Owner:
Type: defect | Status: reopened
Priority: major | Milestone:
Component: Cactus | Version: development version
Resolution: | Keywords: stdout redirection
----------------------------------+-----------------------------------------
Comment (by rhaas):
After Gengbing's talk today and studying #1618, would it be possible to do
something as simple as this:
{{{
static AMPI_TLS FILE *CCTK_stdout = NULL;
...
CCTKi_CommandLineFinished(...)
{
...
if(CCTK_MyProc(cctkGH) != 0) {
CCTK_stdout = fopen("CCTK_ProcX.out");
} else {
// or just = stdout since we never close the file handle anyway
CCTK_stdout = freopen(stdout);
}
...
}
}}}
?
We would then use CCTK_stdout in CCTK_VWarn etc. We'd still keep the
{{{dup()}}} code around for the benefit of Fortran code that does
{{{write(*,*)}}} etc. and requires redirecting the OS level file
descriptors (which may need some code to protect against multiple AMPI
ranks trying to redirect the same file descriptor). Such Fortran code
would not be compatible with AMPI (not much we can do about this I think
unless we want to change the file descriptors each time the thread
changes).
This would make this ticket a sub-ticket of #1618 (supporting AMPI).
--
Ticket URL: <https://trac.einsteintoolkit.org/ticket/1548#comment:4>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit
More information about the Trac
mailing list