Learn R Programming

pbdDEMO (version 0.1-0)

mpi.demo: MPI Demonstration

Description

These functions are examples of simple statistics via MPI calls.

Usage

mpi.stat(x.spmd)
  mpi.bin(x.spmd, breaks = pi/3 * (-3:3))
  mpi.quantile(x.spmd, prob = 0.5)
  mpi.ols(y.spmd, X.spmd)

Arguments

x.spmd
a SPMD vector.
breaks
a set to break data in groups.
prob
a desired probability for quantile.
y.spmd
a SPMD vector.
X.spmd
a SPMD matrix.

Value

  • mpi.stat returns sample mean and sample variance.

    mpi.bin returns binning counts for the given breaks.

    mpi.quantile returns a quantile.

    mpi.ols returns ordinary least square estimates (beta_hat).

Details

x.spmd and y.spmd are vectors with length N.spmd. X.spmd is a matrix with dimension N.spmd * p and exists on all processors. N.spmd may be vary across processors.

For demonstration purpose, these objects should not contains weird values such NA.

References

Programming with Big Data in R Website: http://r-pbd.org/

Examples

Run this code
### Under command mode, run the demo with 4 processors by
### (Use Rscript.exe for windows system)
mpiexec -np 4 Rscript -e "demo(sample_stat,'pbdDEMO',ask=F,echo=F)"
mpiexec -np 4 Rscript -e "demo(binning,'pbdDEMO',ask=F,echo=F)"
mpiexec -np 4 Rscript -e "demo(quantile,'pbdDEMO',ask=F,echo=F)"
mpiexec -np 4 Rscript -e "demo(ols,'pbdDEMO',ask=F,echo=F)"
mpiexec -np 4 Rscript -e "demo(spmd2dmat,'pbdDEMO',ask=F,echo=F)"
mpiexec -np 4 Rscript -e "demo(balance,'pbdDEMO',ask=F,echo=F)"

Run the code above in your browser using DataLab