-
Notifications
You must be signed in to change notification settings - Fork 1
/
batchtools.slurm.tmpl
38 lines (32 loc) · 1.57 KB
/
batchtools.slurm.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
## Job Resource Interface Definition
##
## ntasks [integer(1)]: Number of required tasks,
## Set larger than 1 if you want to further parallelize
## with MPI within your job.
## ncpus [integer(1)]: Number of required cpus per task,
## Set larger than 1 if you want to further parallelize
## with multicore/parallel within each task.
## walltime [integer(1)]: Walltime for this job, in minutes.
## Must be at least 1 minute.
##
## Default resources can be set in your .batchtools.conf.R by defining the variable
## 'default.resources' as a named list.
<%
# relative paths are not handled well by Slurm
log.file = fs::path_expand(log.file)
-%>
#SBATCH --job-name=<%= job.name %>
#SBATCH --output=<%= log.file %>
#SBATCH --error=<%= log.file %>
#SBATCH --time=<%= resources$walltime %>
<%= if (!is.null(resources$partition)) sprintf(paste0("#SBATCH --partition='", resources$partition, "'")) %>
<%= if (!is.null(resources$ntasks)) sprintf(paste0("#SBATCH --ntasks='", resources$ntasks, "'")) %>
<%= if (!is.null(resources$cpus_per_task)) sprintf(paste0("#SBATCH --cpus-per-task='", resources$cpus_per_task, "'")) %>
<%= if (!is.null(resources$nodes)) sprintf(paste0("#SBATCH --nodes='", resources$nodes, "'")) %>
## Initialize work environment like
## source /etc/profile
## module add ...
## Run R:
## we merge R output with stdout from SLURM, which gets then logged via --output option
Rscript -e 'batchtools::doJobCollection("<%= uri %>")'