[mpich-discuss] Redirection and Pipes
Diego Fernández Slezak
dfslezak at gmail.com
Fri Aug 20 09:30:44 CDT 2010
Hello,
I have a working code that redirects stdout to a pipe, runs some code and
then process the stdout (through the pipe):
/// Connect STDOUT to pipe
// Save old stdout.
saved_stdout = dup(STDOUT_FILENO); // save stdout for display later
// create pipe
if( pipe(out_pipe) != 0 ) { // make a pipe
exit(1);
}
// connect stdout to pipe.
dup2(out_pipe[1], STDOUT_FILENO); // redirect stdout to the pipe
...
...
//at some point:
int read_bytes = read(out_pipe[0], buffer, MAX_LEN); // read from pipe into
buffer
...
...
dup2(saved_stdout, STDOUT_FILENO); // reconnect stdout for testing
Now, if I try to run exactly the same code in MPI environment, the "read"
function only retrieves part of the message.
I think this could be because of some MPI redefinition of pipe buffer sizes
or similar.
Any ideas?
Thanks
Diego
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20100820/34f7e181/attachment.htm>
More information about the mpich-discuss
mailing list