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.


Use Global Protect VPN: whether on or off-campus

In top menu bar access (globe icon)
Be sure vpn-groups selected when you connect.


Start an SSH session:

$ ssh your_netid@hpc.kennesaw.edu


Load R

$ module load R


Create your script, example hello.R (from NC State)

#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 <- clusterApply( cl=cl, x=(1:500), fun=hello.world )
cat(unlist(output.lines), sep='\n')
stopCluster(cl)
mpi.exit()


Create your python_submission.pbs

#!/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


Submit your script to the scheduler

$ qsub python_submission.pbs


Exit

$ exit


Getting Help with R - https://www.r-project.org/help.html

©