Product specifications

Table Of Contents
5–Using QLogic MPI
Getting Started with MPI
IB6054601-00 H 5-3
A
Getting Started with MPI
This section shows how to compile and run some simple example programs that
are included in the InfiniPath software product. Compiling and running these
examples enables you to verify that QLogic MPI and its components have been
properly installed on the cluster. See “QLogic MPI Troubleshooting” on page D-12
if you have problems compiling or running these examples.
These examples assume that your cluster’s policy allows you to use the mpirun
script directly, without having to submit the job to a batch queuing system.
Copy Examples
Start by copying the examples to your working directory:
$ cp /usr/share/mpich/examples/basic/* .
Create the mpihosts File
Next, create an MPI hosts file in the same working directory. It contains the host
names of the nodes in your cluster on which you want to run the examples, with
one host name per line. Name this file mpihosts. The contents can be in the
following format:
hostname1
hostname2
...
More details on the mpihosts file can be found in “mpihosts File Details” on
page 5-14.
Compile and Run an Example C Program
In this step you will compile and run your MPI program.
QLogic MPI uses some shell scripts to find the appropriate include files and
libraries for each supported language. Use the script mpicc to compile an MPI
program in C and the script mpirun to execute the file.
The supplied example program cpi.c computes an approximation to pi. First,
compile it to an executable named cpi. For example:
$ mpicc -o cpi cpi.c
By default, mpicc runs the GNU gcc compiler, and is used for both compiling and
linking, the same function as the
gcc command.
NOTE:
For information on using other compilers, see “To Use Another Compiler” on
page 5-8.