Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-MPI User's Guide

Appendix A Example applications

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

This appendix provides example applications that supplement the conceptual information throughout the rest of this book about MPI in general and HP-MPI in particular. Table A-1 “Example applications shipped with HP-MPI” summarizes the examples in this appendix. The example codes are also included in the $MPI_ROOT/help subdirectory in your HP-MPI product.

Table A-1 Example applications shipped with HP-MPI

NameLanguageDescription-np argument
“send_receive.f”Fortran 77Illustrates a simple send and receive operation.-np >= 2
“ping_pong.c”CMeasures the time it takes to send and receive data between two processes.-np = 2

ping_pong_ring.c

CConfirms that an app can run using the desired interconnect-np >= 2
“compute_pi.f”Fortran 77Computes pi by integrating
f(x)=4/(1+x2).
-np >= 1
“master_worker.f90”Fortran 90Distributes sections of an array and does computation on all sections in parallel. -np >= 2
“cart.C”C++Generates a virtual topology.-np = 4
“communicator.c”CCopies the default communicator MPI_COMM_WORLD.-np = 2
“multi_par.f”Fortran 77Uses the alternating direction iterative (ADI) method on a
2-dimensional compute region.
-np >= 1
“io.c”CWrites data for each process to a separate file called iodatax, where x represents each process rank in turn. Then, the data in iodatax is read back.-np >= 1
“thread_safe.c”CTracks the number of client requests handled and prints a log of the requests to stdout. -np >= 2
“sort.C”C++Generates an array of random integers and sorts it.-np >= 1
“compute_pi_spawn.f”Fortran 77A single initial rank spawns 3 new ranks that all perform the same computation as in compute_pi.f-np >= 1

ping_pong_clustertest.c

C

Identifies slower than average links in your high-speed interconnect

-np >2

hello_world.c

C

Prints host name and rank

-np >=1

 

These examples and the Makefile are located in the $MPI_ROOT/help subdirectory. The examples are presented for illustration purposes only. They may not necessarily represent the most efficient way to solve a given problem.

To build and run the examples follow the following procedure:

  1. Change to a writable directory.

  2. Copy all files from the help directory to the current writable directory:

    % cp $MPI_ROOT/help/* .

  3. Compile all the examples or a single example.

    To compile and run all the examples in the /help directory, at your prompt enter:

    % make

    To compile and run the thread_safe.c program only, at your prompt enter:

    % make thread_safe

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1979-2007 Hewlett-Packard Development Company, L.P.