Learn R Programming

mirai (version 2.6.0)

cluster_config: Cluster Remote Launch Configuration

Description

Generates a remote configuration for launching daemons using an HPC cluster resource manager such as Slurm sbatch, SGE and Torque/PBS qsub or LSF bsub.

Usage

cluster_config(command = "sbatch", options = "", rscript = "Rscript")

Value

A list in the required format to be supplied to the remote argument of daemons() or launch_remote().

Arguments

command

(character) cluster manager executable: "sbatch" (Slurm), "qsub" (SGE/Torque/PBS), or "bsub" (LSF).

options

(character) script options for command (e.g. "#SBATCH --mem=16G"), newline-separated. May include shell commands such as "module load R/4.5.0". Shebang line such as "#!/bin/bash" not required.

rscript

(character) Rscript executable. Use full path if needed, or "Rscript.exe" on Windows.

See Also

ssh_config(), http_config() and remote_config() for other types of remote configuration.

Examples

Run this code
# Slurm Config:
cluster_config(
  command = "sbatch",
  options = "#SBATCH --job-name=mirai
             #SBATCH --mem=16G
             #SBATCH --output=job.out
             module load R/4.5.0",
  rscript = file.path(R.home("bin"), "Rscript")
)

# SGE Config:
cluster_config(
  command = "qsub",
  options = "#$ -N mirai
             #$ -l mem_free=16G
             #$ -o job.out
             module load R/4.5.0",
  rscript = file.path(R.home("bin"), "Rscript")
)

# Torque/PBS Config:
cluster_config(
  command = "qsub",
  options = "#PBS -N mirai
             #PBS -l mem=16gb
             #PBS -o job.out
             module load R/4.5.0",
  rscript = file.path(R.home("bin"), "Rscript")
)

# LSF Config:
cluster_config(
  command = "bsub",
  options = "#BSUB -J mirai
             #BSUB -M 16000
             #BSUB -o job.out
             module load R/4.5.0",
  rscript = file.path(R.home("bin"), "Rscript")
)

if (FALSE) {

# Launch 2 daemons using the Slurm sbatch defaults:
daemons(n = 2, url = host_url(), remote = cluster_config())
}

Run the code above in your browser using DataLab