old-www/HOWTO/Beowulf-HOWTO/x202.html

226 lines
3.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Run A Program</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="The Beowulf HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Verification"
HREF="x195.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The Beowulf HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x195.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
>&nbsp;</TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="AEN202"
></A
>7. Run A Program</H1
><P
>Once you can do all the tests shown above, you should be able to run
a program. From here on in, the instructions are lam specific.</P
><P
>Go back to the head node, log in as wolf, and enter the following
commands:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>cat &#62; /nnt/wolf/lamhosts
wolf01
wolf02
wolf03
wolf04
&#60;control d&#62;</PRE
></FONT
></TD
></TR
></TABLE
><P
>Go to the lam examples directory, and compile "hello.c":</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>mpicc -o hello hello.c
cp hello /mnt/wolf </PRE
></FONT
></TD
></TR
></TABLE
><P
>Then, as shown in the lam documentation, start up lam:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>[wolf@wolf00 wolf]$ lamboot -v lamhosts
LAM 7.0/MPI 2 C++/ROMIO - Indiana University
n0&#60;2572&#62; ssi:boot:base:linear: booting n0 (wolf00)
n0&#60;2572&#62; ssi:boot:base:linear: booting n1 (wolf01)
n0&#60;2572&#62; ssi:boot:base:linear: booting n2 (wolf02)
n0&#60;2572&#62; ssi:boot:base:linear: booting n3 (wolf04)
n0&#60;2572&#62; ssi:boot:base:linear: finished</PRE
></FONT
></TD
></TR
></TABLE
><P
>So we are now finally ready to run an app. [Remember, I am using
lam; your message passing interface may have different syntax].</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>[wolf@wolf00 wolf]$ mpirun n0-3 /mnt/wolf/hello
Hello, world! I am 0 of 4
Hello, world! I am 3 of 4
Hello, world! I am 2 of 4
Hello, world! I am 1 of 4
[wolf@wolf00 wolf]$</PRE
></FONT
></TD
></TR
></TABLE
><P
>Recall I mentioned the use of NFS above. I am telling the nodes to
all use the nfs shared directory, which will bottleneck when using a
larger number of boxes. You could easily copy the executable to each box,
and in the mpirun command, specify node local directories: mpirun n0-3
/home/wolf/hello. The prerequisite for this is to have all the files
available locally. In fact I have done this, and it worked better than
using the nfs shared executable. Of course this theory breaks down if my
cluster application needs to modify a file shared across the
cluster.</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x195.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>&nbsp;</TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Verification</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>&nbsp;</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>