KMR
Macros | Functions
pi.reducer.c File Reference

Example for KMRRUN. More...

#include <stdio.h>
#include <string.h>
#include <stdlib.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 reducer 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.reducer.c.

Function Documentation

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

Main function.

Read a file which has key-values separated by lines. One line is like this.

0 7932/10000

'0' is key and '7932/10000' is value. 7932 is number of points plotted in a circle and 10000 is total number of points plotted. By reading these numbers, it calculates pi and writes result to a file.

Definition at line 41 of file pi.reducer.c.