Skip to content

Commit eae8372

Browse files
authored
Merge pull request #1470 from Unidata/issue1389
disable parallel support via env var
2 parents 25c1684 + d9eca5e commit eae8372

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

Changelog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Change default encoding for stringtochar/chartostring functions from 'utf-8' to 'utf-8'/'ascii' for dtype.kind='U'/'S'
44
(issue #1464).
55
* Fix DeprecationWarning for assigning to numpy.ndarray.shape for numpy >= 2.5.0 (issue #1468).
6+
* Disable parallel support even if libs support it via DISABLE_PARALLEL_SUPPORT env var (issue #1389).
67

78
version 1.7.4 (tag v1.7.4rel)
89
================================

_build/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ def get_netcdf4_include_dir():
113113

114114

115115
def netcdf4_has_parallel_support() -> bool:
116+
# disable parallel support even if libs support it (issue #1389)
117+
DISABLE_PARALLEL_SUPPORT = bool(int(os.environ.get('DISABLE_PARALLEL_SUPPORT', 0)))
118+
if DISABLE_PARALLEL_SUPPORT:
119+
return False
116120
netcdf4_incdir = get_netcdf4_include_dir()
117121
if os.path.exists(ncmetapath := os.path.join(netcdf4_incdir, "netcdf_meta.h")):
118122
with open(ncmetapath) as f:

setup.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ def extract_version(CYTHON_FNAME):
157157
USE_NCCONFIG = bool(int(os.environ.get('USE_NCCONFIG', 0)))
158158
# override use of setup.cfg with env var.
159159
USE_SETUPCFG = bool(int(os.environ.get('USE_SETUPCFG', 1)))
160+
# disable parallel support even if libs support it (issue #1389)
161+
DISABLE_PARALLEL_SUPPORT = bool(int(os.environ.get('DISABLE_PARALLEL_SUPPORT', 0)))
160162

161163
setup_cfg = 'setup.cfg'
162164
# contents of setup.cfg will override env vars, unless
@@ -412,9 +414,13 @@ def _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs):
412414
(netcdf_lib_version > "4.4" and netcdf_lib_version < "4.5"):
413415
has_cdf5_format = True
414416

415-
has_parallel_support = check_has_parallel_support(inc_dirs)
416-
has_has_not = "has" if has_parallel_support else "does not have"
417-
print(f"netcdf lib {has_has_not} parallel functions")
417+
if DISABLE_PARALLEL_SUPPORT:
418+
has_parallel_support = False
419+
print("parallel support disabled via DISABLE_PARALLEL_SUPPORT env var")
420+
else:
421+
has_parallel_support = check_has_parallel_support(inc_dirs)
422+
has_has_not = "has" if has_parallel_support else "does not have"
423+
print(f"netcdf lib {has_has_not} parallel functions")
418424

419425
if has_parallel_support:
420426
# note(stubbiali): mpi4py is not available when using the in-tree build backend

0 commit comments

Comments
 (0)