sbatch_master: Create sbatch Bash Shell Script with Parameter Combination

View source: R/sbatch_master.R

sbatch_masterR Documentation

Create sbatch Bash Shell Script with Parameter Combination

Description

Creates a master-level SLURM::sbatch script given a set of parameter combinations implied by environmental arguments used as parameters.

Usage

sbatch_master(
  vars,
  expand.vars = TRUE,
  working.dir = "",
  master.file = "",
  runsim.file = "runsim.sh",
  build.runsim = FALSE,
  env.file = "~/loadR.sh",
  rscript.file = "sim.R",
  param.file = NULL,
  param.tag = NULL,
  simno.start,
  nsims = 100,
  ncores = 16,
  narray = NULL,
  ckpt = FALSE,
  append = FALSE,
  mem = "55G",
  walltime = "1:00:00",
  jobname,
  partition.main = "csde",
  partition.ckpt = "ckpt",
  account.main = "csde",
  account.ckpt = "csde-ckpt"
)

Arguments

vars

A list of parameters with varying values (see examples below).

expand.vars

If TRUE, expand the grid on the individual vars, else the individual vars must be vectors of equal length.

working.dir

Path to write out the master.file, and if specified the runsim.file and param.file.

master.file

Name of the output bash shell script file to write. If "", then will print to console.

runsim.file

Name of the bash shell script file that contains the R batch commands to be executed by sbatch.

build.runsim

If TRUE, will write out a bash shell script with the file name runsim.file that loads the R environment listed in env.file and execute Rscript on the file listed in rscript.file.

env.file

Bash shell script to load the R environment desired. Optionally kept in a user's home directory with the default file name. Example script below.

rscript.file

Name of the .R file that contains the primary simulation to be executed by Rscript.

param.file

Name of a csv file to write out the list of varying parameters and simulation numbers set within the function.

param.tag

Character string for current scenario batch added to param.sheet.

simno.start

Starting number for the SIMNO variable. If missing and append=TRUE, will read the lines of outfile and start numbering at one after the previous maximum.

nsims

Total number of simulations across all array jobs.

ncores

Number of cores per node to use within each Slurm job.

narray

Number of array batches within each Slurm job. If NULL, then will use nsims/ncores array batches.

ckpt

If TRUE, use the checkpoint queue to submit jobs. If numeric, will specify the first X jobs on the grid as non-backfill.

append

If TRUE, will append lines to a previously created shell script. New simno will either start with value of simno.start or the previous value if missing.

mem

Amount of memory needed per node within each Slurm job.

walltime

Amount of clock time needed per Slurm job.

jobname

Job name assigned to Slurm job. If unspecified, defaults to the simulation number in each job.

partition.main

Name of primary HPC partition (passed to -p).

partition.ckpt

Name of checkpoint HPC partition (passed to -p).

account.main

Name of primary account (passed to -A).

account.ckpt

Name of checkpoint account (passed to -A).

Examples

# Examples printing to console
vars <- list(A = 1:5, B = seq(0.5, 1.5, 0.5))
sbatch_master(vars)
sbatch_master(vars, nsims = 250)
sbatch_master(vars, ckpt = TRUE)
sbatch_master(vars, nsims = 50, ckpt = 10)
sbatch_master(vars, simno.start = 1000)
sbatch_master(vars, jobname = "epiSim")

## Not run: 
# Full-scale example writing out files
sbatch_master(vars, nsims = 50, simno.start = 1000, build.runsim = TRUE,
              master.file = "master.sh", param.sheet = "params.csv")
sbatch_master(vars, nsims = 50, append = TRUE,
              master.file = "master.sh", param.sheet = "params.csv")


## End(Not run)


statnet/EpiModelHPC documentation built on Nov. 13, 2023, 11:38 a.m.