Difference between revisions of "R and Rmpi"
m |
|||
Line 7: | Line 7: | ||
=== Latest Version === | === Latest Version === | ||
*R: 3. | *R: 3.6.1 | ||
=== Installed Packages === | === Installed Packages === | ||
Line 42: | Line 42: | ||
Copy this file to /path/to/job/directory/.Rprofile to allow Rmpi jobs to work, e.g.: | Copy this file to /path/to/job/directory/.Rprofile to allow Rmpi jobs to work, e.g.: | ||
<pre style="white-space:pre-wrap; width:50%; border:1px solid lightgrey; background:#000000; color:white;">cp /apps/R/3. | <pre style="white-space:pre-wrap; width:50%; border:1px solid lightgrey; background:#000000; color:white;">cp /apps/R/3.6.1_el7_gcc/share/Rprofile $WORK/rmpi_test/.Rprofile</pre> | ||
=== Using Rstudio === | === Using Rstudio === | ||
Line 65: | Line 65: | ||
*The script below (for testing, name it “r-test.sh”) can be copied into your job directory (the folder with your input files) and modified so that you can submit batch processes to the queue. | *The script below (for testing, name it “r-test.sh”) can be copied into your job directory (the folder with your input files) and modified so that you can submit batch processes to the queue. | ||
*'''Note: Rmpi is not available in all versions of R on CIRCE, but is compiled with R versions 3.1.2, 3.4.2 and 3. | *'''Note: Rmpi is not available in all versions of R on CIRCE, but is compiled with R versions 3.1.2, 3.4.2, 3.5.0, and 3.6.0 (among others). | ||
''' | ''' | ||
<pre style="white-space:pre-wrap; width:45%; border:1px solid lightgrey; background:#E0E0E0; color:black;"> | <pre style="white-space:pre-wrap; width:45%; border:1px solid lightgrey; background:#E0E0E0; color:black;"> | ||
Line 79: | Line 79: | ||
module purge | module purge | ||
module add apps/R/3. | module add apps/R/3.6.1_el7_gcc | ||
mpirun Rmpi r-test.R</pre> | mpirun Rmpi r-test.R</pre> | ||
Line 101: | Line 101: | ||
**http://cran.r-project.org/web/packages/ | **http://cran.r-project.org/web/packages/ | ||
*Rmpi Examples | *Rmpi Examples | ||
**/apps/R/3. | **/apps/R/3.6.1_el7_gcc/share/Rmpitest.R | ||
**/apps/R/3. | **/apps/R/3.6.1_el7_gcc/share/Rmpitest2.R | ||
{{AppStandardFooter}} | {{AppStandardFooter}} |
Revision as of 18:34, 14 October 2020
Description
From the R Project Home Page: R is a free software environment for statistical computing and graphics. R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, …) and graphical techniques, and is highly extensible.
Rmpi is a package that provides MPI bindings for the R programming language. In much the same way parallel code is written in other languages such as C or Fortran, R codes can run in parallel across multiple processors or nodes.
Latest Version
- R: 3.6.1
Installed Packages
Installed packages (with version numbers) can be listed using the commands below after loading the appropriate module file.
- show library locations ###Note: this command is proceeded by a dot '.'
- .libPaths()
- list all packages installed
- library()
- list packages currently loaded
- search()
Authorized Users
CIRCE
account holdersRRA
account holdersSC
account holders
Platforms
CIRCE
clusterRRA
clusterSC
cluster
Modules
Multiple versions of R are available for use on the cluster. Modules are used to load a specific version into your profile. To see which versions of R are available, use the command:
- module avail apps/R
For Rstudio, use the following module.
- apps/rstudio/0.98
- See Modules for more information.
Running R and Rmpi on CIRCE/SC
The R and Rmpi user guide is essential to understanding the application and making the most of it. The guide and this page should help you to get started with your simulations. Please refer to the Documentation section for a link to the guide.
- Note on CIRCE: Make sure to run your jobs from your $WORK directory!
- Note: Scripts are provided as examples only. Your SLURM executables, tools, and options may vary from the example below. For help on submitting jobs to the queue, see our SLURM User’s Guide.
Prepare your R Environment
Copy this file to /path/to/job/directory/.Rprofile to allow Rmpi jobs to work, e.g.:
cp /apps/R/3.6.1_el7_gcc/share/Rprofile $WORK/rmpi_test/.Rprofile
Using Rstudio
In order to use Rstudio, you will need to start a SLURM Interactive session. Follow the below example in order to get an srun session with X11 capabilities. Currently, Rstudio 0.98.1103 with R 3.1.2 is available for use on the cluster.
[user@itn0 ~]$ echo $DISPLAY itn1.rc.usf.edu:121.0 [user@itn0 ~]$ srun --time=24:00:00 --mem=16384 --nodes=1 --ntasks-per-node=8 --pty /bin/bash [user@svc-3024-9-24 ~]$ export DISPLAY=itn1:121.0 [user@svc-3024-9-24 ~]$ module load apps/rstudio/0.98 [user@svc-3024-9-24 ~]$ rstudio
This will get start a session with 8 cpu cores on a single node with 16 GB of shared memory for 24 hours, and allow you to use the Rstudio interface.
Submitting a Job
A sample submit script is listed below. If, for example, you have an R input file named r-test.R, you would set up a submit script like this:
- The script below (for testing, name it “r-test.sh”) can be copied into your job directory (the folder with your input files) and modified so that you can submit batch processes to the queue.
- Note: Rmpi is not available in all versions of R on CIRCE, but is compiled with R versions 3.1.2, 3.4.2, 3.5.0, and 3.6.0 (among others).
#!/bin/bash # #SBATCH --comment=r-test #SBATCH --ntasks=4 #SBATCH --job-name=r-test #SBATCH --output=output.%j.r-test #SBATCH --time=01:00:00 #### SLURM 4 processor R test to run for 1 hour. module purge module add apps/R/3.6.1_el7_gcc mpirun Rmpi r-test.R
Next, you can change to your job’s directory, and run the sbatch command to submit the job:
[user@login0 ~]$ cd my/jobdir [user@login0 jobdir]$ sbatch ./r-test.sh
- You can view the status of your job with the “squeue -u <username>” command
Documentation
Home Page, User Guides, and Manuals
- R Project Home Page:
- R Project Documentation:
Benchmarks, Known Tests, Examples, Tutorials, and Other Resources
- CRAN Package Repository:
- Rmpi Examples
- /apps/R/3.6.1_el7_gcc/share/Rmpitest.R
- /apps/R/3.6.1_el7_gcc/share/Rmpitest2.R
More Job Information
See the following for more detailed job submission information:
Reporting Bugs
Report bugs with R and Rmpi to the IT Help Desk: rc-help@usf.edu