Skip to content
Snippets Groups Projects
Unverified Commit 9b3ca836 authored by Lavinia Baumstark's avatar Lavinia Baumstark Committed by GitHub
Browse files

Merge pull request #109 from Loisel/fix_multi_comparison

Improve documentation of the multiComparison Utility
parents 4c54f189 3e827f6f
No related branches found
No related tags found
No related merge requests found
......@@ -40,9 +40,18 @@ require(data.table)
#' in coupled runs
#' short: the run should run only on a time range up to 2060
#'
#' Eventually, `scripts/utils/compareParallel.R` reads the file
#' `multi_comparison.csv` and executes `compareScenarios` locally or on the cluster
#' (depending on the presence of the `sbatch` slurm utils).
#'
#' The number of cores to be used in parallel on the cluster is
#' determined by the variable CORES at the top of the function body.
#'
#' The prefix for coupled runs is also defined at the top (COUPLED_PREFIX).
#'
#' The scenarioComparison plots are stored in the subfolder
#' OUTPUT_FOLDER.
#'
#' @param listofruns a list of output folders, as given by the
#' `output.R` infrastructure
......@@ -50,6 +59,7 @@ require(data.table)
compareScenTable <- function(listofruns){
CORES = 12
COUPLED_PREFIX = "C_"
OUTPUT_FOLDER = "multi_comparison_plots"
scendt <- fread("config/multi_comparison_matrix.csv")
scendt[
......@@ -103,10 +113,11 @@ compareScenTable <- function(listofruns){
if(system("hash sbatch 2>/dev/null") == 0){
cat("Submitting comparison Jobs:\n")
system(sprintf("sbatch --job-name=rem-compare --output=log-%%j.out --mail-type=END --cpus-per-task=%i --qos=priority --wrap=\"Rscript scripts/utils/compareParallel.R \"", CORES))
system(sprintf("sbatch --job-name=rem-compare --output=log-%%j.out --mail-type=END --cpus-per-task=%i --qos=priority --wrap=\"Rscript scripts/utils/compareParallel.R %s\"",
CORES, OUTPUT_FOLDER))
}else{
source("scripts/utils/compareParallel.R")
}
}
compareScenTable(outputdirs, CORES)
compareScenTable(outputdirs)
......@@ -8,7 +8,13 @@ require(data.table)
require(parallel)
require(remind)
plotfldr <- "multi_comparison_plots/"
args = commandArgs(trailingOnly=TRUE)
if (length(args)==0) {
plotfldr <- "multi_comparison_plots"
} else {
plotfldr <- args[1]
}
dir.create(plotfldr, showWarnings = F)
NUM_OF_CPUS_LOCAL <- 2
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment