Navigation

Operators and Keywords

Function List:

C++ API

Function File: [result] = Pi ()

Classical MPI example that computes PI by integrating arctan'(x) in [0,1]. N [1e7] #subdivisions of the [0, 1] interval. mod ['s'] communication modality: (s)end (r)educe. results struct contains

  • pi: estimated pi value
  • err: error
  • time: from argument xmit to pi computed

To run this example, set the variables HOSTFILE and NUMBER_OF_MPI_NODES to appropriate values, then type the following command in your shell:

          mpirun --hostfile $HOSTFILE -np $NUMBER_OF_MPI_NODES octave --eval 'pkg load mpi; Pi ()'

Demonstration 1

The following code

 system ("mpirun --hostfile $HOSTFILE -np $NUMBER_OF_MPI_NODES octave -q --eval 'pkg load mpi; Pi ()'");

gives an example of how 'Pi' is used.

Package: mpi