Product specifications

Table Of Contents
5–Using QLogic MPI
Getting Started with MPI
5-4 IB6054601-00 H
S
Then, run the program with several different specifications for the number of
processes:
$ mpirun -np 2 -m mpihosts ./cpi
Process 0 on hostname1
Process 1 on hostname2
pi is approximately 3.1416009869231241,
Error is 0.0000083333333309
wall clock time = 0.000149
In this example, ./cpi designates the executable of the example program in the
working directory. The -np parameter to mpirun defines the number of
processes to be used in the parallel computation. Here is an example with four
processes, using the same two hosts in the mpihosts file:
$ mpirun -np 4 -m mpihosts ./cpi
Process 3 on hostname1
Process 0 on hostname2
Process 2 on hostname2
Process 1 on hostname1
pi is approximately 3.1416009869231249,
Error is 0.0000083333333318
wall clock time = 0.000603
Generally, mpirun tries to distribute the specified number of processes evenly
among the nodes listed in the mpihosts file. However, if the number of
processes exceeds the number of nodes listed in the mpihosts file, then some
nodes will be assigned more than one instance of the program.
When you run the program several times with the same value of the -np
parameter, the output lines may display in different orders. This is because they
are issued by independent asynchronous processes, so their order is
non-deterministic.
Details on other ways of specifying the mpihosts file are provided in “mpihosts
File Details” on page 5-14.
More information on the mpirun options are in “Using mpirun” on page 5-15 and
“mpirun Options Summary” on page A-1. “Process Allocation” on page 5-10
explains how processes are allocated by using hardware and software contexts.
Examples Using Other Programming Languages
This section gives similar examples for computing pi for Fortran 77 and
Fortran 90. Fortran 95 usage is similar to Fortran 90. The C++ example uses the
traditional “Hello, World” program. All programs are located in the same directory.