Skip to content

Commit

Permalink
support post-release versions, public v1.15.0.post1 (#5)
Browse files Browse the repository at this point in the history
Contributes to rapidsai/build-planning#57.

`libucx.load_library()` defined here tries to pre-load `libcuda.so` and
`libnvidia-ml.so`, to raise an informative error (instead of a cryptic
one from a linker) if someone attempts to use the libraries from this
wheel on a system without a GPU.

Some of the projects using these wheels, like `ucxx` and `ucx-py`, are
expected to be usable on systems without a GPU. See
rapidsai/ucx-py#1041 (comment).

To avoid those libraries needing to try-catch these errors, this
proposes the following:

* removing those checks and deferring to downstream libraries to handle
the non-GPU case
* modifying the build logic so we can publish patched versions of these
wheels like `v1.15.0.post1`

### Notes for Reviewers

Proposing starting with `1.15.0.post1` right away, since that's the
version that `ucx-py` will use. I'm proposing the following sequence of
PRs here (assuming downstream testing goes well):

1. this one
2. another changing the version to `1.14.0.post1`
3. another changing the version to `1.16.0.post1`
  • Loading branch information
jameslamb authored May 9, 2024
1 parent ef470ed commit a0bf56f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ While this approach can still be problematic if other libraries loaded on the sy

UCX wheels in this repository are built by using a custom build command for setuptools to trigger the build of the UCX library.
The library is then bundled and installed directly into the output directories.

`{major}.{minor}.{patch}` versions of this library exactly correspond to versions of UCX.
For example, `libucx==1.16.0` contains libraries built from https://github.com/openucx/ucx/releases/tag/v1.16.0.

When the packaging logic itself changes, post-release versions like `libucx==1.16.0.post1` are released.
See "Post-releases" in the Python packaging docs ([link](https://packaging.python.org/en/latest/specifications/version-specifiers/#post-releases)) for details.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.16.0
1.15.0.post1
16 changes: 0 additions & 16 deletions python/libucx/libucx/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,6 @@
]

def load_library():
# First validate if libcuda.so and libnvidia-ml.so are present. These cannot be
# bundled, so we want to provide the user with a reasonable error if they are not
# available rather than a loader error on import.
try:
ctypes.CDLL("libcuda.so.1", ctypes.RTLD_GLOBAL)
except OSError:
raise RuntimeError("The CUDA driver library libcuda.so.1 was not found "
"on your system. This library cannot be provided by the libucx "
"wheel and must be installed separately.")

try:
ctypes.CDLL("libnvidia-ml.so.1", ctypes.RTLD_GLOBAL)
except OSError:
raise RuntimeError("The library libnvidia-ml.so.1 was not found on your "
"system. This library cannot be provided by the libucx wheel and "
"must be installed separately.")

# Dynamically load libucx.so. Prefer a system library if one is present to
# avoid clobbering symbols that other packages might expect, but if no
Expand Down
1 change: 1 addition & 0 deletions python/libucx/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"packaging",
"setuptools>=64.0.0",
"wheel",
]
Expand Down
9 changes: 7 additions & 2 deletions python/libucx/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import tempfile
import glob
import packaging.version


@contextmanager
Expand All @@ -22,13 +23,17 @@ def run(self):
super().run()

with open("VERSION") as f:
version = f.read().strip()
package_version = f.read().strip()

# strip off any other non-UCX version components, like ".post1"
ucx_semver = packaging.version.parse(package_version).base_version
ucx_tag = f"v{ucx_semver}"

install_prefix = os.path.abspath(os.path.join(self.build_lib, "libucx"))

with tempfile.TemporaryDirectory() as tmpdir:
with chdir(tmpdir):
subprocess.run(["git", "clone", "-b", f"v{version}", "https://github.com/openucx/ucx.git", "ucx"])
subprocess.run(["git", "clone", "-b", f"{ucx_tag}", "https://github.com/openucx/ucx.git", "ucx"])
with chdir("ucx"):
subprocess.run(["./autogen.sh"])
subprocess.run(["./contrib/configure-release",
Expand Down

0 comments on commit a0bf56f

Please sign in to comment.