Skip to content
Snippets Groups Projects
Commit d345ffd5 authored by David Klein's avatar David Klein
Browse files

MAgPIE coupling: add QOS for coupled runs (specify in scenario_config_coupled_*.csv)

parent ebd2bad2
No related branches found
No related tags found
1 merge request!155A coupled of fixes and improvements to the start scripts
title;start;oldrun;path_report;magpie_scen;LU_pricing;path_gdx;path_gdx_ref;path_gdx_bau;path_gdx_opt title;start;qos;oldrun;path_report;magpie_scen;LU_pricing;path_gdx;path_gdx_ref;path_gdx_bau;path_gdx_opt
SSP1-Base;0;;;SSP1,NPI;y2150;;;; SSP1-Base;0;priority;;;SSP1,NPI;y2150;;;;
SSP1-NDC;0;;;SSP1,NDC;y2150;;;; SSP1-NDC;0;short;;;SSP1,NDC;y2150;;;;
SSP1-NPi;0;;;SSP1,NPI;y2150;;;; SSP1-NPi;0;short;;;SSP1,NPI;y2150;;;;
SSP1-PkBudg900;0;;;SSP1,NDC;y2020;;;; SSP1-PkBudg900;0;short;;;SSP1,NDC;y2020;;;;
SSP1-PkBudg1100;0;;;SSP1,NDC;y2020;;;; SSP1-PkBudg1100;0;short;;;SSP1,NDC;y2020;;;;
SSP1-PkBudg1300;0;;;SSP1,NDC;y2020;;;; SSP1-PkBudg1300;0;short;;;SSP1,NDC;y2020;;;;
SSP2-Base;0;;;SSP2,NPI;y2150;;;; SSP2-Base;1;priority;;;SSP2,NPI;y2150;;;;
SSP2-NDC;0;;;SSP2,NDC;y2150;;;; SSP2-NDC;1;priority;;;SSP2,NDC;y2150;;;;
SSP2-NPi;0;;;SSP2,NPI;y2150;;;; SSP2-NPi;0;short;;;SSP2,NPI;y2150;;;;
SSP2-PkBudg900;0;;;SSP2,NDC;y2020;;;; SSP2-PkBudg900;1;short;;;SSP2,NDC;y2020;;;;
SSP2-PkBudg1100;0;;;SSP2,NDC;y2020;;;; SSP2-PkBudg1100;0;short;;;SSP2,NDC;y2020;;;;
SSP2-PkBudg1300;0;;;SSP2,NDC;y2020;;;; SSP2-PkBudg1300;0;short;;;SSP2,NDC;y2020;;;;
SSP5-Base;0;;;SSP5,NPI;y2150;;;; SSP5-Base;1;short;;;SSP5,NPI;y2150;;;;
SSP5-NDC;0;;;SSP5,NDC;y2150;;;; SSP5-NDC;0;short;;;SSP5,NDC;y2150;;;;
SSP5-NPi;0;;;SSP5,NPI;y2150;;;; SSP5-NPi;0;short;;;SSP5,NPI;y2150;;;;
SSP5-PkBudg900;0;;;SSP5,NDC;y2020;;;; SSP5-PkBudg900;0;short;;;SSP5,NDC;y2020;;;;
SSP5-PkBudg1100;0;;;SSP5,NDC;y2020;;;; SSP5-PkBudg1100;0;short;;;SSP5,NDC;y2020;;;;
SSP5-PkBudg1300;0;;;SSP5,NDC;y2020;;;; SSP5-PkBudg1300;0;short;;;SSP5,NDC;y2020;;;;
SDP-Base;0;;;SDP,NPI;y2150;;;; SDP-Base;0;priority;;;SDP,NPI;y2150;;;;
SDP-NDC;0;;;SDP,NDC;y2150;;;; SDP-NDC;0;short;;;SDP,NDC;y2150;;;;
SDP-NPi;0;;;SDP,NPI;y2150;;;; SDP-NPi;0;short;;;SDP,NPI;y2150;;;;
SDP-PkBudg900;0;;;SDP,NDC;y2020;;;; SDP-PkBudg900;0;short;;;SDP,NDC;y2020;;;;
SDP-PkBudg1000;0;;;SDP,NDC;y2020;;;; SDP-PkBudg1000;0;short;;;SDP,NDC;y2020;;;;
SDP-PkBudg1100;0;;;SDP,NDC;y2020;;;; SDP-PkBudg1100;0;short;;;SDP,NDC;y2020;;;;
SDP-PkBudg1300;0;;;SDP,NDC;y2020;;;; SDP-PkBudg1300;0;short;;;SDP,NDC;y2020;;;;
...@@ -100,7 +100,9 @@ for(scen in common){ ...@@ -100,7 +100,9 @@ for(scen in common){
runname <- paste0(prefix_runname,scen) # name of the run that is used for the folder names runname <- paste0(prefix_runname,scen) # name of the run that is used for the folder names
path_report <- NULL # sets the path to the report REMIND is started with in the first loop path_report <- NULL # sets the path to the report REMIND is started with in the first loop
LU_pricing <- scenarios_coupled[scen, "LU_pricing"] # indicates whether GHG prices should be used by MAgPIE or not LU_pricing <- scenarios_coupled[scen, "LU_pricing"] # set the GHG prices to zero up to and including the year specified here
qos <- scenarios_coupled[scen, "qos"] # set the SLURM quality of service (priority/short/medium/...)
if(is.null(qos)) qos <- "short" # if qos could not be found in scenarios_coupled use short
start_iter <- 1 # iteration to start the coupling with start_iter <- 1 # iteration to start the coupling with
...@@ -269,7 +271,7 @@ for(scen in common){ ...@@ -269,7 +271,7 @@ for(scen in common){
} }
} }
save(path_remind,path_magpie,cfg_rem,cfg_mag,runname,max_iterations,start_iter,n600_iterations,path_report,LU_pricing,file=paste0(runname,".RData")) save(path_remind,path_magpie,cfg_rem,cfg_mag,runname,max_iterations,start_iter,n600_iterations,path_report,LU_pricing,qos,file=paste0(runname,".RData"))
# Define colors for output # Define colors for output
red <- "\033[0;31m" red <- "\033[0;31m"
...@@ -281,6 +283,7 @@ for(scen in common){ ...@@ -281,6 +283,7 @@ for(scen in common){
cat("\nSUMMARY\n") cat("\nSUMMARY\n")
cat("runname :",runname,"\n") cat("runname :",runname,"\n")
cat("QOS :",qos,"\n")
cat("start_iter :",start_iter,"\n") cat("start_iter :",start_iter,"\n")
cat("path_remind : ",ifelse(dir.exists(path_remind),green,red), path_remind, NC, "\n",sep="") cat("path_remind : ",ifelse(dir.exists(path_remind),green,red), path_remind, NC, "\n",sep="")
cat("path_magpie : ",ifelse(dir.exists(path_magpie),green,red), path_magpie, NC, "\n",sep="") cat("path_magpie : ",ifelse(dir.exists(path_magpie),green,red), path_magpie, NC, "\n",sep="")
...@@ -300,7 +303,7 @@ for(scen in common){ ...@@ -300,7 +303,7 @@ for(scen in common){
if (start_now){ if (start_now){
# Start SSP2-Base and SSP2-NDC as priority jobs since ALL subsequent runs depend on them # Start SSP2-Base and SSP2-NDC as priority jobs since ALL subsequent runs depend on them
qos <- ifelse(grepl("SSP2-(NDC|Base)",runname),"priority","short") #qos <- ifelse(grepl("SSP2-(NDC|Base)",runname),"priority","short")
if (!exists("test")) system(paste0("sbatch --qos=",qos," --job-name=",runname," --output=",runname,".log --mail-type=END --comment=REMIND-MAgPIE --tasks-per-node=",nr_of_regions," --wrap=\"Rscript start_coupled.R coupled_config=",runname,".RData\"")) if (!exists("test")) system(paste0("sbatch --qos=",qos," --job-name=",runname," --output=",runname,".log --mail-type=END --comment=REMIND-MAgPIE --tasks-per-node=",nr_of_regions," --wrap=\"Rscript start_coupled.R coupled_config=",runname,".RData\""))
else cat("Test mode: run NOT submitted to the cluster\n") else cat("Test mode: run NOT submitted to the cluster\n")
} else { } else {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
################################################################## ##################################################################
################# D E F I N E start_coupled ##################### ################# D E F I N E start_coupled #####################
################################################################## ##################################################################
start_coupled <- function(path_remind,path_magpie,cfg_rem,cfg_mag,runname,max_iterations=5,start_iter=1,n600_iterations=0,report=NULL,LU_pricing=TRUE) { start_coupled <- function(path_remind,path_magpie,cfg_rem,cfg_mag,runname,max_iterations=5,start_iter=1,n600_iterations=0,report=NULL,LU_pricing=TRUE,qos) {
require(lucode) require(lucode)
require(magclass) require(magclass)
...@@ -26,7 +26,7 @@ start_coupled <- function(path_remind,path_magpie,cfg_rem,cfg_mag,runname,max_it ...@@ -26,7 +26,7 @@ start_coupled <- function(path_remind,path_magpie,cfg_rem,cfg_mag,runname,max_it
# retrieve REMIND settings # retrieve REMIND settings
cfg_rem <- check_config(cfg_rem,paste0(path_remind,"config/default.cfg"),paste0(path_remind,"modules")) cfg_rem <- check_config(cfg_rem,paste0(path_remind,"config/default.cfg"),paste0(path_remind,"modules"))
cfg_rem$sequential <- TRUE cfg_rem$slurmConfig <- "direct"
cm_iteration_max_tmp <- cfg_rem$gms$cm_iteration_max # save default setting cm_iteration_max_tmp <- cfg_rem$gms$cm_iteration_max # save default setting
cfg_rem_original <- cfg_rem$output cfg_rem_original <- cfg_rem$output
...@@ -210,7 +210,7 @@ start_coupled <- function(path_remind,path_magpie,cfg_rem,cfg_mag,runname,max_it ...@@ -210,7 +210,7 @@ start_coupled <- function(path_remind,path_magpie,cfg_rem,cfg_mag,runname,max_it
for(run in cfg_rem$subsequentruns){ for(run in cfg_rem$subsequentruns){
cat("Submitting subsequent run",run,"\n") cat("Submitting subsequent run",run,"\n")
# Start SSP2-Base and SSP2-NDC as priority jobs since ALL subsequent runs depend on them # Start SSP2-Base and SSP2-NDC as priority jobs since ALL subsequent runs depend on them
qos <- ifelse(grepl("SSP2-(NDC|Base)",run),"priority","short") #qos <- ifelse(grepl("SSP2-(NDC|Base)",run),"priority","short")
system(paste0("sbatch --qos=",qos," --job-name=C_",run," --output=C_",run,".log --mail-type=END --comment=REMIND-MAgPIE --tasks-per-node=",nr_of_regions," --wrap=\"Rscript start_coupled.R coupled_config=C_",run,".RData\"")) system(paste0("sbatch --qos=",qos," --job-name=C_",run," --output=C_",run,".log --mail-type=END --comment=REMIND-MAgPIE --tasks-per-node=",nr_of_regions," --wrap=\"Rscript start_coupled.R coupled_config=C_",run,".RData\""))
} }
...@@ -257,7 +257,7 @@ require(lucode) ...@@ -257,7 +257,7 @@ require(lucode)
readArgs("coupled_config") readArgs("coupled_config")
load(coupled_config) load(coupled_config)
start_coupled(path_remind,path_magpie,cfg_rem,cfg_mag,runname,max_iterations,start_iter,n600_iterations,path_report,LU_pricing) start_coupled(path_remind,path_magpie,cfg_rem,cfg_mag,runname,max_iterations,start_iter,n600_iterations,path_report,LU_pricing,qos)
# Manual call: # Manual call:
# Rscript start_coupled.R coupled_config=runname # Rscript start_coupled.R coupled_config=runname
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