KMR
Macros | Functions
pi.mapper.c File Reference

Example for KMRRUN. More...

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

Go to the source code of this file.

Macros

#define LINELEN   80
 

Functions

int main (int argc, char *argv[])
 Main function. More...
 

Detailed Description

Example for KMRRUN.

It is a mapper for PI calculation.

How to run.

  1. create input files in a directory. work/ 000 001 002 ...

    Each file have one line which represents number of points to plot. $ cat work/000 100000

  2. run by kmrrun $ mpirun -np 2 ./kmrrun -m "./pi.mapper" \ -k "./pi.kvgen.sh" -r "./pi.reducer" ./work

Definition in file pi.mapper.c.

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Main function.

Read the number of points to plot from the specified input file, plot points randomly, and count the number of points plotted in a circle. The output is written to a file that has a line formatted in "num1/num2" where num1 is number of points plotted in a circle and "num2" is the total points.

Definition at line 40 of file pi.mapper.c.