From c60145b0bd8eda79b9555e96819d8a63fbdb4059 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Mon, 31 May 2021 11:28:24 -0700 Subject: [PATCH 1/2] Add a parallel exec for ncremap Also, split the parallel executable for ESMF_RegridWeightGen so it can include flags as needed --- pyremap/remapper.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/pyremap/remapper.py b/pyremap/remapper.py index 5cb9364..0569122 100644 --- a/pyremap/remapper.py +++ b/pyremap/remapper.py @@ -139,7 +139,7 @@ def build_mapping_file(self, method='bilinear', additionalArgs=None, esmf_parallel_exec : {'srun', 'mpirun}, optional The name of the parallel executable to use to launch ESMF tools. - But default, 'mpirun' from the conda environment is used + By default, 'mpirun' from the conda environment is used extrap_method : {'neareststod', 'nearestidavg','creep'}, optional The method used to extrapolate unmapped destination locations @@ -248,14 +248,13 @@ def build_mapping_file(self, method='bilinear', additionalArgs=None, if esmf_parallel_exec is not None: # use the specified parallel executable + parallel_args = esmf_parallel_exec.split(' ') if 'srun' in esmf_parallel_exec: - parallel_args = [esmf_parallel_exec, '-n', - '{}'.format(mpiTasks)] + parallel_args.extend(['-n', '{}'.format(mpiTasks)]) else: # presume mpirun syntax - parallel_args = [esmf_parallel_exec, '-np', - '{}'.format(mpiTasks)] + parallel_args.extend(['-np', '{}'.format(mpiTasks)]) elif 'CONDA_PREFIX' in os.environ and mpiTasks > 1: # this is a conda environment, so we need to find out if esmf @@ -330,7 +329,7 @@ def build_mapping_file(self, method='bilinear', additionalArgs=None, def remap_file(self, inFileName, outFileName, variableList=None, overwrite=False, renormalize=None, logger=None, - replaceMpasFill=False): # {{{ + replaceMpasFill=False, parallel_exec=None): # {{{ """ Given a source file defining either an MPAS mesh or a lat-lon grid and a destination file or set of arrays defining a lat-lon grid, constructs @@ -365,6 +364,10 @@ def remap_file(self, inFileName, outFileName, variableList=None, from MPAS output). If this has been handled before the call, replacing the fill value again may cause errors. + parallel_exec : {'srun'}, optional + The name of the parallel executable to use to launch ncremap. + By default, none is used. + Raises ------ OSError @@ -399,9 +402,15 @@ def remap_file(self, inFileName, outFileName, variableList=None, 'Note: this presumes use of the conda-forge ' 'channel.') - args = ['ncremap', - '-m', self.mappingFileName, - '--vrb=1'] + if parallel_exec is not None: + # use the specified parallel executable + args = parallel_exec.split(' ') + else: + args = list() + + args.extend(['ncremap', + '-m', self.mappingFileName, + '--vrb=1']) regridArgs = [] From 6fba9119a83f3032d117c8497259f8508086f254 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Mon, 31 May 2021 11:50:15 -0700 Subject: [PATCH 2/2] Update to v0.0.13 --- docs/versions.rst | 3 +++ pyremap/__init__.py | 2 +- recipe/meta.yaml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/versions.rst b/docs/versions.rst index ad055f4..edf04fc 100644 --- a/docs/versions.rst +++ b/docs/versions.rst @@ -12,6 +12,7 @@ Documentation On GitHub `v0.0.10`_ `0.0.10`_ `v0.0.11`_ `0.0.11`_ `v0.0.12`_ `0.0.12`_ +`v0.0.13`_ `0.0.13`_ ================ =============== .. _`stable`: ../stable/index.html @@ -22,6 +23,7 @@ Documentation On GitHub .. _`v0.0.10`: ../0.0.10/index.html .. _`v0.0.11`: ../0.0.11/index.html .. _`v0.0.12`: ../0.0.12/index.html +.. _`v0.0.13`: ../0.0.13/index.html .. _`master`: https://github.com/MPAS-Dev/pyremap/tree/master .. _`0.0.6`: https://github.com/MPAS-Dev/pyremap/tree/0.0.6 .. _`0.0.7`: https://github.com/MPAS-Dev/pyremap/tree/0.0.7 @@ -30,3 +32,4 @@ Documentation On GitHub .. _`0.0.10`: https://github.com/MPAS-Dev/pyremap/tree/0.0.10 .. _`0.0.11`: https://github.com/MPAS-Dev/pyremap/tree/0.0.11 .. _`0.0.12`: https://github.com/MPAS-Dev/pyremap/tree/0.0.12 +.. _`0.0.13`: https://github.com/MPAS-Dev/pyremap/tree/0.0.13 diff --git a/pyremap/__init__.py b/pyremap/__init__.py index 2e3ee56..5b984e9 100644 --- a/pyremap/__init__.py +++ b/pyremap/__init__.py @@ -6,5 +6,5 @@ from pyremap.polar import get_polar_descriptor_from_file, get_polar_descriptor -__version_info__ = (0, 0, 12) +__version_info__ = (0, 0, 13) __version__ = '.'.join(str(vi) for vi in __version_info__) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index f5d175a..d6952a3 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,5 +1,5 @@ {% set name = "pyremap" %} -{% set version = "0.0.12" %} +{% set version = "0.0.13" %} package: name: {{ name|lower }}