|
Packit |
0848f5 |
Example MPI programs
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
This directory contains some example MPI programs. They are described below.
|
|
Packit |
0848f5 |
Examples of MPI programs in Fortran 77, Fortran 90, and C++ are found in the
|
|
Packit |
0848f5 |
directories f77, f90, and cxx respectively.
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
cpi - A simple program to compute pi
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
Optional programs
|
|
Packit |
0848f5 |
These programs are not built by default, but may be built and run
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
hellow - A simple "hello world" program
|
|
Packit |
0848f5 |
icpi - An interactive version of cpi
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
parent and child - A simple example of using MPI_Comm_spawn
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
pmandel* - Programs to solve the Mandelbrot set
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
Running the pmandel* programs
|
|
Packit |
0848f5 |
-----------------------------
|
|
Packit |
0848f5 |
The programs pmandel* solve the Mandelbrot set. The input to the program
|
|
Packit |
0848f5 |
are the coordinates, scale etc for plotting the output of the program and the
|
|
Packit |
0848f5 |
number of iterations to solve the set. The output is an image file (default is
|
|
Packit |
0848f5 |
pmandel.ppm) of the Portable Pixel Map format. Help on using the program can
|
|
Packit |
0848f5 |
be obtained by running the executable with "-help" parameter.
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
To run the pmandel* tests you can either run it in the interactive mode (-i option)
|
|
Packit |
0848f5 |
or run it in a non-interactive mode. In the interactive mode the output of the
|
|
Packit |
0848f5 |
program is saved as an image file (you can specify the name of the file using -out
|
|
Packit |
0848f5 |
option of the program). In the non-interactive mode you need a visualizer for the
|
|
Packit |
0848f5 |
output (A Visualizer is available in Windows. Compile the project pman_vis for the
|
|
Packit |
0848f5 |
visualizer.).
|
|
Packit |
0848f5 |
Non-interactive execution eg --
|
|
Packit |
0848f5 |
mpiexec -n 2 pmandel -i
|
|
Packit |
0848f5 |
(The program prompts for entering the coordinates, scales and no of iterations
|
|
Packit |
0848f5 |
and output is saved in pmandel.ppm file)
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
Interactive execution eg --
|
|
Packit |
0848f5 |
mpiexec -n 2 pmandel
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
(Now open the visualizer program, pman_vis.exe, created by compiling pmandel_vis
|
|
Packit |
0848f5 |
project in windows. Click on File -> Connect and select "TCP Socket Connect".
|
|
Packit |
0848f5 |
Leave the default settings and click connect. The visualizer program connects to
|
|
Packit |
0848f5 |
pmandel program and displays the output)
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
pmandel* programs differ in the MPI functionalities used. For example,
|
|
Packit |
0848f5 |
pmandel_service.c uses MPI_Open_Port() to connect to the visualizer while pmandel.c
|
|
Packit |
0848f5 |
uses the sockets directly for the connection.
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
Others will be documented later.
|
|
Packit |
0848f5 |
|