-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
93 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: lpjmlkit | ||
Type: Package | ||
Title: Toolkit for Basic LPJmL Handling | ||
Version: 1.1.7 | ||
Version: 1.1.8 | ||
Authors@R: c( | ||
person("Jannes", "Breier", , "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-9055-6904")), | ||
person("Sebastian","Ostberg", , "[email protected]", role = "aut", comment = c(ORCID = "0000-0002-2368-7015")), | ||
|
@@ -54,4 +54,4 @@ Suggests: | |
sf | ||
Config/testthat/edition: 3 | ||
VignetteBuilder: knitr | ||
Date: 2023-07-11 | ||
Date: 2023-07-18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,17 +27,32 @@ | |
#' More information at <https://www.pik-potsdam.de/en>. Defaults to `"short"`. | ||
#' | ||
#' @param ntasks Integer defining the number of tasks/threads. More information | ||
#' at <https://www.pik-potsdam.de/en> and <https://slurm.schedmd.com>. | ||
#' Defaults to `256`. | ||
#' at <https://www.pik-potsdam.de/en> and | ||
#' <https://slurm.schedmd.com/sbatch.html>. Defaults to `256`. | ||
#' | ||
#' @param wtime Character string defining the time limit. Setting a lower time | ||
#' limit than the maximum runtime for `sclass` can reduce the wait time in the | ||
#' SLURM job queue. More information at <https://www.pik-potsdam.de/en> and | ||
#' <https://slurm.schedmd.com>. | ||
#' <https://slurm.schedmd.com/sbatch.html>. | ||
#' | ||
#' @param blocking Integer defining the number of cores to be blocked. More | ||
#' information at <https://www.pik-potsdam.de/en> and | ||
#' <https://slurm.schedmd.com>. | ||
#' <https://slurm.schedmd.com/sbatch.html>. | ||
#' | ||
#' @param constraint Character string defining constraints for node selection. | ||
#' Use `constraint = "haswell"` to request nodes of the type haswell with 16 | ||
#' cores per node, `constraint = "broadwell"` to request nodes of the type | ||
#' broadwell CPUs with 32 cores per node or `constraint = "exclusive"` to | ||
#' reserve all CPUs of assigned nodes even if less are requested by `ntasks`. | ||
#' Using `exclusive` should prevent interference of other batch jobs with | ||
#' LPJmL. More information at <https://www.pik-potsdam.de> and | ||
#' <https://slurm.schedmd.com/sbatch.html>. | ||
|
||
#' | ||
#' @param slurm_options A named list of further arguments to be passed to sbatch. | ||
#' E.g. list(`mail-user` = "[email protected]") | ||
#' More information at <https://www.pik-potsdam.de> and | ||
#' <https://slurm.schedmd.com/sbatch.html> | ||
#' | ||
#' @param no_submit Logical. Set to `TRUE` to test if `x` set correctly or | ||
#' `FALSE` to actually submit job to SLURM. | ||
|
@@ -67,11 +82,11 @@ | |
#' | scen2_transient | scen1 _spinup | | ||
#' | ||
#' To use different SLURM settings for each run the optional SLURM options | ||
#' `"sclass"`, `"ntask"`, `"wtime"` or `"blocking"` can also be supplied to the | ||
#' initial \link[tibble]{tibble} supplied as `param` to | ||
#' `"sclass"`, `"ntasks"`, `"wtime"`, "blocking"` or `constraint` can also be | ||
#' supplied to the initial \link[tibble]{tibble} supplied as `param` to | ||
#' [`write_config()`]. These overwrite the (default) SLURM | ||
#' arguments (`sclass`, `ntask`, `wtime` or `blocking`) supplied to | ||
#' `submit_lpjml`. | ||
#' arguments (`sclass`, `ntasks`, `wtime`, `blocking` or ` `constraint`) | ||
#' supplied to `submit_lpjml`. | ||
#' | ||
#' | **sim_name** | **dependency** | **wtime** | | ||
#' |:--------------- |:-------------- |----------:| | ||
|
@@ -175,6 +190,8 @@ submit_lpjml <- function(x, # nolint:cyclocomp_linter. | |
ntasks = 256, | ||
wtime = "", | ||
blocking = "", | ||
constraint = "", | ||
slurm_options = list(), | ||
no_submit = FALSE, | ||
output_path = NULL) { | ||
|
||
|
@@ -213,7 +230,9 @@ submit_lpjml <- function(x, # nolint:cyclocomp_linter. | |
x$type <- "simulation" | ||
x$job_id <- NA | ||
x$status <- "failed" | ||
slurm_args <- c("sclass", "ntask", "wtime", "blocking") | ||
slurm_args <- c( | ||
"sclass", "ntasks", "wtime", "blocking", "constraint", "slurm_options" | ||
) | ||
|
||
if ("order" %in% colnames(x)) { | ||
|
||
|
@@ -258,7 +277,9 @@ submit_lpjml <- function(x, # nolint:cyclocomp_linter. | |
ntasks, | ||
wtime, | ||
blocking, | ||
dependency) | ||
constraint, | ||
dependency, | ||
slurm_options) | ||
|
||
if (job$status == 0) { | ||
x$job_id[sim_idx] <- strsplit( | ||
|
@@ -307,7 +328,9 @@ submit_lpjml <- function(x, # nolint:cyclocomp_linter. | |
ntasks, | ||
wtime, | ||
blocking, | ||
dependency = NA) | ||
constraint, | ||
dependency = NA, | ||
slurm_options) | ||
|
||
if (job$status == 0) { | ||
x$job_id[sim_idx] <- strsplit( | ||
|
@@ -341,7 +364,9 @@ submit_run <- function(sim_name, | |
ntasks, | ||
wtime, | ||
blocking, | ||
dependency) { | ||
constraint, | ||
dependency, | ||
slurm_options) { | ||
|
||
config_file <- paste0("config_", | ||
sim_name, | ||
|
@@ -373,6 +398,14 @@ submit_run <- function(sim_name, | |
timestamp, | ||
".json") | ||
|
||
if (is.list(slurm_options) && length(slurm_options) > 0) { | ||
further_slurm_options <- paste0( | ||
" -option ", names(slurm_options), "=", slurm_options, collapse = " " | ||
) | ||
} else { | ||
further_slurm_options <- "" | ||
} | ||
|
||
inner_command <- paste0(model_path, "/bin/lpjsubmit", # nolint:absolute_path_linter. | ||
" -nocheck", | ||
" -class ", sclass, | ||
|
@@ -383,9 +416,13 @@ submit_run <- function(sim_name, | |
ifelse(blocking != "", | ||
paste0(" -blocking ", blocking), | ||
""), | ||
ifelse(constraint != "", | ||
paste0(" -constraint ", constraint), | ||
""), | ||
ifelse(!is.na(dependency), | ||
paste0(" -dependency ", dependency), | ||
""), | ||
further_slurm_options, | ||
" -o ", stdout, | ||
" -e ", stderr, | ||
" ", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters