R-Sapelo2: Difference between revisions

From Research Computing Center Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 25: Line 25:
</pre>  
</pre>  
Please note that when you load this R module, many other modules will be loaded as R depends on those other libraries and packages.
Please note that when you load this R module, many other modules will be loaded as R depends on those other libraries and packages.
The R module sets the variable OMP_NUM_THREADS=1. If you are using a function in an R package that is enabled to run with multithreads, please set the OMP_NUM_THREADS variable to a different number (and request the same number of cores for your job). Note that you would need to set this variable ```after``` you load the R module, for it to have effect. You can set OMP_NUM_THREADS to automatically correspond to the number of cores, by setting it to $SLURM_CPUS_PER_TASK (a sample job submission is provided below).


A number of R packages are provided by other module files. For example, many packages that depend on the GDAL library, such as adegenet, pegas, poppr, rgdal, sf, and spdepare, are provided by the rgdal/1.4-8-foss-2019b-R-4.0.0 module, which can be loaded with
A number of R packages are provided by other module files. For example, many packages that depend on the GDAL library, such as adegenet, pegas, poppr, rgdal, sf, and spdepare, are provided by the rgdal/1.4-8-foss-2019b-R-4.0.0 module, which can be loaded with
Line 69: Line 71:




Here is an example of a shell script, sub.sh, to run on the batch queue:  
Here is an example of a shell script, sub.sh, to run a serial R script on the batch queue:
 
<pre class="gscript">
#!/bin/bash<br>
#SBATCH --job-name=testRjob
#SBATCH --partition=batch       
#SBATCH --mail-type=ALL
#SBATCH --mail-user=username@uga.edu 
#SBATCH --ntasks=1
#SBATCH --mem=10gb 
#SBATCH --time=08:00:00 
#SBATCH --output=%x.%j.out
#SBATCH --error=%x.%j.err
cd $SLURM_SUBMIT_DIR
 
module load R/4.0.0-foss-2019b 
 
R CMD BATCH program.R 
</pre>
where program.R is just a sample program name and needs to be replaced by the name of the program you wish to run. The settings in the header lines, such as the job name, the email address, the number of cores, memory and walltime limit, need to be changed appropriately as well.
 
 
Here is an example of a shell script, sub.sh, to run a multithread R script on the batch queue:  


<pre class="gscript">
<pre class="gscript">
Line 78: Line 103:
#SBATCH --mail-user=username@uga.edu   
#SBATCH --mail-user=username@uga.edu   
#SBATCH --ntasks=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=6
#SBATCH --mem=10gb   
#SBATCH --mem=10gb   
#SBATCH --time=08:00:00   
#SBATCH --time=08:00:00   
Line 86: Line 112:


module load R/4.0.0-foss-2019b   
module load R/4.0.0-foss-2019b   
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK


R CMD BATCH program.R   
R CMD BATCH program.R   

Revision as of 10:26, 25 June 2021

Category

Statistics

Program On

Sapelo2

Version

3.5.0, 3.6.2, 4.0.0

Author / Distributor

See http://www.r-project.org/

Description

R is a language and environment for statistical computing and graphics. It provides a wide variety of statistical (linear and nonlinear modeling, classical statistical tests, time-series analysis, classification, clustering, ...) and graphical techniques.

Running Program

Also refer to Running Jobs on Sapelo2


R version 4.0.0

R version 4.0.0 is installed in /apps/eb/R/4.0.0-foss-2019b and add-on packages are installed in /apps/eb/R/4.0.0-foss-2019b/lib64/R/library. You can list all files in this dir to see the packages installed with this version of R.

To use this version of R, please first load the module with

module load R/4.0.0-foss-2019b

Please note that when you load this R module, many other modules will be loaded as R depends on those other libraries and packages.

The R module sets the variable OMP_NUM_THREADS=1. If you are using a function in an R package that is enabled to run with multithreads, please set the OMP_NUM_THREADS variable to a different number (and request the same number of cores for your job). Note that you would need to set this variable ```after``` you load the R module, for it to have effect. You can set OMP_NUM_THREADS to automatically correspond to the number of cores, by setting it to $SLURM_CPUS_PER_TASK (a sample job submission is provided below).

A number of R packages are provided by other module files. For example, many packages that depend on the GDAL library, such as adegenet, pegas, poppr, rgdal, sf, and spdepare, are provided by the rgdal/1.4-8-foss-2019b-R-4.0.0 module, which can be loaded with

module load rgdal/1.4-8-foss-2019b-R-4.0.0

The WGCNA package does not work on the AMD Opteron processors. If using functions in this package, please add a --constraint=EDR option to sbatch to exclude Opteron processors. For batch jobs, you can add the header line:

#SBATCH --constraint=EDR


R version 3.6.2

R version 3.6.2 is installed in /apps/eb/R/3.6.2-foss-2019b and add-on packages are installed in /apps/eb/R/3.6.2-foss-2019b/lib64/R/library. You can list all files in this dir to see the packages installed with this version of R.

To use this version of R, please first load the module with

module load R/3.6.2-foss-2019b

Please note that when you load this R module, many other modules will be loaded as R depends on those other libraries and packages.

A number of R packages are provided by other module files. For example, many packages that depend on the GDAL library are provided by the rgdal/1.4-8-foss-2019b-R-3.6.2 module, which can be loaded with

module load rgdal/1.4-8-foss-2019b-R-3.6.2

For R 3.6.2 some of the Bioconductor packages are installed in a separate R-bundle-Bioconductor/3.10-foss-2019b module, which can be loaded with

module load R-bundle-Bioconductor/3.10-foss-2019b


R version 3.5.0

R version 3.5.0 is installed in /apps/eb/R/3.5.0-foss-2019b and add-on packages are installed in /apps/eb/R/3.5.0-foss-2019b/lib64/R/library. You can list all files in this dir to see the packages installed with this version of R.

To use this version of R, please first load the module with

module load R/3.5.0-foss-2019b

Please note that when you load this R module, many other modules will be loaded as R depends on those other libraries and packages.


Here is an example of a shell script, sub.sh, to run a serial R script on the batch queue:

#!/bin/bash<br>
#SBATCH --job-name=testRjob
#SBATCH --partition=batch        
#SBATCH --mail-type=ALL 
#SBATCH --mail-user=username@uga.edu  
#SBATCH --ntasks=1
#SBATCH --mem=10gb   
#SBATCH --time=08:00:00   
#SBATCH --output=%x.%j.out
#SBATCH --error=%x.%j.err
 
cd $SLURM_SUBMIT_DIR

module load R/4.0.0-foss-2019b   

R CMD BATCH program.R   

where program.R is just a sample program name and needs to be replaced by the name of the program you wish to run. The settings in the header lines, such as the job name, the email address, the number of cores, memory and walltime limit, need to be changed appropriately as well.


Here is an example of a shell script, sub.sh, to run a multithread R script on the batch queue:

#!/bin/bash<br>
#SBATCH --job-name=testRjob
#SBATCH --partition=batch        
#SBATCH --mail-type=ALL 
#SBATCH --mail-user=username@uga.edu  
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=6
#SBATCH --mem=10gb   
#SBATCH --time=08:00:00   
#SBATCH --output=%x.%j.out
#SBATCH --error=%x.%j.err
 
cd $SLURM_SUBMIT_DIR

module load R/4.0.0-foss-2019b   

export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK

R CMD BATCH program.R   

where program.R is just a sample program name and needs to be replaced by the name of the program you wish to run. The settings in the header lines, such as the job name, the email address, the number of cores, memory and walltime limit, need to be changed appropriately as well.


Here is an example of job submission command:

sbatch ./sub.sh 

Documentation

Please see http://www.r-project.org/

Installation

Source code downloaded from https://www.r-project.org/

System

64-bit Linux