Use R on Karst at IU

To use R on Karst at Indiana University, first set up your user environment by loading the r module and its prerequisite modules (the cURL multi-protocol file transfer library and the Java Runtime Environment). To make the necessary modules load automatically every time you log into Karst, add the following lines to your ~/.modules file:

  module load curl
  module load java
  module load r

For help with modules, see On the research computing systems at IU, how do I use Modules to manage my software environment?

If your R session requires fewer than 20 minutes, you can load the necessary modules and launch the application from the command line. If your session requires more than 20 minutes, submit a batch job:

  1. Create an R file (e.g., R_input.r) containing the commands R should run.
  2. Create a TORQUE script (e.g., R_job); for example (replace username with your IU username and my_iu_email with your IU email address):
      #!/bin/bash 
      #PBS -l nodes=1:ppn=16
      #PBS -l walltime=01:00:00
      #PBS -m ae
      #PBS -M my_iu_email
      #PBS -N R_job_name
      #PBS -V
    
      cd /N/u/username/Karst/working_directory
    
      module load curl
      module load java
      module load r
    
      R CMD BATCH R_input.r
    

    To use parallel CPUs, add the following command to your execution line to enable MKL threading:

      export MKL_NUM_THREADS="8"
    

    On Karst, you can set up to 16 threads.

  3. To submit your job script (e.g., R_job), on the command prompt, enter qsub R_job . To check the status of your job, enter qstat -u username (replace username with your IU username).

Support for IU research computing systems, software, and services is provided by the Research Technologies division of UITS. To ask a question or get help, contact UITS Research Technologies.

This is document amsh in the Knowledge Base.
Last modified on 2018-01-26 10:35:56.

Contact us

For help or to comment, email the UITS Support Center.