From ee40cd748012502812010e51a29f0c79a9e22bdf Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 13 Jun 2024 16:47:35 -0500 Subject: [PATCH 1/7] make pip source installs a bit easier --- .readthedocs.yml | 2 -- ci/build_wheel.sh | 2 +- docs/source/install.rst | 4 ++-- pyproject.toml | 2 ++ 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 427cf5b1..a7696003 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -8,8 +8,6 @@ build: post_create_environment: - | pip install \ - --extra-index-url "https://pypi.anaconda.org/rapidsai-wheels-nightly/simple/" \ - -C rapidsai.disable-cuda=true \ -C rapidsai.matrix-entry="cuda=12.2" \ . diff --git a/ci/build_wheel.sh b/ci/build_wheel.sh index 747018f3..0f700c6e 100755 --- a/ci/build_wheel.sh +++ b/ci/build_wheel.sh @@ -26,7 +26,7 @@ rapids-generate-version > ./VERSION RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" -python -m pip wheel . -w dist --no-deps --disable-pip-version-check +python -m pip wheel . -w dist --no-deps --disable-pip-version-check --config-settings rapidsai.disable-cuda=false mkdir -p final_dist python -m auditwheel repair \ diff --git a/docs/source/install.rst b/docs/source/install.rst index ac3038f5..fc1fd551 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -170,6 +170,6 @@ Building and installing UCX-Py can be done via `pip install`. For example: conda activate ucx git clone https://github.com/rapidsai/ucx-py.git cd ucx-py - pip install -v . + pip install -v -C rapidsai.matrix-entry="cuda=12.2" . # or for develop build - pip install -v -e . + pip install -v -e -C rapidsai.matrix-entry="cuda=12.2" . diff --git a/pyproject.toml b/pyproject.toml index 18cc55e1..e8d1ed5a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -116,6 +116,8 @@ build-backend = "setuptools.build_meta" commit-files = [ "ucp/COMMIT_FILE" ] +# by default, do not rename the package 'ucx-py-cu${ver}' +disable-cuda=true dependencies-file = "dependencies.yaml" requires = [ "cython>=3.0.0", From 724647f3d40a2c79cfeb9796a25b96e21ee974e5 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 13 Jun 2024 17:29:22 -0500 Subject: [PATCH 2/7] ensure post versions can be found at build time --- dependencies.yaml | 8 +++++--- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 6fd64d4c..a797065d 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -142,17 +142,19 @@ dependencies: - --extra-index-url=https://pypi.nvidia.com - --extra-index-url=https://pypi.anaconda.org/rapidsai-wheels-nightly/simple specific: + # very tight >=x.x.x,=1.15.0,<1.15.1 - matrix: {cuda: "11.*"} packages: - - libucx-cu11==1.15.0 + - libucx-cu11>=1.15.0,<1.15.1 - matrix: null packages: - - libucx==1.15.0 + - libucx==1.15.0,<1.15.1 depends_on_ucx_run: common: - output_types: conda diff --git a/pyproject.toml b/pyproject.toml index e8d1ed5a..f33b3256 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -121,7 +121,7 @@ disable-cuda=true dependencies-file = "dependencies.yaml" requires = [ "cython>=3.0.0", - "libucx==1.15.0", + "libucx==1.15.0,<1.15.1", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit dependencies.yaml and run `rapids-dependency-file-generator`. [tool.setuptools] From 7b675a48f80c66d84e6230d0ca19b246e866816a Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 27 Jun 2024 11:47:44 -0700 Subject: [PATCH 3/7] do not depend on libucx in interactive builds --- dependencies.yaml | 10 ++++++---- docs/source/install.rst | 4 ++-- pyproject.toml | 3 +-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index a797065d..f63ae126 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -152,9 +152,10 @@ dependencies: - matrix: {cuda: "11.*"} packages: - libucx-cu11>=1.15.0,<1.15.1 + # this fallback is intentionally empty... it simplifies building from source + # without CUDA, e.g. 'pip install .' - matrix: null - packages: - - libucx==1.15.0,<1.15.1 + packages: null depends_on_ucx_run: common: - output_types: conda @@ -174,9 +175,10 @@ dependencies: - matrix: {cuda: "11.*"} packages: - libucx-cu11>=1.15.0,<1.16 + # this fallback is intentionally empty... it simplifies building from source + # without CUDA, e.g. 'pip install .' - matrix: null - packages: - - libucx>=1.15.0,<1.16 + packages: null test_python: common: - output_types: [conda, requirements, pyproject] diff --git a/docs/source/install.rst b/docs/source/install.rst index fc1fd551..ac3038f5 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -170,6 +170,6 @@ Building and installing UCX-Py can be done via `pip install`. For example: conda activate ucx git clone https://github.com/rapidsai/ucx-py.git cd ucx-py - pip install -v -C rapidsai.matrix-entry="cuda=12.2" . + pip install -v . # or for develop build - pip install -v -e -C rapidsai.matrix-entry="cuda=12.2" . + pip install -v -e . diff --git a/pyproject.toml b/pyproject.toml index f33b3256..fc20b787 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,6 @@ authors = [ license = { text = "BSD-3-Clause" } requires-python = ">=3.9" dependencies = [ - "libucx>=1.15.0,<1.16", "numpy>=1.23,<2.0a0", "pynvml>=11.4.1", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit dependencies.yaml and run `rapids-dependency-file-generator`. @@ -117,11 +116,11 @@ commit-files = [ "ucp/COMMIT_FILE" ] # by default, do not rename the package 'ucx-py-cu${ver}' +# (this is overridden in wheel publishing) disable-cuda=true dependencies-file = "dependencies.yaml" requires = [ "cython>=3.0.0", - "libucx==1.15.0,<1.15.1", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit dependencies.yaml and run `rapids-dependency-file-generator`. [tool.setuptools] From 0387f3e635f9d7c072379621b19eca2c06108254 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Mon, 1 Jul 2024 11:53:23 -0500 Subject: [PATCH 4/7] docs builds could now avoid specifying a CUDA dependency and just link to 'ucx' from the conda environment --- .readthedocs.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index a7696003..3f5f38de 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -6,10 +6,7 @@ build: python: "mambaforge-22.9" jobs: post_create_environment: - - | - pip install \ - -C rapidsai.matrix-entry="cuda=12.2" \ - . + - pip install . conda: environment: conda/environments/builddocs.yml From 1c2d4dea22ef27a12f03de446e199aed190d8531 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Mon, 1 Jul 2024 12:08:49 -0500 Subject: [PATCH 5/7] add ucx back to conda env --- conda/environments/builddocs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/conda/environments/builddocs.yml b/conda/environments/builddocs.yml index 14419853..369ad284 100644 --- a/conda/environments/builddocs.yml +++ b/conda/environments/builddocs.yml @@ -12,6 +12,7 @@ dependencies: - nbsphinx - numpydoc - recommonmark +- ucx - pandoc=<2.0.0 - pip - cython From e6cc1767c5fec03e901d26bc1d49b70b7553f879 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Mon, 1 Jul 2024 12:21:19 -0500 Subject: [PATCH 6/7] revert to passing rapidsai.matrix-entry in docs builds, to continue getting a bit of test coverage for libucx in CUDA-less environments --- .readthedocs.yml | 7 ++++++- conda/environments/builddocs.yml | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 3f5f38de..a7bcccc2 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -6,7 +6,12 @@ build: python: "mambaforge-22.9" jobs: post_create_environment: - - pip install . + # explicitly passing matrix-entry so that 'libucx' is pulled in, + # and therefore tested in this no-CUDA environment + - | + pip install \ + -C rapidsai.matrix-entry="cuda=12.2" \ + . conda: environment: conda/environments/builddocs.yml diff --git a/conda/environments/builddocs.yml b/conda/environments/builddocs.yml index 369ad284..14419853 100644 --- a/conda/environments/builddocs.yml +++ b/conda/environments/builddocs.yml @@ -12,7 +12,6 @@ dependencies: - nbsphinx - numpydoc - recommonmark -- ucx - pandoc=<2.0.0 - pip - cython From a39811cc14034fc4890086dadd8e5022dddcdd28 Mon Sep 17 00:00:00 2001 From: Peter Andreas Entschev Date: Tue, 2 Jul 2024 08:01:45 -0700 Subject: [PATCH 7/7] Document PyPI installation --- docker/ucx-py-cuda11.5.yml | 2 +- docs/source/install.rst | 101 ++++++++++++++++++++++++++++++++++--- 2 files changed, 94 insertions(+), 9 deletions(-) diff --git a/docker/ucx-py-cuda11.5.yml b/docker/ucx-py-cuda11.5.yml index 9e82f34b..39c08700 100644 --- a/docker/ucx-py-cuda11.5.yml +++ b/docker/ucx-py-cuda11.5.yml @@ -7,7 +7,7 @@ dependencies: - python=3.9 - cudatoolkit=11.5 - setuptools - - cython>=0.29.14,<3.0.0a0 + - cython>=3.0.0 - pytest - pytest-asyncio - dask diff --git a/docs/source/install.rst b/docs/source/install.rst index ac3038f5..b8712828 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -46,15 +46,40 @@ be done if desired (e.g., to test for new capabilities or bug fixes). conda create -n ucx -c conda-forge -c rapidsai \ cudatoolkit= ucx-py +PyPI +---- + +PyPI installation is possible and currently supports two variants: CUDA +version ``11`` and ``12``. Both packages are compatible with CPU-only +workloads and either one can be chosen if the application doesn't use +CUDA, but currently there are no pre-built CPU-only packages available, +so either one of CUDA packages must be installed instead. The CUDA +version is differentiated by the suffix ``-cuXY``, where ``XY`` must be +replaced with the desired CUDA version. Installing CUDA ``12`` package +can be done with the following command: + +:: + + pip install ucx-py-cu12 + + +UCX-Py has no direct dependency on CUDA, but the package specifies the +``-cuXY`` prefix so that the correct ``libucx-cuXY`` package is selected. +This is also the reason why there are no CPU-only UCX-Py packages +available at the moment, CPU-only builds of the UCX library are not +currently available in PyPI. Source ------ -The following instructions assume you'll be using UCX-Py on a CUDA enabled system and is in a `Conda environment `_. +Conda +~~~~~ + +The following instructions assume you'll be using UCX-Py on a CUDA-enabled system and is in a `Conda environment `_. Build Dependencies -~~~~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^^^^ :: @@ -67,7 +92,7 @@ Build Dependencies only Python 3.9, 3.10, and 3.11. Test Dependencies -~~~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^^^ :: @@ -78,7 +103,7 @@ Test Dependencies UCX >= 1.11.1 -~~~~~~~~~~~~~ +^^^^^^^^^^^^^ Instructions for building UCX >= 1.11.1 (minimum version supported by UCX-Py), make sure to change ``git checkout v1.11.1`` to a newer version if desired: @@ -99,7 +124,7 @@ Instructions for building UCX >= 1.11.1 (minimum version supported by UCX-Py), m UCX + rdma-core -~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^ It is possible to enable InfiniBand support via the conda-forge rdma-core package. To do so, first activate the environment created previously and install conda-forge compilers and rdma-core: @@ -127,7 +152,7 @@ After installing the necessary dependencies, it's now time to build UCX from sou UCX + MOFED -~~~~~~~~~~~ +^^^^^^^^^^^ It is still possible to build UCX and use the MOFED system install. Unlike the case above, we must not install conda-forge compilers, this is because conda-forge compilers can't look for libraries in the system directories (e.g., ``/usr``). Additionally, the rdma-core conda-forge package @@ -161,9 +186,32 @@ to adjust that for the path to your system compilers. For example: UCX-Py -~~~~~~ +^^^^^^ + +Building and installing UCX-Py can be done via ``pip install``. For example: + +:: + + conda activate ucx + git clone https://github.com/rapidsai/ucx-py.git + cd ucx-py + pip install -v . + # or for develop build + pip install -v -e . + + +PyPI +~~~~ + +The following instructions assume you'll be installing UCX-Py on a CUDA-enabled system, in a pip-only environment. + +Installing UCX-Py from source in a pip-only environment has additional limitations when compared to conda environments. Unlike conda packages, where the ``ucx`` package is installed under the ``CONDA_PREFIX``, ``libucx`` is installed under ``site-packages`` which is normally not looked for system libraries. Therefore, you will either need UCX to be installed in the system path, or include the UCX install path in ``LD_LIBRARY_PATH``. + + +UCX-Py with UCX system install +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Building and installing UCX-Py can be done via `pip install`. For example: +If a UCX system install is available, building and installing UCX-Py can be done via ``pip install`` with no additional requirements. For example: :: @@ -173,3 +221,40 @@ Building and installing UCX-Py can be done via `pip install`. For example: pip install -v . # or for develop build pip install -v -e . + + +UCX-Py with custom UCX install +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If UCX is installed in a non-default path, specifying ``LD_LIBRARY_PATH`` is required both to install and run UCX-Py code. For installation, ``LD_LIBRARY_PATH`` is required to ensure UCX-Py builds against the desired version of UCX, since another incompatible UCX version may already be installed in the system. Running UCX-Py code also needs to find the proper UCX libraries at runtime, and thus ``LD_LIBRARY_PATH`` must be specified as well. + +A custom UCX install does not necessarily mean it needs to be build from source, a ``libucx-cuXY`` package may be used as well. For example, with the CUDA ``12`` package: + +:: + + pip install libucx-cu12 + +The above will install the UCX library in your environment, specifically under ``site-packages/libucx``. To find the path to ``site-packages`` you may execute: + +:: + + python -c "import site; print(site.getsitepackages()[0])" + +The command above will print the path to ``site-packages``, such as ``/opt/python/site-packages``. The path to the UCX shared library installation is then ``/opt/python/site-packages/libucx/lib``, which is the value that will be specified for ``LD_LIBRARY_PATH``. If you build UCX from source and installed it in a different location, make sure you adjust the value of ``LD_LIBRARY_PATH`` accordingly, or if you built UCX from source and installed it in a path that the system will lookup for libraries by default, specifying ``LD_LIBRARY_PATH`` is unnecessary. + +Now installing UCX-Py can be done via ``pip install``: + +:: + + conda activate ucx + git clone https://github.com/rapidsai/ucx-py.git + cd ucx-py + LD_LIBRARY_PATH=/opt/python/site-packages/libucx/lib pip install -v . + # or for develop build + LD_LIBRARY_PATH=/opt/python/site-packages/libucx/lib pip install -v -e . + +Now, to run UCX-Py-enabled code specifying ``LD_LIBRARY_PATH`` will also be required. For example: + +:: + + LD_LIBRARY_PATH=/opt/python/site-packages/libucx/lib python -c "import ucp; print(ucp.get_ucx_version())"