-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaces #4340, contributes to rapidsai/build-planning#33. Proposes packaging `libcugraph` as a wheel, which is then re-used by `cugraph-cu{11,12}` and `pylibcugraph-cu{11,12}` wheels. ## Notes for Reviewers ### Benefits of these changes * smaller wheels (see "Size Changes" below) - *no more `pylibcugraph` and `cugraph` both holding copies of libcugraph.so* * faster compile times - *no more re-compiling RAFT, thanks to rapidsai/raft#2531 - *no more recompiling libcugraph.so in both `pylibcugraph` and `cugraph` wheel builds* * other benefits mentioned in rapidsai/build-planning#33 ### Wheel contents `libcugraph`: * `libcugraph.so` (shared library) * cuGraph headers * vendored dependencies (`fmt`, `spdlog`, CCCL, `cuco`) `pylibcugraph`: * `pylibcugraph` Python / Cython code and compiled Cython extensions `cugraph`: * `cugraph` Python / Cython code and compiled Cython extension ### Dependency Flows In short.... `libcugraph` contains `libcugraph.so` and `libcugraph_c.so` dynamic libraries and the headers to link against it. * Anything that needs to link against cuGraph at build time pulls in `libcugraph` wheels as a build dependency. * Anything that needs cuGraph's symbols at runtime pulls it in as a runtime dependency, and calls `libcugraph.load_library()`. For more details and some flowcharts, see rapidsai/build-planning#33 (comment) ### Size changes (CUDA 12, Python 3.12, x86_64) | wheel | num files (before) | num files (this PR) | size (before) | size (this PR) | |:---------------:|------------------:|-----------------:|--------------:|-------------:| | `libcugraph` | --- | 1762 | --- | 903M | | `pylibcugraph` | 190 | 187 | 901M | 2M | | `cugraph` | 315 | 313 | 899M | 3M | |**TOTAL** | **505** | **2,262** | **1,800M** | **908M** | *NOTES: size = compressed, "before" = 2025-01-13 nightlies* *This is a cuGraph-specific slice of the table from rapidsai/raft#2531. See that PR for details.* ### How I tested this These other PRs: * rapidsai/devcontainers#435 * rapidsai/cugraph-gnn#110 Authors: - James Lamb (https://github.com/jameslamb) - Ralph Liu (https://github.com/nv-rliu) - Bradley Dice (https://github.com/bdice) Approvers: - Brad Rees (https://github.com/BradReesWork) - Bradley Dice (https://github.com/bdice) URL: #4804
- Loading branch information
Showing
28 changed files
with
558 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,25 @@ | ||
#!/bin/bash | ||
# Copyright (c) 2023-2024, NVIDIA CORPORATION. | ||
# Copyright (c) 2023-2025, NVIDIA CORPORATION. | ||
|
||
set -euo pipefail | ||
|
||
package_dir="python/cugraph" | ||
|
||
RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" | ||
|
||
# Download the pylibcugraph wheel built in the previous step and make it | ||
# Download the libcugraph and pylibcugraph wheels built in the previous step and make them | ||
# available for pip to find. | ||
# | ||
# ensure 'cugraph' wheel builds always use the 'pylibcugraph' just built in the same CI run | ||
# | ||
# using env variable PIP_CONSTRAINT is necessary to ensure the constraints | ||
# are used when creating the isolated build environment | ||
CPP_WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="pylibcugraph_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 /tmp/pylibcugraph_dist) | ||
LIBCUGRAPH_WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="libcugraph_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 cpp /tmp/libcugraph_dist) | ||
PYLIBCUGRAPH_WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="pylibcugraph_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 python /tmp/pylibcugraph_dist) | ||
|
||
echo "pylibcugraph-${RAPIDS_PY_CUDA_SUFFIX} @ file://$(echo ${CPP_WHEELHOUSE}/pylibcugraph_*.whl)" > ./constraints.txt | ||
export PIP_CONSTRAINT="${PWD}/constraints.txt" | ||
|
||
PARALLEL_LEVEL=$(python -c \ | ||
"from math import ceil; from multiprocessing import cpu_count; print(ceil(cpu_count()/4))") | ||
case "${RAPIDS_CUDA_VERSION}" in | ||
12.*) | ||
EXTRA_CMAKE_ARGS=";-DUSE_CUDA_MATH_WHEELS=ON" | ||
;; | ||
11.*) | ||
EXTRA_CMAKE_ARGS=";-DUSE_CUDA_MATH_WHEELS=OFF" | ||
;; | ||
esac | ||
cat >> ./constraints.txt <<EOF | ||
libcugraph-${RAPIDS_PY_CUDA_SUFFIX} @ file://$(echo ${LIBCUGRAPH_WHEELHOUSE}/libcugraph_*.whl) | ||
pylibcugraph-${RAPIDS_PY_CUDA_SUFFIX} @ file://$(echo ${PYLIBCUGRAPH_WHEELHOUSE}/pylibcugraph_*.whl) | ||
EOF | ||
|
||
export SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF;-DFIND_CUGRAPH_CPP=OFF${EXTRA_CMAKE_ARGS}" | ||
export SKBUILD_BUILD_TOOL_ARGS="-j${PARALLEL_LEVEL};-l${PARALLEL_LEVEL}" | ||
# Using env variable PIP_CONSTRAINT is necessary to ensure the constraints | ||
# are used when creating the isolated build environment. | ||
export PIP_CONSTRAINT="${PWD}/constraints.txt" | ||
|
||
./ci/build_wheel.sh cugraph ${package_dir} | ||
./ci/build_wheel.sh cugraph ${package_dir} python | ||
./ci/validate_wheel.sh ${package_dir} final_dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
# Copyright (c) 2025, NVIDIA CORPORATION. | ||
|
||
set -euo pipefail | ||
|
||
package_name="libcugraph" | ||
package_dir="python/libcugraph" | ||
|
||
rapids-logger "Generating build requirements" | ||
matrix_selectors="cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION};cuda_suffixed=true" | ||
|
||
rapids-dependency-file-generator \ | ||
--output requirements \ | ||
--file-key "py_build_${package_name}" \ | ||
--file-key "py_rapids_build_${package_name}" \ | ||
--matrix "${matrix_selectors}" \ | ||
| tee /tmp/requirements-build.txt | ||
|
||
rapids-logger "Installing build requirements" | ||
python -m pip install \ | ||
-v \ | ||
--prefer-binary \ | ||
-r /tmp/requirements-build.txt | ||
|
||
rapids-logger "Done build requirements" | ||
|
||
# build with '--no-build-isolation', for better sccache hit rate | ||
# 0 really means "add --no-build-isolation" (ref: https://github.com/pypa/pip/issues/5735) | ||
export PIP_NO_BUILD_ISOLATION=0 | ||
|
||
RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" | ||
|
||
./ci/build_wheel.sh libcugraph ${package_dir} cpp | ||
./ci/validate_wheel.sh ${package_dir} final_dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
#!/bin/bash | ||
# Copyright (c) 2023-2024, NVIDIA CORPORATION. | ||
# Copyright (c) 2023-2025, NVIDIA CORPORATION. | ||
|
||
set -euo pipefail | ||
|
||
package_dir="python/pylibcugraph" | ||
|
||
PARALLEL_LEVEL=$(python -c \ | ||
"from math import ceil; from multiprocessing import cpu_count; print(ceil(cpu_count()/4))") | ||
RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" | ||
|
||
case "${RAPIDS_CUDA_VERSION}" in | ||
12.*) | ||
EXTRA_CMAKE_ARGS=";-DUSE_CUDA_MATH_WHEELS=ON" | ||
;; | ||
11.*) | ||
EXTRA_CMAKE_ARGS=";-DUSE_CUDA_MATH_WHEELS=OFF" | ||
;; | ||
esac | ||
# Download the libcugraph wheel built in the previous step and make it | ||
# available for pip to find. | ||
LIBCUGRAPH_WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="libcugraph_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 cpp /tmp/libcugraph_dist) | ||
|
||
export SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF;-DFIND_CUGRAPH_CPP=OFF${EXTRA_CMAKE_ARGS}" | ||
export SKBUILD_BUILD_TOOL_ARGS="-j${PARALLEL_LEVEL};-l${PARALLEL_LEVEL}" | ||
cat >> ./constraints.txt <<EOF | ||
libcugraph-${RAPIDS_PY_CUDA_SUFFIX} @ file://$(echo ${LIBCUGRAPH_WHEELHOUSE}/libcugraph_*.whl) | ||
EOF | ||
|
||
./ci/build_wheel.sh pylibcugraph ${package_dir} | ||
# Using env variable PIP_CONSTRAINT is necessary to ensure the constraints | ||
# are used when creating the isolated build environment. | ||
export PIP_CONSTRAINT="${PWD}/constraints.txt" | ||
|
||
./ci/build_wheel.sh pylibcugraph ${package_dir} python | ||
./ci/validate_wheel.sh ${package_dir} final_dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.