Skip to content

Commit a123a5d

Browse files
authored
Enable protov2 by default on UCX >= 1.18.0 (#1122)
With protov1 not being actively developed anymore and protov2 now being more stable, it's time to switch permanently. See #1121 for more details. Closes #1121 . Authors: - Peter Andreas Entschev (https://github.com/pentschev) Approvers: - Mads R. B. Kristensen (https://github.com/madsbk) URL: #1122
1 parent 266885d commit a123a5d

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

ucp/__init__.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
1+
# Copyright (c) 2019-2025, NVIDIA CORPORATION. All rights reserved.
22
# See file LICENSE for terms.
33

44
"""UCX-Py: Python bindings for UCX <www.openucx.org>"""
@@ -39,6 +39,19 @@
3939
except ImportError:
4040
pynvml = None
4141

42+
_ucx_version = get_ucx_version()
43+
44+
__ucx_min_version__ = "1.15.0"
45+
__ucx_version__ = "%d.%d.%d" % _ucx_version
46+
47+
if _ucx_version < tuple(int(i) for i in __ucx_min_version__.split(".")):
48+
raise ImportError(
49+
f"Support for UCX {__ucx_version__} has ended. Please upgrade to "
50+
f"{__ucx_min_version__} or newer. If you believe the wrong version "
51+
"is being loaded, please check the path from where UCX is loaded "
52+
"by rerunning with the environment variable `UCX_LOG_LEVEL=debug`."
53+
)
54+
4255
# Setup UCX-Py logger
4356
logger = get_ucxpy_logger()
4457

@@ -53,7 +66,7 @@
5366
if (
5467
pynvml is not None
5568
and "UCX_CUDA_COPY_MAX_REG_RATIO" not in os.environ
56-
and get_ucx_version() >= (1, 12, 0)
69+
and _ucx_version >= (1, 12, 0)
5770
):
5871
try:
5972
pynvml.nvmlInit()
@@ -98,23 +111,11 @@ def _is_mig_device(handle):
98111
):
99112
pass
100113

101-
if "UCX_MAX_RNDV_RAILS" not in os.environ and get_ucx_version() >= (1, 12, 0):
114+
if "UCX_MAX_RNDV_RAILS" not in os.environ and _ucx_version >= (1, 12, 0):
102115
logger.info("Setting UCX_MAX_RNDV_RAILS=1")
103116
os.environ["UCX_MAX_RNDV_RAILS"] = "1"
104117

105-
if "UCX_PROTO_ENABLE" not in os.environ and get_ucx_version() >= (1, 12, 0):
118+
if "UCX_PROTO_ENABLE" not in os.environ and (1, 12, 0) <= _ucx_version < (1, 18, 0):
106119
# UCX protov2 still doesn't support CUDA async/managed memory
107120
logger.info("Setting UCX_PROTO_ENABLE=n")
108121
os.environ["UCX_PROTO_ENABLE"] = "n"
109-
110-
111-
__ucx_min_version__ = "1.15.0"
112-
__ucx_version__ = "%d.%d.%d" % get_ucx_version()
113-
114-
if get_ucx_version() < tuple(int(i) for i in __ucx_min_version__.split(".")):
115-
raise ImportError(
116-
f"Support for UCX {__ucx_version__} has ended. Please upgrade to "
117-
f"{__ucx_min_version__} or newer. If you believe the wrong version "
118-
"is being loaded, please check the path from where UCX is loaded "
119-
"by rerunning with the environment variable `UCX_LOG_LEVEL=debug`."
120-
)

0 commit comments

Comments
 (0)