From d3ad1714c3b2c633a3c1860405ba3db5298e7a7e Mon Sep 17 00:00:00 2001 From: forsyth2 <30700190+forsyth2@users.noreply.github.com> Date: Mon, 17 Jul 2023 17:13:03 -0700 Subject: [PATCH] Add parallel option (#452) --- tests/integration/test_defaults.cfg | 2 ++ tests/test_sections.py | 10 ++++++++++ zppy/templates/climo.bash | 4 ++-- zppy/templates/default.ini | 4 ++++ zppy/templates/ts.bash | 3 +++ 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/integration/test_defaults.cfg b/tests/integration/test_defaults.cfg index 9f967f17..59aedf7a 100644 --- a/tests/integration/test_defaults.cfg +++ b/tests/integration/test_defaults.cfg @@ -11,6 +11,8 @@ mapping_file = /home/ac.zender/data/maps/map_ne30pg2_to_cmip6_180x360_aave.20200 # climo will override this value because it has a lower-level default nodes = 1 output = test_defaults_output +# climo will override this value because it has a lower-level default +parallel = "" partition = haswell # climo will override this value because it has a lower-level default vars = "FSNTOA,FLUT,FSNT,FLNT,FSNS,FLNS,SHFLX,QFLX,TAUX,TAUY,PRECC,PRECL,PRECSC,PRECSL,TS,TREFHT,CLDTOT,CLDHGH,CLDMED,CLDLOW,U" diff --git a/tests/test_sections.py b/tests/test_sections.py index 45c41f57..b4959838 100644 --- a/tests/test_sections.py +++ b/tests/test_sections.py @@ -80,6 +80,7 @@ def test_sections(self): "mapping_file": "", "output": "OUTPUT", "nodes": 1, + "parallel": "", "partition": "SHORT", "plugins": [], "qos": "regular", @@ -132,6 +133,7 @@ def test_sections(self): "mapping_file": "MAPPING_FILE_TS", "nodes": 1, "output": "OUTPUT", + "parallel": "", "partition": "SHORT", "plugins": [], "qos": "regular", @@ -154,6 +156,7 @@ def test_sections(self): "exclude": False, "mapping_file": "MAPPING_FILE_CLIMO", "nodes": 4, + "parallel": "mpi", "vars": "", "years": ["0001:0050:50"], } @@ -180,6 +183,7 @@ def test_sections(self): "mapping_file": "MAPPING_FILE_CLIMO", "nodes": 4, "output": "OUTPUT", + "parallel": "mpi", "partition": "SHORT", "plugins": [], "qos": "regular", @@ -229,6 +233,7 @@ def test_subsections(self): "mapping_file": "", "nodes": 1, "output": "OUTPUT", + "parallel": "", "partition": "SHORT", "plugins": [], "qos": "regular", @@ -299,6 +304,7 @@ def test_subsections(self): "mapping_file": "MAPPING_FILE_TS_GRID1", "nodes": 1, "output": "OUTPUT", + "parallel": "", "partition": "SHORT", "plugins": [], "qos": "regular", @@ -335,6 +341,7 @@ def test_subsections(self): "mapping_file": "MAPPING_FILE_TS_GRID2", "nodes": 1, "output": "OUTPUT", + "parallel": "", "partition": "SHORT", "plugins": [], "qos": "regular", @@ -371,6 +378,7 @@ def test_subsections(self): "exclude": False, "mapping_file": "MAPPING_FILE_CLIMO", "nodes": 4, + "parallel": "mpi", "vars": "", "years": ["0001:0050:50"], } @@ -397,6 +405,7 @@ def test_subsections(self): "mapping_file": "MAPPING_FILE_CLIMO_GRID1", "nodes": 4, "output": "OUTPUT", + "parallel": "mpi", "partition": "SHORT", "plugins": [], "qos": "regular", @@ -428,6 +437,7 @@ def test_subsections(self): "mapping_file": "MAPPING_FILE_CLIMO_GRID2", "nodes": 4, "output": "OUTPUT", + "parallel": "mpi", "partition": "LONG", "plugins": [], "qos": "regular", diff --git a/zppy/templates/climo.bash b/zppy/templates/climo.bash index e9363267..47ff36d3 100644 --- a/zppy/templates/climo.bash +++ b/zppy/templates/climo.bash @@ -34,7 +34,7 @@ ncclimo \ {%- if vars != '' %} --vars={{ vars }} \ {%- endif %} ---parallel=mpi \ +--parallel={{ parallel }} \ --yr_srt={{ yr_start }} \ --yr_end={{ yr_end }} \ --input={{ input }}/{{ input_subdir }} \ @@ -105,7 +105,7 @@ cat input.txt | ncclimo \ {%- if vars != '' %} --vars={{ vars }} \ {%- endif %} ---parallel=mpi \ +--parallel={{ parallel }} \ --yr_srt={{ yr_start }} \ --yr_end={{ yr_end }} \ {% if mapping_file == '' -%} diff --git a/zppy/templates/default.ini b/zppy/templates/default.ini index ddd84b36..9251ff28 100644 --- a/zppy/templates/default.ini +++ b/zppy/templates/default.ini @@ -39,6 +39,8 @@ nodes = integer(default=1) # Where the post-processing results (`post` directory) should go # NOTE: no default, must be provided by user output = string +# The `parallel` option for ncclimo +parallel = string(default="") # The partition of the machine to run on partition = string(default="") # External zppy plugin modules @@ -69,6 +71,8 @@ active = boolean(default=True) [climo] exclude = boolean(default=False) # NOTE: always overrides value in [default] +parallel = string(default="mpi") +# NOTE: always overrides value in [default] nodes = integer(default=4) # NOTE: always overrides value in [default] vars = string(default="") diff --git a/zppy/templates/ts.bash b/zppy/templates/ts.bash index 7248fca3..ee9f82dc 100644 --- a/zppy/templates/ts.bash +++ b/zppy/templates/ts.bash @@ -88,6 +88,9 @@ cat input.txt | ncclimo \ {%- if extra_vars != '' %} --var_xtr={{extra_vars}} \ {%- endif %} +{%- if parallel != '' %} +--parallel={{ parallel }} \ +{%- endif %} --yr_srt={{ yr_start }} \ --yr_end={{ yr_end }} \ --ypf={{ ypf }} \