WMPI 1.5 Beta

Home
WMPI New Features
Files Included in Release
Compiling a program with WMPI
Running a WMPI program
    The Cluster Configuration
    The Process Group File
    Environment Variables
TCP Device
Shared Memory Device
Examples
   PI Calculation
    MultiPingPong
    Mandelbrot Calculation
License Agreement
Acknowledgments
WMPI Home Page

 
PI Calculation Example

This is a very simple and well-known WMPI example. It is used to test the basic functions of MPI.

Objective
Calculates the value of PI using numerical integration. The user may choose the accuracy of the value using a command line argument.

Files
 
Location/Files Description
Examples\PI Calc\pi_calc.c Example code file
Examples\PI Calc\PI Calc.dsp VC++ project file
Examples\PI Calc\Release\pi_calc.exe Release linked executable
Examples\PI Calc\Release\pi_calc.pg Process Group file prototype

Notice that to execute this example you have to generate a Cluster Configuration file and a Process Group file.

How to Run
The executable requires no parameters. The process started by the user (the Big Master) asks for the number of intervals that the user wants. The bigger the number, the more accurate the value of PI. Although the accuracy is system limited, the variable that holds the value is a double

After executing the calculation a set of time statistics is presented.

Code Comments
A very simple Master/Worker implementation to calculate the PI value using numerical integration.


 
© University of Coimbra
Last review 1999/12