Trouble with Input and Output


Up: In case of trouble Next: General Previous: HPUX



Up: In case of trouble Next: General Previous: HPUX


General


Up: Trouble with Input and Output Next: IBM SP Previous: Trouble with Input and Output

    1. Q: I want output from printf to appear immediately.

    A: This is really a feature of your C and/or Fortran runtime system. For C, consider


    setbuf( stdout, (char *)0 ); 
    



Up: Trouble with Input and Output Next: IBM SP Previous: Trouble with Input and Output


IBM SP


Up: Trouble with Input and Output Next: Workstation Networks Previous: General

    1. Q: I have code that prompts the user and then reads from standard input. On IBM SPx systems, the prompt does not appear until after the user answers the prompt!

    A: This is a feature of the IBM POE system. There is a POE routine, mpc_flush(1), that you can use to flush the output. Read the man page on this routine; it is synchronizing over the entire job and cannot be used unless all processes in MPI_COMM_WORLD call it. Alternately, you can always end output with the newline character (\\); this will cause the output to be flushed but will also put the user's input on the next line.



Up: Trouble with Input and Output Next: Workstation Networks Previous: General


Workstation Networks


Up: Trouble with Input and Output Next: Upshot and Nupshot Previous: IBM SP

    1. Q: I want standard output (stdout) from each process to go to a different file.

    A: mpich has no built-in way to do this. In fact, it prides itself on gathering the stdouts for you. You can do one of the following:

      1. Use Unix built-in commands for redirecting stdout from inside your program (dup2, etc.). The MPE routine MPE_IO_Stdout_to_file, in mpe/mpe_io.c, shows one way to do this. Note that in Fortran, the approach of using dup2 will work only if the Fortran PRINT writes to stdout. This is common but by no means universal.


      2. Write explicitly to files instead of to stdout (use fprintf instead of printf, etc.). You can create the file name from the process's rank. This is the most portable way.



Up: Trouble with Input and Output Next: Upshot and Nupshot Previous: IBM SP