diff --git a/doc/release_notes.rst b/doc/release_notes.rst index dc1a9dd19..be3b65d08 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -28,6 +28,7 @@ Upcoming Release * Cluster residential and services heat buses by default. Can be disabled with ``cluster_heat_buses: false``. +* Bugfix: Correctly read out number of solver threads from configuration file. PyPSA-Eur 0.9.0 (5th January 2024) ================================== diff --git a/rules/common.smk b/rules/common.smk index 2298ff912..1654180f0 100644 --- a/rules/common.smk +++ b/rules/common.smk @@ -13,6 +13,13 @@ for path in helper_source_path: from _helpers import validate_checksum +def solver_threads(w): + solver_options = config["solving"]["solver_options"] + option_set = config["solving"]["solver"]["options"] + threads = solver_options[option_set].get("threads", 4) + return threads + + def memory(w): factor = 3.0 for o in w.opts.split("-"): diff --git a/rules/solve_electricity.smk b/rules/solve_electricity.smk index 7f6092be2..ac433cf93 100644 --- a/rules/solve_electricity.smk +++ b/rules/solve_electricity.smk @@ -25,7 +25,7 @@ rule solve_network: + "solve_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_python.log", benchmark: BENCHMARKS + "solve_network/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}" - threads: 4 + threads: solver_threads resources: mem_mb=memory, walltime=config["solving"].get("walltime", "12:00:00"), diff --git a/rules/solve_myopic.smk b/rules/solve_myopic.smk index 7ca8857db..aa94c9457 100644 --- a/rules/solve_myopic.smk +++ b/rules/solve_myopic.smk @@ -104,7 +104,7 @@ rule solve_sector_network_myopic: + "elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}_solver.log", python=LOGS + "elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}_python.log", - threads: 4 + threads: solver_threads resources: mem_mb=config["solving"]["mem"], walltime=config["solving"].get("walltime", "12:00:00"), diff --git a/rules/solve_overnight.smk b/rules/solve_overnight.smk index 397781621..aa08b8c3b 100644 --- a/rules/solve_overnight.smk +++ b/rules/solve_overnight.smk @@ -28,9 +28,7 @@ rule solve_sector_network: + "logs/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}_memory.log", python=RESULTS + "logs/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}_python.log", - threads: config["solving"]["solver_options"][config["solving"]["solver"]["options"]].get( - "threads", 4 -) + threads: solver_threads resources: mem_mb=config["solving"]["mem"], walltime=config["solving"].get("walltime", "12:00:00"), diff --git a/rules/solve_perfect.smk b/rules/solve_perfect.smk index a7856fa93..ad310f9fc 100644 --- a/rules/solve_perfect.smk +++ b/rules/solve_perfect.smk @@ -127,7 +127,7 @@ rule solve_sector_network_perfect: output: RESULTS + "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_brownfield_all_years.nc", - threads: 4 + threads: solver_threads resources: mem_mb=config["solving"]["mem"], shadow: