1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
|
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<!--Converted with LaTeX2HTML 96.1-h (September 30, 1996) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds -->
<HTML>
<HEAD>
<TITLE>How to Run an Example Program Using MPI</TITLE>
<META NAME="description" CONTENT="How to Run an Example Program Using MPI">
<META NAME="keywords" CONTENT="slug">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<LINK REL=STYLESHEET HREF="slug.css">
</HEAD>
<BODY LANG="EN" >
<A NAME="tex2html2443" HREF="node27.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="http://www.netlib.org/utk/icons/next_motif.gif"></A> <A NAME="tex2html2441" HREF="node25.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="http://www.netlib.org/utk/icons/up_motif.gif"></A> <A NAME="tex2html2435" HREF="node25.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="http://www.netlib.org/utk/icons/previous_motif.gif"></A> <A NAME="tex2html2445" HREF="node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="http://www.netlib.org/utk/icons/contents_motif.gif"></A> <A NAME="tex2html2446" HREF="node190.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="http://www.netlib.org/utk/icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME="tex2html2444" HREF="node27.html">Source Code for Example </A>
<B>Up:</B> <A NAME="tex2html2442" HREF="node25.html">Getting Started with ScaLAPACK</A>
<B> Previous:</B> <A NAME="tex2html2436" HREF="node25.html">Getting Started with ScaLAPACK</A>
<BR> <P>
<H1><A NAME="SECTION04210000000000000000">How to Run an Example Program Using MPI</A></H1>
<P>
<A NAME="656"> </A>
<P>
This section presents the instructions for installing ScaLAPACK and
running a simple example program in parallel.
The example assumes that the underlying system is a Sun Solaris system;
the problem is run on one physical processor, using
six processes that do message passing.
The example uses MPI as the message-passing layer. The version of
MPI used in this example is MPICH (version 1.0.13), and we assume
the user has this version installed. MPICH<A NAME="657"> </A><A NAME="658"> </A>
is a freely available, portable implementation of MPI.
If MPICH is not installed, refer to <TT>http://www.netlib.org/mpi/</TT>.
If this is run on a different architecture, the user will have to make
a number of changes. In particular, the prebuilt libraries will have
to be changed. If prebuilt libraries do not exist for the specific architecture,
the user will need to download the source <BR>
(<TT>http://www.netlib.org/scalapack/scalapack.tar.gz</TT>) and build
them.
<P>
To use ScaLAPACK for the first time (on a network of workstations using MPI),
one should
<P>
<OL>
<LI> Make a directory for this testing.
<PRE> mkdir SCALAPACK
cd SCALAPACK</PRE>
<LI> Download the ScaLAPACK example program (about 7 KB) into directory SCALAPACK. <BR>
<TT>http://www.netlib.org/scalapack/examples/example1.f</TT>
<LI> Download the prebuilt ScaLAPACK library (about 3MB) for the specific architecture
into directory SCALAPACK (e.g., SUN4SOL2) and uncompress.<BR>
<TT>http://www.netlib.org/scalapack/archives/scalapack_SUN4SOL2.tar.gz</TT>
<PRE> gunzip scalapack_SUN4SOL2.tar.gz
tar xvf scalapack_SUN4SOL2.tar
rm scalapack_SUN4SOL2.tar</PRE>
(Note that this tar file contains the library archive and the
<TT>SLmake.inc</TT> used to build the library. Details of compiler
flags, etc. can be found in this make include file.)
<LI> Download the prebuilt BLACS library (about 60 KB) for the architecture
(e.g., SUN4SOL2) and message-passing layer (e.g., MPICH), and
uncompress into directory SCALAPACK.<BR>
<TT>http://www.netlib.org/blacs/archives/blacs_MPI-SUN4SOL2-0.tar.gz</TT>
<PRE> gunzip blacs_MPI-SUN4SOL2-0.tar.gz
tar xvf blacs_MPI-SUN4SOL2-0.tar
rm blacs_MPI-SUN4SOL2-0.tar</PRE>
(Note that this tar file contains the library archive(s) and the
<TT>Bmake.inc</TT> used to build the library. Details of compiler
flags, etc. can be found in this make include file.)
<LI> Find the optimized BLAS library on the specific architecture.<BR>
<P>
If not available, download reference implementation (about 1 MB)
into directory SCALAPACK/BLAS, compile, and build the library.
<PRE> mkdir BLAS
cd BLAS</PRE>
Download <TT>http://www.netlib.org/blas/blas.shar</TT>.
<PRE> sh blas.shar
f77 -O -f -c *.f
ar cr ../blas_SUN4SOL2.a *.o
cd ..</PRE>
(Note that this reference implementation of the BLAS will not
deliver high performance.)
<LI> Compile and link to prebuilt libraries.
<P>
<PRE> sun4sol2> f77 -f -o example1 example1.f scalapack_SUN4SOL2.a \
blacsF77init_MPI-SUN4SOL2-0.a blacs_MPI-SUN4SOL2-0.a \
blacsF77init_MPI-SUN4SOL2-0.a blas_SUN4SOL2.a \
$MPI_ROOT/lib/solaris/ch_p4/libmpi.a -lnsl -lsocket
example1.f:
MAIN example1:
matinit:</PRE>
Note that the <TT>-lnsl -lsocket</TT> libraries are machine specific
to Solaris. Refer to the <TT>SLmake.inc</TT> for details.
MPICH can be found in the directory $MPI_ROOT.
On our system we did
<PRE> sun4sol2> setenv MPI_ROOT /src/icl/MPI/mpich</PRE>
<LI> Run the ScaLAPACK example program.
<P>
To run an MPI program with MPICH, one will need to add $MPI_ROOT/bin
to the path. On our system we did
<PRE> sun4sol2> set path = ($path $MPI_ROOT/bin)</PRE>
<P>
To run the example:
<PRE> sun4sol2> mpirun -np 6 example1</PRE>
<P>
The example runs on six processes and prints out a statement that
``the solution is correct'' or ``the solution is incorrect''.
</OL><HR><A NAME="tex2html2443" HREF="node27.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="http://www.netlib.org/utk/icons/next_motif.gif"></A> <A NAME="tex2html2441" HREF="node25.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="http://www.netlib.org/utk/icons/up_motif.gif"></A> <A NAME="tex2html2435" HREF="node25.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="http://www.netlib.org/utk/icons/previous_motif.gif"></A> <A NAME="tex2html2445" HREF="node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="http://www.netlib.org/utk/icons/contents_motif.gif"></A> <A NAME="tex2html2446" HREF="node190.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="http://www.netlib.org/utk/icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME="tex2html2444" HREF="node27.html">Source Code for Example </A>
<B>Up:</B> <A NAME="tex2html2442" HREF="node25.html">Getting Started with ScaLAPACK</A>
<B> Previous:</B> <A NAME="tex2html2436" HREF="node25.html">Getting Started with ScaLAPACK</A>
<P><ADDRESS>
<I>Susan Blackford <BR>
Tue May 13 09:21:01 EDT 1997</I>
</ADDRESS>
</BODY>
</HTML>
|