Mospipe

From MosixWiki
Jump to: navigation, search
MOSPIPE(M1)                     MOSIX Commands                   MOSPIPE(M1)
 
NAME
    MOSPIPE - Run pipelined jobs efficiently using Direct Communication
 
SYNOPSIS
    mospipe [mosrun-options1] {program1+args1} [-e] [mosrun-options2]
            {program2+args2} [[-e] [mosrun-options3] {program3+args3}]...
 
            Mosrun options:
                  [-h|-a.b.c.d|-r{hostname}|-{nodenumber}] [-L|-l] [-F]
                  [-G[{n}]] [-m{mb}]
  
DESCRIPTION
    Mospipe runs two or more pipelined programs just as a shell would run:
 
        program1 [args1] | program2 [args2] [| program3 [args3]] ...
 
    except that instead of pipes, the connection between the programs uses
    the MOSIX feature of direct_communication(7) that makes the transfer of
    data between migrated programs much more efficient.
 
    Each program argument includes the program's space-separated arguments:
    if you want to have a space (or tab, carriage-return or end-of-line) as
    part of a program-name or argument, use the backslash(\) character to
    quote it ('\' can quote any character, including itself).
 
    Each program may optionally be preceded by certain mosrun(1) arguments
    that control (see mosrun(1) for further details):
 
        -h|-a.b.c.d|-r{hostname}|-{nodenumber}
                On which node should the program start.
        -F      Whether to run even when the designated node is down.
        -L|-l   Whether the program should be allowed to automatically
                migrate or not.
        -G{n}   The class of the program.
        -m{mb}  The amount of memory that the program requires.
 
    The -e (or -E) argument between programs indicates that as well as the
    standard-output, the standard-error of the preceding program should also
    be sent to the standard-input of the following program.
 
    If mospipe is not already running under mosrun(1), then in order to
    enable direct communication it places itself under mosrun(1).  In that
    case it also turns on the -e flag of mosrun(1) for the programs it runs.
 
APPLICABILITY
    Mospipe is intended to connect simple utilities and applications that
    read from their standard-input and write to their standard-output (and
    standard-error).
 
    mospipe sets the MOSIX direct_communication(7) to resemble pipes, so
    applications that expect to have pipes or sockets as their standard-
    input/output/error and specifically applications that only use the
    stdio(3) library to access those, should rarely have a problem running
    under mospipe.
 
    However, direct_communication(7) and pipes are not exactly the same, so
    sophisticated applications that attempt to perform complex operations on
    file-descriptors 0, 1 and 2 (such as lseek(2), readv(2), writev(2),
    fcntl(2), ioctl(2), select(2), poll(2), dup(2), dup2(2), fstat(2) etc.)
    are likely to fail.  This regrettably includes the tcsh(1) shell.
 
    The following anomalies should also be noted:
    *  mosrun(1) and native (See mosrun(1)) cannot run under mospipe:
       attempts to run them will produce a "Too many open files" error.
    *  An attempt to write 0 bytes to the standard-output/error will create
       an End-Of-File condition for the next program.
    *  Input cannot be read by child-processes of the receiver (open direct-
       communication connections are not inheritable).
    *  Direct_Communication(7) should not be used by the applications (or at
       least extreme caution must be used) since direct communication is
       already being used by mospipe to emulate the pipe(s).
 
EXAMPLES
    mospipe "echo hello world" wc
          is like the shell-command:
    echo hello world | wc
          and will produce:
          1       2      12
 
 
    mospipe "ls /no-such-file" -e "tr [a-z\ ] [A-Z+]"
          is like the shell-command:
    ls /no-such-file |& tr '[a-z ]' '[A-Z+]'
          and will produce:
          LS:+/NO-SUCH-FILE:+NO+SUCH+FILE+OR+DIRECTORY
 
 
    b=`bestnode`
    mospipe "echo hello world" -$b -L bzip2 -$b -L bzcat "tr [a-z] [A-Z]"
          is like the shell-command:
    echo hello world | bzip | bzcat | tr '[a-z]' '[A-Z]'
 
          It will cause both compression (bzip) and decompression (lzop -d)
          to run and stay on the same and best node for maximum efficiency,
          and will produce:
 
          HELLO WORLD
 
SEE ALSO
    direct_communication(7), mosrun(1), mosix(7).
 
MOSIX                              July 2007                            MOSIX