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 hosthello.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.edumodule 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
网红头条 .