QuickStart R

R is a programming language and free software environment for statistical computing and graphics supported by the R Foundation for Statistical Computing. The R language is widely used among statisticians and data miners for developing statistical software and data analysis.

  • In top menu bar access (globe icon).

    Be sure vpn-groups selected when you connect.

  • $ ssh your_netid@hpc.kennesaw.edu
  • $ module load R
  • #R code that demonstrates the use of Rmpi
    #Define a function that takes the loop iteration number and outputs a message containing
    # the iteration number, the MPI rank, the hostname, and the number of cores on the host

    hello.world <- function(i) {
    library(parallel)
    sprintf('Hello from loop iteration %d running on rank %d on node %s which has %d cores',
    i, mpi.comm.rank(), Sys.info()[c("nodename")], detectCores());

    }

    #Use the parallel libraries
    library(Rmpi)
    library(parallel)
    library(snow)

    # R is called with mpirun -n 1 which defines the master processes
    # and then R master process spans worker processes up to the amount of cores
    cl <- makeCluster( (mpi.universe.size()-1) , type='MPI' )

    output.lines <- clusterºÚÁÏÍø( cl=cl, x=(1:500), fun=hello.world )
    cat(unlist(output.lines), sep='\n')
    stopCluster(cl)
    mpi.exit()

  • #!/bin/bash
    #PBS -l nodes=1:ppn=1
    #PBS -l walltime=10:00:00
    #PBS -m abe
    #PBS -M your_email@kennesaw.edu  

    module load R

    module load openmpi-gcc/openmpi1.8.4-gcc4.8.2

    mpirun -n 1 R CMD BATCH --vanilla  ./hello.R

    exit 0

  • $ qsub python_submission.pbs
  • $ exit
  • Visit .