diff --git a/scripts/start/prepare_and_run.R b/scripts/start/prepare_and_run.R index 90c64e1cfd09da0e5df76bff57e030e3cb7ec98a..68d691e2ab66d19ad644013bc431a2c06cd90c8a 100644 --- a/scripts/start/prepare_and_run.R +++ b/scripts/start/prepare_and_run.R @@ -597,6 +597,18 @@ run <- function(start_subsequent_runs = TRUE) { # Save start time timeGAMSStart <- Sys.time() + # De-compress finxing files if they have already been zipped (only valid if run is restarted) + if (cfg$gms$cm_startyear > 2005) { + if (file.exists("levs.gms.gz")) { + cat("Unzip fixing files\n") + system("gzip -d -f levs.gms.gz margs.gms.gz fixings.gms.gz") + } else if (file.exists("levs.gms")) { + cat("Found unzipped fixing files. Using them.\n") + } else { + stop("cm_startyear > 2005 but no fixing files found, neither zipped or unzipped.") + } + } + # Print message cat("\nStarting REMIND...\n") diff --git a/start.R b/start.R index 89230c8cdb4eb0161e39726337e50675f7842329..c793f8121ee446f81443d740fcada0155c874cb8 100755 --- a/start.R +++ b/start.R @@ -44,10 +44,10 @@ get_line <- function(){ choose_folder <- function(folder,title="Please choose a folder") { dirs <- NULL - # Detect all output folders containing fulldata.gdx + # Detect all output folders containing fulldata.gdx or non_optimal.gdx # For coupled runs please use the outcommented text block below - dirs <- sub("/fulldata.gdx","",sub("./output/","",Sys.glob(file.path(folder,"*","fulldata.gdx")))) + dirs <- sub("/(non_optimal|fulldata).gdx","",sub("./output/","",Sys.glob(c(file.path(folder,"*","non_optimal.gdx"),file.path(folder,"*","fulldata.gdx"))))) # DK: The following outcommented lines are specially made for listing results of coupled runs #runs <- findCoupledruns(folder) diff --git a/start_bundle_coupled.R b/start_bundle_coupled.R index f8f5d49b855cc4e8d0285beaf3db92e6e59b8fd5..e4fe8a8c27b6841f83643035138806661644117f 100644 --- a/start_bundle_coupled.R +++ b/start_bundle_coupled.R @@ -299,7 +299,9 @@ for(scen in common){ } if (start_now){ - if (!exists("test")) system(paste0("sbatch --qos=priority --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\"")) + # 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") + 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(paste0("Run ",runname," will start after preceding run ",prefix_runname,settings_remind[scen,"path_gdx_ref"]," has finished\n")) diff --git a/start_coupled.R b/start_coupled.R index 1d74e97e25a9deb038ab3650fbc1a1424e78c023..f799cfe9ab7bcb486cae822d3432eaec182f1852 100644 --- a/start_coupled.R +++ b/start_coupled.R @@ -209,7 +209,9 @@ start_coupled <- function(path_remind,path_magpie,cfg_rem,cfg_mag,runname,max_it #start subsequent runs via sbatch for(run in cfg_rem$subsequentruns){ cat("Submitting subsequent run",run,"\n") - system(paste0("sbatch --qos=priority --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\"")) + # 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") + 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\"")) } # Read runtime of ALL coupled runs (not just the current scenario) and produce comparison pdf