Example C: Computing Pi
#include “mpi.h”
#include <math.h>
int main (argc, argv)
int argc; char *argv[];
{
int n, myid, numprocs, i, rc;
double PI25DT = 3.14159265358979323842643;
double mypi, pi, h, sum, x, a;
MPI_Init(&argc, &argv);
MPI_Comm_size (MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank (MPI_COMM_WORLD, &myid);
Previous slide
Next slide
Back to first slide
View graphic version