27.12.2014 Views

QLogic OFED+ Host Software User Guide, Rev. B

QLogic OFED+ Host Software User Guide, Rev. B

QLogic OFED+ Host Software User Guide, Rev. B

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4–Running <strong>QLogic</strong> MPI on <strong>QLogic</strong> Adapters<br />

Getting Started with MPI<br />

Generally, mpirun tries to distribute the specified number of processes evenly<br />

among the nodes listed in the mpihosts file. However, if the number of<br />

processes exceeds the number of nodes listed in the mpihosts file, then some<br />

nodes will be assigned more than one instance of the program.<br />

When you run the program several times with the same value of the -np<br />

parameter, the output lines may display in different orders. This is because they<br />

are issued by independent asynchronous processes, so their order is<br />

non-deterministic.<br />

Details on other ways of specifying the mpihosts file are provided in “mpihosts<br />

File Details” on page 4-15.<br />

More information on the mpirun options are in “Using mpirun” on page 4-16 and<br />

Appendix A mpirun Options Summary. “Process Allocation” on page 4-11<br />

explains how processes are allocated by using hardware and software contexts.<br />

Examples Using Other Programming Languages<br />

This section gives similar examples for computing pi for Fortran 77 and<br />

Fortran 90. Fortran 95 usage is similar to Fortran 90. The C++ example uses the<br />

traditional “Hello, World” program. All programs are located in the same directory.<br />

fpi.f is a Fortran 77 program that computes pi in a way similar to cpi.c.<br />

Compile and link, and run it as follows:<br />

$ mpif77 -o fpi fpi.f<br />

$ mpirun -np 2 -m mpihosts ./fpi<br />

pi3f90.f90 is a Fortran 90 program that does the same computation. Compile<br />

and link, and run it as follows:<br />

$ mpif90 -o pi3f90 pi3f90.f90<br />

$ mpirun -np 2 -m mpihosts ./pi3f90<br />

The C++ program hello++.cc is a parallel processing version of the traditional<br />

“Hello, World” program. Notice that this version makes use of the external C<br />

bindings of the MPI functions if the C++ bindings are not present.<br />

D000046-005 B 4-5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!