-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartOutSLURM.R
53 lines (45 loc) · 1.5 KB
/
startOutSLURM.R
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#' Initiate and submit to SLURM
#'
#' Initiate the output path, set the SLURM configuration and submit all computations to SLURM
#'
#' @author Ricarda Rosemann
#'
#' @param config run configurations
#' @param path character vector with folders to run the model in
#' @param outputFolder directory of output folder
#' @param tasks32 whether run should use 32 parallel tasks
#' @export
#'
library(devtools)
load_all("../brick")
startOutSLURM <- function(config = NULL,
path = NULL,
outputFolder = "output", tasks32 = FALSE) {
cfg <- readConfig(config)
if (tasks32) {
slurmConfig <- paste("--qos=short --nodes=1 --tasks-per-node=32",
"--constraint=broadwell --time=01:00:00")
} else {
slurmConfig <- "--qos=priority --nodes=1 --tasks-per-node=16"
}
title <- cfg[["title"]]
argString <- ""
if (!is.null(config)) {
argString <- paste(argString, "-c", config)
}
if (!is.null(path)) {
argString <- paste(argString, "-p", path)
}
argString <- paste(argString, "-o", outputFolder)
exitCode <- system(paste0("sbatch --job-name=",
title,
" --mail-type=END",
" --comment=BRICK",
" --wrap=\"Rscript ../brickClusterstart/startOutside.R",
argString, " \" ",
slurmConfig))
Sys.sleep(1)
if (exitCode > 0) {
print("Executing startModel failed.")
}
}