[MPICH2-dev] MPIEXEC, MPICH2 and getchar

William Gropp gropp at mcs.anl.gov
Fri Feb 1 10:12:44 CST 2008


This is off the top of my head, but there are C routines to change  
the local buffering behavior.  It will also depend on which process  
manager you are using.  The gforker mpiexec has command line options  
and environment variables that control the I/O mode (though it looks  
like only stderr and stdout are currently set).  Which process  
manager are you using?

Bill

On Feb 1, 2008, at 2:31 AM, Ilkka Karasalo wrote:

> I recently switched to MPICH2 after using MPICH
> for more than a decade. When running in interactive
> mode, my programs use the C functions getchar and
> putchar for character-per-character reading of
> keystrokes and writing characters to the display (standard
> output). This functionality is quite useful, enabling control
> of the interpretation of keystrokes, in particular keys
> generating escape sequences (such as e.g. the arrow keys).
>
> In programs started with MPIEXEC,  however, the functionality
> of getchar is lost.  Under MPIEXEC characters and character sequences
> generated keystrokes are read, written one-by-one to the display,  
> and put into
> a buffer. The buffer is sent to the input stream of my programs  
> getchar calls
> only at a keystroke (like the enter key) generating an end-of-line  
> character.
>
> Thus, e.g., an arrow key results in the chacters of the generated
> escape sequence being written to the display, instead of being
> sent to the input stream of 'getchar'.  This is, of course, quite  
> annoying
> and destroys the intended interpretation of keystrokes.
>
> Any help with a work-around for this feature of MPIEXEC would be most
> welcome.
>
> Sincerely,
> Ilkka Karasalo
>
> -- 
>
> Ilkka Karasalo
>
> FOI, Systems Technology         KTH, MWL
> Gullfossgatan 6                 Teknikringen 8
> SE-164 90 Stockholm             SE-100 44 Stockholm
> Phone: +46-8-55503627           Phone: +46-8-7908017
> Fax:   +46-8-55503869           Fax:   +46-8-7906122
> Email: ilkka.karasalo at foi.se    Email: ilkkak at kth.se
>

William Gropp
Paul and Cynthia Saylor Professor of Computer Science
University of Illinois Urbana-Champaign


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mcs.anl.gov/mailman/private/mpich2-dev/attachments/20080201/6bc39484/attachment.htm>


More information about the mpich2-dev mailing list