Note
This branch contains slurm files specific to the Great Lakes.
Check branches for other HPC Clusters or environments
This repository provides example R and SLURM scripts demonstrating several methods for running bootstrap analyses on an HPC cluster. The examples range from basic single-core jobs to parallel and array-based workflows, including automated result combination.
-
simple/: Basic single-core bootstrap example
bs_simple.R
: R script for bootstrap analysisbs_simple.slurm
: SLURM script to submit the job
-
parallel/: Multi-core parallel bootstrap example
bs_parallel.R
: Uses theparallelly
andparallel
R packages to distribute work across available coresbs_parallel.slurm
: SLURM script to request multiple cores
-
array/: Job array example for distributing bootstrap tasks
bs_array.R
: R script that runs a portion of the bootstrap, using SLURM array task IDsbs_array.slurm
: SLURM array job script- combine/: Combine results from array jobs
combine_csv.R
: R script to merge CSV outputs from all array jobscombine_csv.slurm
: SLURM script to run the combine step
- read_from_csv/: Example of a SLURM array job where each task reads parameters from a CSV file
vars_from_csv.R
: Sample R script that processes parameters from a CSV filevars_from_csv.slurm
: SLURM batch script that reads CSV parameters for each array taskparams.csv
: Example CSV file with parameter setsREADME.md
: Details on using CSV input with SLURM array jobs
-
workflow/: Workflow automation
array_workflow.sh
: Bash script to submit the array job and then the combine job with dependency handlingREADME.md
: Details on the workflow usage
Job Type | Definition |
---|---|
simple | A simple R and SLURM script that shows how to run your code on the cluster with no frills. |
parallel | How to run the same simple job, but use multiple cores to split up the work. |
array | Split the simple job into a job array, spreading the work across multiple CPUs running in parallel |
workflow | Automate running the array and combine jobs in sequence, ensuring results are merged after all tasks complete |
Tip
The parallel and combine examples will use the UMICH CRAN mirror to install required R packages if not already installed.
- Connect to a terminal session on
greatlakes.arc-ts.umich.edu
cd
into the desired directorygit clone
this repositorycd
into one of the example folders (e.g.,simple
,parallel
,array
)- Update
.slurm
files with the appropriate SLURM account:find . -type f -name "*.slurm" -exec sed -i 's/SLURM_ACCOUNT/your_account_here/g' {} +
- Submit a job:
sbatch bs_EXAMPLE.slurm
(replace EXAMPLE with the appropriate name) - Use
sq
to view your job queue - Once complete, use
my_job_statistics JOB_ID
(replace JOB_ID with your job's ID)
To automate running the array and combine jobs:
cd workflow
bash array_workflow.sh
This will submit the array job, then automatically submit the combine job after all array tasks finish. See workflow/README.md
for more details.
For more information on each example, see the README files in the respective subfolders.