run_inla_on_slurm.RdPrepare inputs and write an R script and SLURM submission script to run an INLA model on a SLURM cluster. This function saves model inputs (and optional extra objects) to an .RData file, writes an R script that loads those inputs and runs INLA, and writes a SLURM submission script to run that R script.
run_inla_on_slurm(
stk_path,
inla_formula,
inla_family = "nbinomial",
inla_control_predictor = list(compute = TRUE),
inla_control_compute = list(dic = TRUE, waic = TRUE, cpo = TRUE),
job_name = "INLAjob",
partition = "fuchs",
time = "8:00:00",
ntasks = 1,
nodes = 1,
conda_env = "kinh",
rscript = "run.r",
work_dir = ".",
rsave_path = "inla_input.RData",
submit = FALSE,
submit_cmd = "sbatch",
extra_objects = NULL,
...
)Path to a saved INLA stack (.RData) that contains an object named `stk`.
A formula to pass to INLA.
Family name passed to INLA (default: "nbinomial").
List passed to control.predictor (default: list(compute = TRUE)).
List passed to control.compute (default: list(dic = TRUE, waic = TRUE, cpo = TRUE)).
See function arguments for SLURM and script control.
SLURM partition to use (default: "fuchs").
Walltime for the job (default: "8:00:00").
Number of tasks (default: 1).
Number of nodes (default: 1).
Name of the conda environment to activate (default: "kinh").
Name of the R script file to write (default: "run.r").
Working directory where scripts and .RData will be saved (default: current directory).
Path to save the .RData file containing model inputs (default: "inla_input.RData").
set to TRUE to submit the job immediately after writing the scripts.
Command to use for submission (default: "sbatch").
Named list of additional R objects to save into the .RData file (e.g. list(pc_prec = pc_prec)).
Additional unused arguments kept for extensibility.
Invisibly returns a list with paths to the generated files and submission info: list(submitted = logical, rscript = <path>, slurm = <path>, rdata = <path>, output = <submission output if any>).